Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9ea54fee
Commit
9ea54fee
authored
Jan 02, 2012
by
Pieter Noordhuis
Browse files
string2* functions take a const pointer
parent
2ebd2720
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
9ea54fee
...
...
@@ -209,8 +209,8 @@ int ll2string(char *s, size_t len, long long value) {
/* Convert a string into a long long. Returns 1 if the string could be parsed
* into a (non-overflowing) long long, 0 otherwise. The value will be set to
* the parsed value when appropriate. */
int
string2ll
(
char
*
s
,
size_t
slen
,
long
long
*
value
)
{
char
*
p
=
s
;
int
string2ll
(
const
char
*
s
,
size_t
slen
,
long
long
*
value
)
{
const
char
*
p
=
s
;
size_t
plen
=
0
;
int
negative
=
0
;
unsigned
long
long
v
;
...
...
@@ -275,7 +275,7 @@ int string2ll(char *s, size_t slen, long long *value) {
/* Convert a string into a long. Returns 1 if the string could be parsed into a
* (non-overflowing) long, 0 otherwise. The value will be set to the parsed
* value when appropriate. */
int
string2l
(
char
*
s
,
size_t
slen
,
long
*
lval
)
{
int
string2l
(
const
char
*
s
,
size_t
slen
,
long
*
lval
)
{
long
long
llval
;
if
(
!
string2ll
(
s
,
slen
,
&
llval
))
...
...
src/util.h
View file @
9ea54fee
...
...
@@ -5,8 +5,8 @@ int stringmatchlen(const char *p, int plen, const char *s, int slen, int nocase)
int
stringmatch
(
const
char
*
p
,
const
char
*
s
,
int
nocase
);
long
long
memtoll
(
const
char
*
p
,
int
*
err
);
int
ll2string
(
char
*
s
,
size_t
len
,
long
long
value
);
int
string2ll
(
char
*
s
,
size_t
slen
,
long
long
*
value
);
int
string2l
(
char
*
s
,
size_t
slen
,
long
*
value
);
int
string2ll
(
const
char
*
s
,
size_t
slen
,
long
long
*
value
);
int
string2l
(
const
char
*
s
,
size_t
slen
,
long
*
value
);
int
d2string
(
char
*
buf
,
size_t
len
,
double
value
);
#endif
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