Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3464b670
Commit
3464b670
authored
Dec 05, 2017
by
Daniel Black
Committed by
Sergey Vojtovich
Dec 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysys: handle T, P, E suffixs
Signed-off-by:
Daniel Black
<
daniel@linux.vnet.ibm.com
>
parent
22f2b39c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
mysys/my_getopt.c
mysys/my_getopt.c
+27
-15
No files found.
mysys/my_getopt.c
View file @
3464b670
...
...
@@ -969,31 +969,43 @@ my_bool getopt_compare_strings(register const char *s, register const char *t,
/*
function: eval_num_suffix
Transforms suffix like k/m/g to their real value.
Transforms suffix like k/m/g
/t/p/e
to their real value.
*/
static
inline
long
eval_num_suffix
(
char
*
suffix
,
int
*
error
)
static
inline
ulong
long
eval_num_suffix
(
char
*
suffix
,
int
*
error
)
{
long
num
=
1
;
if
(
*
suffix
==
'k'
||
*
suffix
==
'K'
)
num
*=
1024L
;
else
if
(
*
suffix
==
'm'
||
*
suffix
==
'M'
)
num
*=
1024L
*
1024L
;
else
if
(
*
suffix
==
'g'
||
*
suffix
==
'G'
)
num
*=
1024L
*
1024L
*
1024L
;
else
if
(
*
suffix
)
{
switch
(
*
suffix
)
{
case
'\0'
:
return
1ULL
;
case
'k'
:
case
'K'
:
return
1ULL
<<
10
;
case
'm'
:
case
'M'
:
return
1ULL
<<
20
;
case
'g'
:
case
'G'
:
return
1ULL
<<
30
;
case
't'
:
case
'T'
:
return
1ULL
<<
40
;
case
'p'
:
case
'P'
:
return
1ULL
<<
50
;
case
'e'
:
case
'E'
:
return
1ULL
<<
60
;
default:
*
error
=
1
;
return
0
;
return
0
ULL
;
}
return
num
;
}
/*
function: eval_num_suffix_ll
Transforms a number with a suffix to real number. Suffix can
be k|K for kilo, m|M for mega
or g|G for giga
.
be k|K for kilo, m|M for mega
, etc
.
*/
static
longlong
eval_num_suffix_ll
(
char
*
argument
,
...
...
@@ -1026,7 +1038,7 @@ static longlong eval_num_suffix_ll(char *argument,
function: eval_num_suffix_ull
Transforms a number with a suffix to positive Integer. Suffix can
be k|K for kilo, m|M for mega
or g|G for giga
.
be k|K for kilo, m|M for mega
, etc
.
*/
static
ulonglong
eval_num_suffix_ull
(
char
*
argument
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment