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
0e5e8ca9
Commit
0e5e8ca9
authored
Feb 27, 2015
by
antirez
Browse files
Utils: Include stdint.h and fix signess in sdigits10().
parent
084a59c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
0e5e8ca9
...
@@ -256,7 +256,7 @@ uint32_t sdigits10(int64_t v) {
...
@@ -256,7 +256,7 @@ uint32_t sdigits10(int64_t v) {
if
(
v
<
0
)
{
if
(
v
<
0
)
{
/* Abs value of LLONG_MIN requires special handling. */
/* Abs value of LLONG_MIN requires special handling. */
uint64_t
uv
=
(
v
!=
LLONG_MIN
)
?
uint64_t
uv
=
(
v
!=
LLONG_MIN
)
?
-
v
:
((
uint64_t
)
LLONG_MAX
)
+
1
;
(
uint64_t
)
-
v
:
((
uint64_t
)
LLONG_MAX
)
+
1
;
return
digits10
(
uv
)
+
1
;
/* +1 for the minus. */
return
digits10
(
uv
)
+
1
;
/* +1 for the minus. */
}
else
{
}
else
{
return
digits10
(
v
);
return
digits10
(
v
);
...
...
src/util.h
View file @
0e5e8ca9
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#ifndef __REDIS_UTIL_H
#ifndef __REDIS_UTIL_H
#define __REDIS_UTIL_H
#define __REDIS_UTIL_H
#include <stdint.h>
#include "sds.h"
#include "sds.h"
int
stringmatchlen
(
const
char
*
p
,
int
plen
,
const
char
*
s
,
int
slen
,
int
nocase
);
int
stringmatchlen
(
const
char
*
p
,
int
plen
,
const
char
*
s
,
int
slen
,
int
nocase
);
...
...
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