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
560e0499
Commit
560e0499
authored
Jan 17, 2013
by
guiquanz
Committed by
antirez
Jan 19, 2013
Browse files
Fixed many typos.
parent
c2b43eac
Changes
38
Hide whitespace changes
Inline
Side-by-side
redis.conf
View file @
560e0499
...
@@ -246,7 +246,7 @@ slave-priority 100
...
@@ -246,7 +246,7 @@ slave-priority 100
# Set the max number of connected clients at the same time. By default
# Set the max number of connected clients at the same time. By default
# this limit is set to 10000 clients, however if the Redis server is not
# this limit is set to 10000 clients, however if the Redis server is not
# able
o
t configure the process file limit to allow for the specified limit
# able t
o
configure the process file limit to allow for the specified limit
# the max number of allowed clients is set to the current file limit
# the max number of allowed clients is set to the current file limit
# minus 32 (as Redis reserves a few file descriptors for internal uses).
# minus 32 (as Redis reserves a few file descriptors for internal uses).
#
#
...
...
sentinel.conf
View file @
560e0499
...
@@ -71,7 +71,7 @@ sentinel parallel-syncs mymaster 1
...
@@ -71,7 +71,7 @@ sentinel parallel-syncs mymaster 1
# Default is 15 minutes.
# Default is 15 minutes.
sentinel
failover
-
timeout
mymaster
900000
sentinel
failover
-
timeout
mymaster
900000
# SCRIPTS EXECTION
# SCRIPTS EXEC
U
TION
#
#
# sentinel notification-script and sentinel reconfig-script are used in order
# sentinel notification-script and sentinel reconfig-script are used in order
# to configure scripts that are called to notify the system administrator
# to configure scripts that are called to notify the system administrator
...
...
src/adlist.c
View file @
560e0499
...
@@ -97,7 +97,7 @@ list *listAddNodeHead(list *list, void *value)
...
@@ -97,7 +97,7 @@ list *listAddNodeHead(list *list, void *value)
return
list
;
return
list
;
}
}
/* Add a new node to the list, to tail, contaning the specified 'value'
/* Add a new node to the list, to tail, conta
i
ning the specified 'value'
* pointer as value.
* pointer as value.
*
*
* On error, NULL is returned and no operation is performed (i.e. the
* On error, NULL is returned and no operation is performed (i.e. the
...
@@ -308,7 +308,7 @@ listNode *listSearchKey(list *list, void *key)
...
@@ -308,7 +308,7 @@ listNode *listSearchKey(list *list, void *key)
/* Return the element at the specified zero-based index
/* Return the element at the specified zero-based index
* where 0 is the head, 1 is the element next to head
* where 0 is the head, 1 is the element next to head
* and so on. Negative integers are used in order to count
* and so on. Negative integers are used in order to count
* from the tail, -1 is the last element, -2 the penultima
n
te
* from the tail, -1 is the last element, -2 the penultimate
* and so on. If the index is out of range NULL is returned. */
* and so on. If the index is out of range NULL is returned. */
listNode
*
listIndex
(
list
*
list
,
long
index
)
{
listNode
*
listIndex
(
list
*
list
,
long
index
)
{
listNode
*
n
;
listNode
*
n
;
...
@@ -330,7 +330,7 @@ void listRotate(list *list) {
...
@@ -330,7 +330,7 @@ void listRotate(list *list) {
if
(
listLength
(
list
)
<=
1
)
return
;
if
(
listLength
(
list
)
<=
1
)
return
;
/* Deta
t
ch current tail */
/* Detach current tail */
list
->
tail
=
tail
->
prev
;
list
->
tail
=
tail
->
prev
;
list
->
tail
->
next
=
NULL
;
list
->
tail
->
next
=
NULL
;
/* Move it as head */
/* Move it as head */
...
...
src/ae.c
View file @
560e0499
...
@@ -309,7 +309,7 @@ static int processTimeEvents(aeEventLoop *eventLoop) {
...
@@ -309,7 +309,7 @@ static int processTimeEvents(aeEventLoop *eventLoop) {
/* Process every pending time event, then every pending file event
/* Process every pending time event, then every pending file event
* (that may be registered by time event callbacks just processed).
* (that may be registered by time event callbacks just processed).
* Without special flags the function sleeps until some file event
* Without special flags the function sleeps until some file event
* fires, or when the next time event occur
r
s (if any).
* fires, or when the next time event occurs (if any).
*
*
* If flags is 0, the function does nothing and returns.
* If flags is 0, the function does nothing and returns.
* if flags has AE_ALL_EVENTS set, all the kind of events are processed.
* if flags has AE_ALL_EVENTS set, all the kind of events are processed.
...
@@ -356,7 +356,7 @@ int aeProcessEvents(aeEventLoop *eventLoop, int flags)
...
@@ -356,7 +356,7 @@ int aeProcessEvents(aeEventLoop *eventLoop, int flags)
if
(
tvp
->
tv_usec
<
0
)
tvp
->
tv_usec
=
0
;
if
(
tvp
->
tv_usec
<
0
)
tvp
->
tv_usec
=
0
;
}
else
{
}
else
{
/* If we have to check for events but need to return
/* If we have to check for events but need to return
* ASAP because of AE_DONT_WAIT we need to se the timeout
* ASAP because of AE_DONT_WAIT we need to se
t
the timeout
* to zero */
* to zero */
if
(
flags
&
AE_DONT_WAIT
)
{
if
(
flags
&
AE_DONT_WAIT
)
{
tv
.
tv_sec
=
tv
.
tv_usec
=
0
;
tv
.
tv_sec
=
tv
.
tv_usec
=
0
;
...
@@ -395,7 +395,7 @@ int aeProcessEvents(aeEventLoop *eventLoop, int flags)
...
@@ -395,7 +395,7 @@ int aeProcessEvents(aeEventLoop *eventLoop, int flags)
return
processed
;
/* return the number of processed file/time events */
return
processed
;
/* return the number of processed file/time events */
}
}
/* Wait for millseconds until the given file descriptor becomes
/* Wait for mill
i
seconds until the given file descriptor becomes
* writable/readable/exception */
* writable/readable/exception */
int
aeWait
(
int
fd
,
int
mask
,
long
long
milliseconds
)
{
int
aeWait
(
int
fd
,
int
mask
,
long
long
milliseconds
)
{
struct
pollfd
pfd
;
struct
pollfd
pfd
;
...
...
src/ae_evport.c
View file @
560e0499
...
@@ -50,15 +50,15 @@ static int evport_debug = 0;
...
@@ -50,15 +50,15 @@ static int evport_debug = 0;
* aeApiPoll, the corresponding file descriptors become dissociated from the
* aeApiPoll, the corresponding file descriptors become dissociated from the
* port. This is necessary because poll events are level-triggered, so if the
* port. This is necessary because poll events are level-triggered, so if the
* fd didn't become dissociated, it would immediately fire another event since
* fd didn't become dissociated, it would immediately fire another event since
* the underlying state hasn't changed yet. We must reassociate the file
* the underlying state hasn't changed yet. We must re
-
associate the file
* descriptor, but only after we know that our caller has actually read from it.
* descriptor, but only after we know that our caller has actually read from it.
* The ae API does not tell us exactly when that happens, but we do know that
* The ae API does not tell us exactly when that happens, but we do know that
* it must happen by the time aeApiPoll is called again. Our solution is to
* it must happen by the time aeApiPoll is called again. Our solution is to
* keep track of the last fds returned by aeApiPoll and reassociate them next
* keep track of the last fds returned by aeApiPoll and re
-
associate them next
* time aeApiPoll is invoked.
* time aeApiPoll is invoked.
*
*
* To summarize, in this module, each fd association is EITHER (a) represented
* To summarize, in this module, each fd association is EITHER (a) represented
* only via the in-kernel assocation OR (b) represented by pending_fds and
* only via the in-kernel assoc
i
ation OR (b) represented by pending_fds and
* pending_masks. (b) is only true for the last fds we returned from aeApiPoll,
* pending_masks. (b) is only true for the last fds we returned from aeApiPoll,
* and only until we enter aeApiPoll again (at which point we restore the
* and only until we enter aeApiPoll again (at which point we restore the
* in-kernel association).
* in-kernel association).
...
@@ -164,7 +164,7 @@ static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
...
@@ -164,7 +164,7 @@ static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
* This fd was recently returned from aeApiPoll. It should be safe to
* This fd was recently returned from aeApiPoll. It should be safe to
* assume that the consumer has processed that poll event, but we play
* assume that the consumer has processed that poll event, but we play
* it safer by simply updating pending_mask. The fd will be
* it safer by simply updating pending_mask. The fd will be
* reassociated as usual when aeApiPoll is called again.
* re
-
associated as usual when aeApiPoll is called again.
*/
*/
if
(
evport_debug
)
if
(
evport_debug
)
fprintf
(
stderr
,
"aeApiAddEvent: adding to pending fd %d
\n
"
,
fd
);
fprintf
(
stderr
,
"aeApiAddEvent: adding to pending fd %d
\n
"
,
fd
);
...
@@ -228,7 +228,7 @@ static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
...
@@ -228,7 +228,7 @@ static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
* ENOMEM is a potentially transient condition, but the kernel won't
* ENOMEM is a potentially transient condition, but the kernel won't
* generally return it unless things are really bad. EAGAIN indicates
* generally return it unless things are really bad. EAGAIN indicates
* we've reached an resource limit, for which it doesn't make sense to
* we've reached an resource limit, for which it doesn't make sense to
* retry (counterintuitively). All other errors indicate a bug. In any
* retry (counter
-
intuitively). All other errors indicate a bug. In any
* of these cases, the best we can do is to abort.
* of these cases, the best we can do is to abort.
*/
*/
abort
();
/* will not return */
abort
();
/* will not return */
...
@@ -243,7 +243,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
...
@@ -243,7 +243,7 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
port_event_t
event
[
MAX_EVENT_BATCHSZ
];
port_event_t
event
[
MAX_EVENT_BATCHSZ
];
/*
/*
* If we've returned fd events before, we must reassociate them with the
* If we've returned fd events before, we must re
-
associate them with the
* port now, before calling port_get(). See the block comment at the top of
* port now, before calling port_get(). See the block comment at the top of
* this file for an explanation of why.
* this file for an explanation of why.
*/
*/
...
...
src/anet.c
View file @
560e0499
...
@@ -61,7 +61,7 @@ int anetNonBlock(char *err, int fd)
...
@@ -61,7 +61,7 @@ int anetNonBlock(char *err, int fd)
{
{
int
flags
;
int
flags
;
/* Set the socket nonblocking.
/* Set the socket non
-
blocking.
* Note that fcntl(2) for F_GETFL and F_SETFL can't be
* Note that fcntl(2) for F_GETFL and F_SETFL can't be
* interrupted by a signal. */
* interrupted by a signal. */
if
((
flags
=
fcntl
(
fd
,
F_GETFL
))
==
-
1
)
{
if
((
flags
=
fcntl
(
fd
,
F_GETFL
))
==
-
1
)
{
...
@@ -132,7 +132,7 @@ static int anetCreateSocket(char *err, int domain) {
...
@@ -132,7 +132,7 @@ static int anetCreateSocket(char *err, int domain) {
return
ANET_ERR
;
return
ANET_ERR
;
}
}
/* Make sure connection-intensive things like the redis benc
k
mark
/* Make sure connection-intensive things like the redis benc
h
mark
* will be able to close/open sockets a zillion of times */
* will be able to close/open sockets a zillion of times */
if
(
setsockopt
(
s
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
on
,
sizeof
(
on
))
==
-
1
)
{
if
(
setsockopt
(
s
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
on
,
sizeof
(
on
))
==
-
1
)
{
anetSetError
(
err
,
"setsockopt SO_REUSEADDR: %s"
,
strerror
(
errno
));
anetSetError
(
err
,
"setsockopt SO_REUSEADDR: %s"
,
strerror
(
errno
));
...
...
src/aof.c
View file @
560e0499
...
@@ -385,7 +385,7 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a
...
@@ -385,7 +385,7 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a
sds
buf
=
sdsempty
();
sds
buf
=
sdsempty
();
robj
*
tmpargv
[
3
];
robj
*
tmpargv
[
3
];
/* The DB this command was target
t
ing is not the same as the last command
/* The DB this command was targeting is not the same as the last command
* we appendend. To issue a SELECT command is needed. */
* we appendend. To issue a SELECT command is needed. */
if
(
dictid
!=
server
.
aof_selected_db
)
{
if
(
dictid
!=
server
.
aof_selected_db
)
{
char
seldb
[
64
];
char
seldb
[
64
];
...
...
src/bio.c
View file @
560e0499
...
@@ -73,7 +73,7 @@ static list *bio_jobs[REDIS_BIO_NUM_OPS];
...
@@ -73,7 +73,7 @@ static list *bio_jobs[REDIS_BIO_NUM_OPS];
static
unsigned
long
long
bio_pending
[
REDIS_BIO_NUM_OPS
];
static
unsigned
long
long
bio_pending
[
REDIS_BIO_NUM_OPS
];
/* This structure represents a background Job. It is only used locally to this
/* This structure represents a background Job. It is only used locally to this
* file as the API d
e
os not expose the internals at all. */
* file as the API do
e
s not expose the internals at all. */
struct
bio_job
{
struct
bio_job
{
time_t
time
;
/* Time at which the job was created. */
time_t
time
;
/* Time at which the job was created. */
/* Job specific arguments pointers. If we need to pass more than three
/* Job specific arguments pointers. If we need to pass more than three
...
...
src/bitops.c
View file @
560e0499
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
* Helpers and low level bit functions.
* Helpers and low level bit functions.
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
/* This helper function used by GETBIT / SETBIT parses the bit offset argu
e
mnt
/* This helper function used by GETBIT / SETBIT parses the bit offset argum
e
nt
* making sure an error is returned if it is negative or if it overflows
* making sure an error is returned if it is negative or if it overflows
* Redis 512 MB limit for the string value. */
* Redis 512 MB limit for the string value. */
static
int
getBitOffsetFromArgument
(
redisClient
*
c
,
robj
*
o
,
size_t
*
offset
)
{
static
int
getBitOffsetFromArgument
(
redisClient
*
c
,
robj
*
o
,
size_t
*
offset
)
{
...
@@ -189,7 +189,7 @@ void bitopCommand(redisClient *c) {
...
@@ -189,7 +189,7 @@ void bitopCommand(redisClient *c) {
char
*
opname
=
c
->
argv
[
1
]
->
ptr
;
char
*
opname
=
c
->
argv
[
1
]
->
ptr
;
robj
*
o
,
*
targetkey
=
c
->
argv
[
2
];
robj
*
o
,
*
targetkey
=
c
->
argv
[
2
];
long
op
,
j
,
numkeys
;
long
op
,
j
,
numkeys
;
robj
**
objects
;
/* Array of so
r
uce objects. */
robj
**
objects
;
/* Array of sou
r
ce objects. */
unsigned
char
**
src
;
/* Array of source strings pointers. */
unsigned
char
**
src
;
/* Array of source strings pointers. */
long
*
len
,
maxlen
=
0
;
/* Array of length of src strings, and max len. */
long
*
len
,
maxlen
=
0
;
/* Array of length of src strings, and max len. */
long
minlen
=
0
;
/* Min len among the input keys. */
long
minlen
=
0
;
/* Min len among the input keys. */
...
...
src/config.c
View file @
560e0499
...
@@ -329,7 +329,7 @@ void loadServerConfigFromString(char *config) {
...
@@ -329,7 +329,7 @@ void loadServerConfigFromString(char *config) {
goto
loaderr
;
goto
loaderr
;
}
}
/* If the target command name is the em
t
py string we just
/* If the target command name is the emp
t
y string we just
* remove it from the command table. */
* remove it from the command table. */
retval
=
dictDelete
(
server
.
commands
,
argv
[
1
]);
retval
=
dictDelete
(
server
.
commands
,
argv
[
1
]);
redisAssert
(
retval
==
DICT_OK
);
redisAssert
(
retval
==
DICT_OK
);
...
@@ -367,7 +367,7 @@ void loadServerConfigFromString(char *config) {
...
@@ -367,7 +367,7 @@ void loadServerConfigFromString(char *config) {
soft
=
memtoll
(
argv
[
3
],
NULL
);
soft
=
memtoll
(
argv
[
3
],
NULL
);
soft_seconds
=
atoi
(
argv
[
4
]);
soft_seconds
=
atoi
(
argv
[
4
]);
if
(
soft_seconds
<
0
)
{
if
(
soft_seconds
<
0
)
{
err
=
"Negative number of seconds in soft limt is invalid"
;
err
=
"Negative number of seconds in soft lim
i
t is invalid"
;
goto
loaderr
;
goto
loaderr
;
}
}
server
.
client_obuf_limits
[
class
].
hard_limit_bytes
=
hard
;
server
.
client_obuf_limits
[
class
].
hard_limit_bytes
=
hard
;
...
@@ -412,7 +412,7 @@ loaderr:
...
@@ -412,7 +412,7 @@ loaderr:
* in the 'options' string to the config file before loading.
* in the 'options' string to the config file before loading.
*
*
* Both filename and options can be NULL, in such a case are considered
* Both filename and options can be NULL, in such a case are considered
* em
t
py. This way loadServerConfig can be used to just load a file or
* emp
t
y. This way loadServerConfig can be used to just load a file or
* just load a string. */
* just load a string. */
void
loadServerConfig
(
char
*
filename
,
char
*
options
)
{
void
loadServerConfig
(
char
*
filename
,
char
*
options
)
{
sds
config
=
sdsempty
();
sds
config
=
sdsempty
();
...
...
src/db.c
View file @
560e0499
...
@@ -44,7 +44,7 @@ robj *lookupKey(redisDb *db, robj *key) {
...
@@ -44,7 +44,7 @@ robj *lookupKey(redisDb *db, robj *key) {
if
(
de
)
{
if
(
de
)
{
robj
*
val
=
dictGetVal
(
de
);
robj
*
val
=
dictGetVal
(
de
);
/* Update the access time for the aging algorithm.
/* Update the access time for the ag
e
ing algorithm.
* Don't do it if we have a saving child, as this will trigger
* Don't do it if we have a saving child, as this will trigger
* a copy on write madness. */
* a copy on write madness. */
if
(
server
.
rdb_child_pid
==
-
1
&&
server
.
aof_child_pid
==
-
1
)
if
(
server
.
rdb_child_pid
==
-
1
&&
server
.
aof_child_pid
==
-
1
)
...
@@ -85,7 +85,7 @@ robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply) {
...
@@ -85,7 +85,7 @@ robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply) {
}
}
/* Add the key to the DB. It's up to the caller to increment the reference
/* Add the key to the DB. It's up to the caller to increment the reference
* counte of the value if needed.
* counte
r
of the value if needed.
*
*
* The program is aborted if the key already exists. */
* The program is aborted if the key already exists. */
void
dbAdd
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
)
{
void
dbAdd
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
)
{
...
@@ -538,7 +538,7 @@ int expireIfNeeded(redisDb *db, robj *key) {
...
@@ -538,7 +538,7 @@ int expireIfNeeded(redisDb *db, robj *key) {
* for *AT variants of the command, or the current time for relative expires).
* for *AT variants of the command, or the current time for relative expires).
*
*
* unit is either UNIT_SECONDS or UNIT_MILLISECONDS, and is only used for
* unit is either UNIT_SECONDS or UNIT_MILLISECONDS, and is only used for
* the argv[2] parameter. The basetime is always specified in milli
e
sconds. */
* the argv[2] parameter. The basetime is always specified in millis
e
conds. */
void
expireGenericCommand
(
redisClient
*
c
,
long
long
basetime
,
int
unit
)
{
void
expireGenericCommand
(
redisClient
*
c
,
long
long
basetime
,
int
unit
)
{
dictEntry
*
de
;
dictEntry
*
de
;
robj
*
key
=
c
->
argv
[
1
],
*
param
=
c
->
argv
[
2
];
robj
*
key
=
c
->
argv
[
1
],
*
param
=
c
->
argv
[
2
];
...
...
src/debug.c
View file @
560e0499
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
/* ================================= Debugging ============================== */
/* ================================= Debugging ============================== */
/* Compute the sha1 of string at 's' with 'len' bytes long.
/* Compute the sha1 of string at 's' with 'len' bytes long.
* The SHA1 is then xored againt the string pointed by digest.
* The SHA1 is then xored again
s
t the string pointed by digest.
* Since xor is commutative, this operation is used in order to
* Since xor is commutative, this operation is used in order to
* "add" digests relative to unordered elements.
* "add" digests relative to unordered elements.
*
*
...
@@ -67,7 +67,7 @@ void xorObjectDigest(unsigned char *digest, robj *o) {
...
@@ -67,7 +67,7 @@ void xorObjectDigest(unsigned char *digest, robj *o) {
}
}
/* This function instead of just computing the SHA1 and xoring it
/* This function instead of just computing the SHA1 and xoring it
* against diget, also perform the digest of "digest" itself and
* against dige
s
t, also perform the digest of "digest" itself and
* replace the old value with the new one.
* replace the old value with the new one.
*
*
* So the final digest will be:
* So the final digest will be:
...
...
src/dict.c
View file @
560e0499
...
@@ -610,7 +610,7 @@ static int _dictExpandIfNeeded(dict *d)
...
@@ -610,7 +610,7 @@ static int _dictExpandIfNeeded(dict *d)
/* Incremental rehashing already in progress. Return. */
/* Incremental rehashing already in progress. Return. */
if
(
dictIsRehashing
(
d
))
return
DICT_OK
;
if
(
dictIsRehashing
(
d
))
return
DICT_OK
;
/* If the hash table is empty expand it to the intial size. */
/* If the hash table is empty expand it to the in
i
tial size. */
if
(
d
->
ht
[
0
].
size
==
0
)
return
dictExpand
(
d
,
DICT_HT_INITIAL_SIZE
);
if
(
d
->
ht
[
0
].
size
==
0
)
return
dictExpand
(
d
,
DICT_HT_INITIAL_SIZE
);
/* If we reached the 1:1 ratio, and we are allowed to resize the hash
/* If we reached the 1:1 ratio, and we are allowed to resize the hash
...
...
src/lzfP.h
View file @
560e0499
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
/*
/*
* Avoid assigning values to errno variable? for some embedding purposes
* Avoid assigning values to errno variable? for some embedding purposes
* (linux kernel for example), this is nec
c
essary. NOTE: this breaks
* (linux kernel for example), this is necessary. NOTE: this breaks
* the documentation in lzf.h.
* the documentation in lzf.h.
*/
*/
#ifndef AVOID_ERRNO
#ifndef AVOID_ERRNO
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
#endif
#endif
/*
/*
* Wether to pass the LZF_STATE variable as argument, or allocate it
* W
h
ether to pass the LZF_STATE variable as argument, or allocate it
* on the stack. For small-stack environments, define this to 1.
* on the stack. For small-stack environments, define this to 1.
* NOTE: this breaks the prototype in lzf.h.
* NOTE: this breaks the prototype in lzf.h.
*/
*/
...
@@ -110,11 +110,11 @@
...
@@ -110,11 +110,11 @@
#endif
#endif
/*
/*
* Wether to add extra checks for input validity in lzf_decompress
* W
h
ether to add extra checks for input validity in lzf_decompress
* and return EINVAL if the input stream has been corrupted. This
* and return EINVAL if the input stream has been corrupted. This
* only shields against overflowing the input buffer and will not
* only shields against overflowing the input buffer and will not
* detect most corrupted streams.
* detect most corrupted streams.
* This check is not normally noticable on modern hardware
* This check is not normally notic
e
able on modern hardware
* (<1% slowdown), but might slow down older cpus considerably.
* (<1% slowdown), but might slow down older cpus considerably.
*/
*/
#ifndef CHECK_INPUT
#ifndef CHECK_INPUT
...
...
src/mkreleasehdr.sh
View file @
560e0499
...
@@ -3,7 +3,7 @@ GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n
...
@@ -3,7 +3,7 @@ GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n
GIT_DIRTY
=
`
git diff 2> /dev/null |
wc
-l
`
GIT_DIRTY
=
`
git diff 2> /dev/null |
wc
-l
`
test
-f
release.h
||
touch
release.h
test
-f
release.h
||
touch
release.h
(
cat
release.h |
grep
SHA1 |
grep
$GIT_SHA1
)
&&
\
(
cat
release.h |
grep
SHA1 |
grep
$GIT_SHA1
)
&&
\
(
cat
release.h |
grep
DIRTY |
grep
$GIT_DIRTY
)
&&
exit
0
# Already uptodate
(
cat
release.h |
grep
DIRTY |
grep
$GIT_DIRTY
)
&&
exit
0
# Already up
-
to
-
date
echo
"#define REDIS_GIT_SHA1
\"
$GIT_SHA1
\"
"
>
release.h
echo
"#define REDIS_GIT_SHA1
\"
$GIT_SHA1
\"
"
>
release.h
echo
"#define REDIS_GIT_DIRTY
\"
$GIT_DIRTY
\"
"
>>
release.h
echo
"#define REDIS_GIT_DIRTY
\"
$GIT_DIRTY
\"
"
>>
release.h
touch
release.c
# Force recompile of release.c
touch
release.c
# Force recompile of release.c
src/multi.c
View file @
560e0499
...
@@ -102,7 +102,7 @@ void discardCommand(redisClient *c) {
...
@@ -102,7 +102,7 @@ void discardCommand(redisClient *c) {
}
}
/* Send a MULTI command to all the slaves and AOF file. Check the execCommand
/* Send a MULTI command to all the slaves and AOF file. Check the execCommand
* impleme
m
ntation for more information. */
* implementation for more information. */
void
execCommandReplicateMulti
(
redisClient
*
c
)
{
void
execCommandReplicateMulti
(
redisClient
*
c
)
{
robj
*
multistring
=
createStringObject
(
"MULTI"
,
5
);
robj
*
multistring
=
createStringObject
(
"MULTI"
,
5
);
...
@@ -223,7 +223,7 @@ void watchForKey(redisClient *c, robj *key) {
...
@@ -223,7 +223,7 @@ void watchForKey(redisClient *c, robj *key) {
incrRefCount
(
key
);
incrRefCount
(
key
);
}
}
listAddNodeTail
(
clients
,
c
);
listAddNodeTail
(
clients
,
c
);
/* Add the new key to the li
t
s of keys watched by this client */
/* Add the new key to the lis
t
of keys watched by this client */
wk
=
zmalloc
(
sizeof
(
*
wk
));
wk
=
zmalloc
(
sizeof
(
*
wk
));
wk
->
key
=
key
;
wk
->
key
=
key
;
wk
->
db
=
c
->
db
;
wk
->
db
=
c
->
db
;
...
...
src/networking.c
View file @
560e0499
...
@@ -378,7 +378,7 @@ void *addDeferredMultiBulkLength(redisClient *c) {
...
@@ -378,7 +378,7 @@ void *addDeferredMultiBulkLength(redisClient *c) {
return
listLast
(
c
->
reply
);
return
listLast
(
c
->
reply
);
}
}
/* Populate the length object and try glu
e
ing it to the next chunk. */
/* Populate the length object and try gluing it to the next chunk. */
void
setDeferredMultiBulkLength
(
redisClient
*
c
,
void
*
node
,
long
length
)
{
void
setDeferredMultiBulkLength
(
redisClient
*
c
,
void
*
node
,
long
length
)
{
listNode
*
ln
=
(
listNode
*
)
node
;
listNode
*
ln
=
(
listNode
*
)
node
;
robj
*
len
,
*
next
;
robj
*
len
,
*
next
;
...
@@ -404,7 +404,7 @@ void setDeferredMultiBulkLength(redisClient *c, void *node, long length) {
...
@@ -404,7 +404,7 @@ void setDeferredMultiBulkLength(redisClient *c, void *node, long length) {
asyncCloseClientOnOutputBufferLimitReached
(
c
);
asyncCloseClientOnOutputBufferLimitReached
(
c
);
}
}
/* Add a duble as a bulk reply */
/* Add a d
o
uble as a bulk reply */
void
addReplyDouble
(
redisClient
*
c
,
double
d
)
{
void
addReplyDouble
(
redisClient
*
c
,
double
d
)
{
char
dbuf
[
128
],
sbuf
[
128
];
char
dbuf
[
128
],
sbuf
[
128
];
int
dlen
,
slen
;
int
dlen
,
slen
;
...
@@ -526,7 +526,7 @@ static void acceptCommonHandler(int fd, int flags) {
...
@@ -526,7 +526,7 @@ static void acceptCommonHandler(int fd, int flags) {
}
}
/* If maxclient directive is set and this is one client more... close the
/* If maxclient directive is set and this is one client more... close the
* connection. Note that we create the client instead to check before
* connection. Note that we create the client instead to check before
* for this condition, since now the socket is already set in nonblocking
* for this condition, since now the socket is already set in non
-
blocking
* mode and we can send an error for free using the Kernel I/O */
* mode and we can send an error for free using the Kernel I/O */
if
(
listLength
(
server
.
clients
)
>
server
.
maxclients
)
{
if
(
listLength
(
server
.
clients
)
>
server
.
maxclients
)
{
char
*
err
=
"-ERR max number of clients reached
\r\n
"
;
char
*
err
=
"-ERR max number of clients reached
\r\n
"
;
...
@@ -941,7 +941,7 @@ int processMultibulkBuffer(redisClient *c) {
...
@@ -941,7 +941,7 @@ int processMultibulkBuffer(redisClient *c) {
/* Not enough data (+2 == trailing \r\n) */
/* Not enough data (+2 == trailing \r\n) */
break
;
break
;
}
else
{
}
else
{
/* Optimization: if the buffer conta
n
ins JUST our bulk element
/* Optimization: if the buffer contai
n
ns JUST our bulk element
* instead of creating a new object by *copying* the sds we
* instead of creating a new object by *copying* the sds we
* just use the current sds string. */
* just use the current sds string. */
if
(
pos
==
0
&&
if
(
pos
==
0
&&
...
...
src/object.c
View file @
560e0499
...
@@ -72,7 +72,7 @@ robj *createStringObjectFromLongDouble(long double value) {
...
@@ -72,7 +72,7 @@ robj *createStringObjectFromLongDouble(long double value) {
int
len
;
int
len
;
/* We use 17 digits precision since with 128 bit floats that precision
/* We use 17 digits precision since with 128 bit floats that precision
* after rouding is able to represent most small decimal numbers in a way
* after rou
n
ding is able to represent most small decimal numbers in a way
* that is "non surprising" for the user (that is, most small decimal
* that is "non surprising" for the user (that is, most small decimal
* numbers will be represented in a way that when converted back into
* numbers will be represented in a way that when converted back into
* a string are exactly the same as what the user typed.) */
* a string are exactly the same as what the user typed.) */
...
...
src/pubsub.c
View file @
560e0499
...
@@ -117,7 +117,7 @@ int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) {
...
@@ -117,7 +117,7 @@ int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) {
return
retval
;
return
retval
;
}
}
/* Subscribe a client to a pattern. Returns 1 if the operation succeeded, or 0 if the cli
n
et was already subscribed to that pattern. */
/* Subscribe a client to a pattern. Returns 1 if the operation succeeded, or 0 if the clie
n
t was already subscribed to that pattern. */
int
pubsubSubscribePattern
(
redisClient
*
c
,
robj
*
pattern
)
{
int
pubsubSubscribePattern
(
redisClient
*
c
,
robj
*
pattern
)
{
int
retval
=
0
;
int
retval
=
0
;
...
...
src/rdb.c
View file @
560e0499
...
@@ -265,7 +265,7 @@ err:
...
@@ -265,7 +265,7 @@ err:
return
NULL
;
return
NULL
;
}
}
/* Save a string objet as [len][data] on disk. If the object is a string
/* Save a string obje
c
t as [len][data] on disk. If the object is a string
* representation of an integer value we try to save it in a special form */
* representation of an integer value we try to save it in a special form */
int
rdbSaveRawString
(
rio
*
rdb
,
unsigned
char
*
s
,
size_t
len
)
{
int
rdbSaveRawString
(
rio
*
rdb
,
unsigned
char
*
s
,
size_t
len
)
{
int
enclen
;
int
enclen
;
...
@@ -321,7 +321,7 @@ int rdbSaveLongLongAsStringObject(rio *rdb, long long value) {
...
@@ -321,7 +321,7 @@ int rdbSaveLongLongAsStringObject(rio *rdb, long long value) {
/* Like rdbSaveStringObjectRaw() but handle encoded objects */
/* Like rdbSaveStringObjectRaw() but handle encoded objects */
int
rdbSaveStringObject
(
rio
*
rdb
,
robj
*
obj
)
{
int
rdbSaveStringObject
(
rio
*
rdb
,
robj
*
obj
)
{
/* Avoid to decode the object, then encode it again, if the
/* Avoid to decode the object, then encode it again, if the
* object is alrady integer encoded. */
* object is alr
e
ady integer encoded. */
if
(
obj
->
encoding
==
REDIS_ENCODING_INT
)
{
if
(
obj
->
encoding
==
REDIS_ENCODING_INT
)
{
return
rdbSaveLongLongAsStringObject
(
rdb
,(
long
)
obj
->
ptr
);
return
rdbSaveLongLongAsStringObject
(
rdb
,(
long
)
obj
->
ptr
);
}
else
{
}
else
{
...
@@ -367,7 +367,7 @@ robj *rdbLoadEncodedStringObject(rio *rdb) {
...
@@ -367,7 +367,7 @@ robj *rdbLoadEncodedStringObject(rio *rdb) {
}
}
/* Save a double value. Doubles are saved as strings prefixed by an unsigned
/* Save a double value. Doubles are saved as strings prefixed by an unsigned
* 8 bit integer specifing the length of the representation.
* 8 bit integer specif
y
ing the length of the representation.
* This 8 bit integer has special values in order to specify the following
* This 8 bit integer has special values in order to specify the following
* conditions:
* conditions:
* 253: not a number
* 253: not a number
...
@@ -606,7 +606,7 @@ off_t rdbSavedObjectLen(robj *o) {
...
@@ -606,7 +606,7 @@ off_t rdbSavedObjectLen(robj *o) {
/* Save a key-value pair, with expire time, type, key, value.
/* Save a key-value pair, with expire time, type, key, value.
* On error -1 is returned.
* On error -1 is returned.
* On success if the key was act
a
ully saved 1 is returned, otherwise 0
* On success if the key was actu
a
lly saved 1 is returned, otherwise 0
* is returned (the key was already expired). */
* is returned (the key was already expired). */
int
rdbSaveKeyValuePair
(
rio
*
rdb
,
robj
*
key
,
robj
*
val
,
int
rdbSaveKeyValuePair
(
rio
*
rdb
,
robj
*
key
,
robj
*
val
,
long
long
expiretime
,
long
long
now
)
long
long
expiretime
,
long
long
now
)
...
@@ -1109,7 +1109,7 @@ int rdbLoad(char *filename) {
...
@@ -1109,7 +1109,7 @@ int rdbLoad(char *filename) {
/* We read the time so we need to read the object type again. */
/* We read the time so we need to read the object type again. */
if
((
type
=
rdbLoadType
(
&
rdb
))
==
-
1
)
goto
eoferr
;
if
((
type
=
rdbLoadType
(
&
rdb
))
==
-
1
)
goto
eoferr
;
/* the EXPIRETIME opcode specifies time in seconds, so convert
/* the EXPIRETIME opcode specifies time in seconds, so convert
* into milli
e
sconds. */
* into millis
e
conds. */
expiretime
*=
1000
;
expiretime
*=
1000
;
}
else
if
(
type
==
REDIS_RDB_OPCODE_EXPIRETIME_MS
)
{
}
else
if
(
type
==
REDIS_RDB_OPCODE_EXPIRETIME_MS
)
{
/* Milliseconds precision expire times introduced with RDB
/* Milliseconds precision expire times introduced with RDB
...
...
Prev
1
2
Next
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