No more trailing spaces in Redis source code.

This commit is contained in:
antirez 2014-06-26 18:48:40 +02:00
parent 9b8711e7af
commit 1c94889182
28 changed files with 78 additions and 78 deletions

View File

@ -178,7 +178,7 @@ void listDelNode(list *list, listNode *node)
listIter *listGetIterator(list *list, int direction) listIter *listGetIterator(list *list, int direction)
{ {
listIter *iter; listIter *iter;
if ((iter = zmalloc(sizeof(*iter))) == NULL) return NULL; if ((iter = zmalloc(sizeof(*iter))) == NULL) return NULL;
if (direction == AL_START_HEAD) if (direction == AL_START_HEAD)
iter->next = list->head; iter->next = list->head;

View File

@ -54,7 +54,7 @@ static int aeApiCreate(aeEventLoop *eventLoop) {
return -1; return -1;
} }
eventLoop->apidata = state; eventLoop->apidata = state;
return 0; return 0;
} }
static int aeApiResize(aeEventLoop *eventLoop, int setsize) { static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
@ -75,7 +75,7 @@ static void aeApiFree(aeEventLoop *eventLoop) {
static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) { static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
aeApiState *state = eventLoop->apidata; aeApiState *state = eventLoop->apidata;
struct kevent ke; struct kevent ke;
if (mask & AE_READABLE) { if (mask & AE_READABLE) {
EV_SET(&ke, fd, EVFILT_READ, EV_ADD, 0, 0, NULL); EV_SET(&ke, fd, EVFILT_READ, EV_ADD, 0, 0, NULL);
if (kevent(state->kqfd, &ke, 1, NULL, 0, NULL) == -1) return -1; if (kevent(state->kqfd, &ke, 1, NULL, 0, NULL) == -1) return -1;
@ -118,16 +118,16 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
if (retval > 0) { if (retval > 0) {
int j; int j;
numevents = retval; numevents = retval;
for(j = 0; j < numevents; j++) { for(j = 0; j < numevents; j++) {
int mask = 0; int mask = 0;
struct kevent *e = state->events+j; struct kevent *e = state->events+j;
if (e->filter == EVFILT_READ) mask |= AE_READABLE; if (e->filter == EVFILT_READ) mask |= AE_READABLE;
if (e->filter == EVFILT_WRITE) mask |= AE_WRITABLE; if (e->filter == EVFILT_WRITE) mask |= AE_WRITABLE;
eventLoop->fired[j].fd = e->ident; eventLoop->fired[j].fd = e->ident;
eventLoop->fired[j].mask = mask; eventLoop->fired[j].mask = mask;
} }
} }
return numevents; return numevents;

View File

@ -137,7 +137,7 @@ int anetEnableTcpNoDelay(char *err, int fd)
return anetSetTcpNoDelay(err, fd, 1); return anetSetTcpNoDelay(err, fd, 1);
} }
int anetDisableTcpNoDelay(char *err, int fd) int anetDisableTcpNoDelay(char *err, int fd)
{ {
return anetSetTcpNoDelay(err, fd, 0); return anetSetTcpNoDelay(err, fd, 0);
} }

View File

@ -3598,7 +3598,7 @@ void clusterCommand(redisClient *c) {
if (slots[j]) { if (slots[j]) {
int retval; int retval;
/* If this slot was set as importing we can clear this /* If this slot was set as importing we can clear this
* state as now we are the real owner of the slot. */ * state as now we are the real owner of the slot. */
if (server.cluster->importing_slots_from[j]) if (server.cluster->importing_slots_from[j])
server.cluster->importing_slots_from[j] = NULL; server.cluster->importing_slots_from[j] = NULL;

View File

@ -1310,7 +1310,7 @@ struct rewriteConfigState *rewriteConfigReadOldFile(char *path) {
* "force" is non-zero, the line is appended to the configuration file. * "force" is non-zero, the line is appended to the configuration file.
* Usually "force" is true when an option has not its default value, so it * Usually "force" is true when an option has not its default value, so it
* must be rewritten even if not present previously. * must be rewritten even if not present previously.
* *
* The first time a line is appended into a configuration file, a comment * The first time a line is appended into a configuration file, a comment
* is added to show that starting from that point the config file was generated * is added to show that starting from that point the config file was generated
* by CONFIG REWRITE. * by CONFIG REWRITE.
@ -1436,7 +1436,7 @@ void rewriteConfigEnumOption(struct rewriteConfigState *state, char *option, int
char *enum_name, *matching_name = NULL; char *enum_name, *matching_name = NULL;
int enum_val, def_val, force; int enum_val, def_val, force;
sds line; sds line;
va_start(ap, value); va_start(ap, value);
while(1) { while(1) {
enum_name = va_arg(ap,char*); enum_name = va_arg(ap,char*);
@ -1448,7 +1448,7 @@ void rewriteConfigEnumOption(struct rewriteConfigState *state, char *option, int
if (value == enum_val) matching_name = enum_name; if (value == enum_val) matching_name = enum_name;
} }
va_end(ap); va_end(ap);
force = value != def_val; force = value != def_val;
line = sdscatprintf(sdsempty(),"%s %s",option,matching_name); line = sdscatprintf(sdsempty(),"%s %s",option,matching_name);
rewriteConfigRewriteLine(state,option,line,force); rewriteConfigRewriteLine(state,option,line,force);

View File

@ -1,6 +1,6 @@
#include "redis.h" #include "redis.h"
/* /*
* Copyright 2001-2010 Georges Menie (www.menie.org) * Copyright 2001-2010 Georges Menie (www.menie.org)
* Copyright 2010-2012 Salvatore Sanfilippo (adapted to Redis coding style) * Copyright 2010-2012 Salvatore Sanfilippo (adapted to Redis coding style)
* All rights reserved. * All rights reserved.
@ -78,7 +78,7 @@ static const uint16_t crc16tab[256]= {
0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8, 0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,
0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0 0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0
}; };
uint16_t crc16(const char *buf, int len) { uint16_t crc16(const char *buf, int len) {
int counter; int counter;
uint16_t crc = 0; uint16_t crc = 0;

View File

@ -106,7 +106,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) {
* The program is aborted if the key was not already present. */ * The program is aborted if the key was not already present. */
void dbOverwrite(redisDb *db, robj *key, robj *val) { void dbOverwrite(redisDb *db, robj *key, robj *val) {
dictEntry *de = dictFind(db->dict,key->ptr); dictEntry *de = dictFind(db->dict,key->ptr);
redisAssertWithInfo(NULL,key,de != NULL); redisAssertWithInfo(NULL,key,de != NULL);
dictReplace(db->dict, key->ptr, val); dictReplace(db->dict, key->ptr, val);
} }
@ -831,7 +831,7 @@ int expireIfNeeded(redisDb *db, robj *key) {
* the slave key expiration is controlled by the master that will * the slave key expiration is controlled by the master that will
* send us synthesized DEL operations for expired keys. * send us synthesized DEL operations for expired keys.
* *
* Still we try to return the right information to the caller, * Still we try to return the right information to the caller,
* that is, 0 if we think the key should be still valid, 1 if * that is, 0 if we think the key should be still valid, 1 if
* we think the key is expired at this time. */ * we think the key is expired at this time. */
if (server.masterhost != NULL) return now > when; if (server.masterhost != NULL) return now > when;

View File

@ -28,7 +28,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef __ENDIANCONV_H #ifndef __ENDIANCONV_H
#define __ENDIANCONV_H #define __ENDIANCONV_H

View File

@ -1,16 +1,16 @@
/* /*
* Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de> * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met: * tion, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@ -73,7 +73,7 @@
* and lzf_c.c. * and lzf_c.c.
* *
*/ */
unsigned int unsigned int
lzf_compress (const void *const in_data, unsigned int in_len, lzf_compress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len); void *out_data, unsigned int out_len);
@ -92,7 +92,7 @@ lzf_compress (const void *const in_data, unsigned int in_len,
* *
* This function is very fast, about as fast as a copying loop. * This function is very fast, about as fast as a copying loop.
*/ */
unsigned int unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len, lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len); void *out_data, unsigned int out_len);

View File

@ -1,16 +1,16 @@
/* /*
* Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de> * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met: * tion, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO

View File

@ -1,16 +1,16 @@
/* /*
* Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de> * Copyright (c) 2000-2008 Marc Alexander Lehmann <schmorp@schmorp.de>
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met: * tion, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO

View File

@ -1,16 +1,16 @@
/* /*
* Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de> * Copyright (c) 2000-2007 Marc Alexander Lehmann <schmorp@schmorp.de>
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met: * tion, are permitted provided that the following conditions are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@ -52,7 +52,7 @@
#endif #endif
*/ */
unsigned int unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len, lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len) void *out_data, unsigned int out_len)
{ {

View File

@ -214,7 +214,7 @@ void watchForKey(redisClient *c, robj *key) {
} }
/* This key is not already watched in this DB. Let's add it */ /* This key is not already watched in this DB. Let's add it */
clients = dictFetchValue(c->db->watched_keys,key); clients = dictFetchValue(c->db->watched_keys,key);
if (!clients) { if (!clients) {
clients = listCreate(); clients = listCreate();
dictAdd(c->db->watched_keys,key,clients); dictAdd(c->db->watched_keys,key,clients);
incrRefCount(key); incrRefCount(key);

View File

@ -1495,7 +1495,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...) {
va_start(ap,argc); va_start(ap,argc);
for (j = 0; j < argc; j++) { for (j = 0; j < argc; j++) {
robj *a; robj *a;
a = va_arg(ap, robj*); a = va_arg(ap, robj*);
argv[j] = a; argv[j] = a;
incrRefCount(a); incrRefCount(a);
@ -1517,7 +1517,7 @@ void rewriteClientCommandVector(redisClient *c, int argc, ...) {
* The new val ref count is incremented, and the old decremented. */ * The new val ref count is incremented, and the old decremented. */
void rewriteClientCommandArgument(redisClient *c, int i, robj *newval) { void rewriteClientCommandArgument(redisClient *c, int i, robj *newval) {
robj *oldval; robj *oldval;
redisAssertWithInfo(c,NULL,i < c->argc); redisAssertWithInfo(c,NULL,i < c->argc);
oldval = c->argv[i]; oldval = c->argv[i];
c->argv[i] = newval; c->argv[i] = newval;

View File

@ -69,7 +69,7 @@ static inline void
swapfunc(char *a, char *b, size_t n, int swaptype) swapfunc(char *a, char *b, size_t n, int swaptype)
{ {
if (swaptype <= 1) if (swaptype <= 1)
swapcode(long, a, b, n) swapcode(long, a, b, n)
else else
swapcode(char, a, b, n) swapcode(char, a, b, n)
@ -160,9 +160,9 @@ loop: SWAPINIT(a, es);
(lrange > _r && rrange > _r))) (lrange > _r && rrange > _r)))
_pqsort(a, r / es, es, cmp, lrange, rrange); _pqsort(a, r / es, es, cmp, lrange, rrange);
} }
if ((r = pd - pc) > es) { if ((r = pd - pc) > es) {
void *_l, *_r; void *_l, *_r;
/* Iterate rather than recurse to save stack space */ /* Iterate rather than recurse to save stack space */
a = pn - r; a = pn - r;
n = r / es; n = r / es;

View File

@ -671,7 +671,7 @@ int rdbSave(char *filename) {
sds keystr = dictGetKey(de); sds keystr = dictGetKey(de);
robj key, *o = dictGetVal(de); robj key, *o = dictGetVal(de);
long long expire; long long expire;
initStaticStringObject(key,keystr); initStaticStringObject(key,keystr);
expire = getExpire(db,&key); expire = getExpire(db,&key);
if (rdbSaveKeyValuePair(&rdb,&key,o,expire,now) == -1) goto werr; if (rdbSaveKeyValuePair(&rdb,&key,o,expire,now) == -1) goto werr;

View File

@ -143,7 +143,7 @@ static char types[256][16];
/* Return true if 't' is a valid object type. */ /* Return true if 't' is a valid object type. */
int checkType(unsigned char t) { int checkType(unsigned char t) {
/* In case a new object type is added, update the following /* In case a new object type is added, update the following
* condition as necessary. */ * condition as necessary. */
return return
(t >= REDIS_HASH_ZIPMAP && t <= REDIS_HASH_ZIPLIST) || (t >= REDIS_HASH_ZIPMAP && t <= REDIS_HASH_ZIPLIST) ||
@ -514,7 +514,7 @@ entry loadEntry() {
return e; return e;
} else { } else {
/* optionally consume expire */ /* optionally consume expire */
if (e.type == REDIS_EXPIRETIME || if (e.type == REDIS_EXPIRETIME ||
e.type == REDIS_EXPIRETIME_MS) { e.type == REDIS_EXPIRETIME_MS) {
if (!processTime(e.type)) return e; if (!processTime(e.type)) return e;
if (!loadType(&e)) return e; if (!loadType(&e)) return e;

View File

@ -1150,7 +1150,7 @@ static void getRDB(void) {
while(payload) { while(payload) {
ssize_t nread, nwritten; ssize_t nread, nwritten;
nread = read(s,buf,(payload > sizeof(buf)) ? sizeof(buf) : payload); nread = read(s,buf,(payload > sizeof(buf)) ? sizeof(buf) : payload);
if (nread <= 0) { if (nread <= 0) {
fprintf(stderr,"I/O Error reading RDB payload from socket\n"); fprintf(stderr,"I/O Error reading RDB payload from socket\n");
@ -1233,7 +1233,7 @@ static void pipeMode(void) {
errors++; errors++;
} else if (eof && reply->type == REDIS_REPLY_STRING && } else if (eof && reply->type == REDIS_REPLY_STRING &&
reply->len == 20) { reply->len == 20) {
/* Check if this is the reply to our final ECHO /* Check if this is the reply to our final ECHO
* command. If so everything was received * command. If so everything was received
* from the server. */ * from the server. */
if (memcmp(reply->str,magic,20) == 0) { if (memcmp(reply->str,magic,20) == 0) {
@ -1254,7 +1254,7 @@ static void pipeMode(void) {
/* Transfer current buffer to server. */ /* Transfer current buffer to server. */
if (obuf_len != 0) { if (obuf_len != 0) {
ssize_t nwritten = write(fd,obuf+obuf_pos,obuf_len); ssize_t nwritten = write(fd,obuf+obuf_pos,obuf_len);
if (nwritten == -1) { if (nwritten == -1) {
if (errno != EAGAIN && errno != EINTR) { if (errno != EAGAIN && errno != EINTR) {
fprintf(stderr, "Error writing to the server: %s\n", fprintf(stderr, "Error writing to the server: %s\n",
@ -1357,7 +1357,7 @@ static redisReply *sendScan(unsigned long long *it) {
/* Validate our types are correct */ /* Validate our types are correct */
assert(reply->element[0]->type == REDIS_REPLY_STRING); assert(reply->element[0]->type == REDIS_REPLY_STRING);
assert(reply->element[1]->type == REDIS_REPLY_ARRAY); assert(reply->element[1]->type == REDIS_REPLY_ARRAY);
/* Update iterator */ /* Update iterator */
*it = atoi(reply->element[0]->str); *it = atoi(reply->element[0]->str);
@ -1369,7 +1369,7 @@ static int getDbSize(void) {
int size; int size;
reply = redisCommand(context, "DBSIZE"); reply = redisCommand(context, "DBSIZE");
if(reply == NULL || reply->type != REDIS_REPLY_INTEGER) { if(reply == NULL || reply->type != REDIS_REPLY_INTEGER) {
fprintf(stderr, "Couldn't determine DBSIZE!\n"); fprintf(stderr, "Couldn't determine DBSIZE!\n");
exit(1); exit(1);
@ -1422,13 +1422,13 @@ static void getKeyTypes(redisReply *keys, int *types) {
exit(1); exit(1);
} }
types[i] = toIntType(keys->element[i]->str, reply->str); types[i] = toIntType(keys->element[i]->str, reply->str);
freeReplyObject(reply); freeReplyObject(reply);
} }
} }
static void getKeySizes(redisReply *keys, int *types, static void getKeySizes(redisReply *keys, int *types,
unsigned long long *sizes) unsigned long long *sizes)
{ {
redisReply *reply; redisReply *reply;
char *sizecmds[] = {"STRLEN","LLEN","SCARD","HLEN","ZCARD"}; char *sizecmds[] = {"STRLEN","LLEN","SCARD","HLEN","ZCARD"};
@ -1437,10 +1437,10 @@ static void getKeySizes(redisReply *keys, int *types,
/* Pipeline size commands */ /* Pipeline size commands */
for(i=0;i<keys->elements;i++) { for(i=0;i<keys->elements;i++) {
/* Skip keys that were deleted */ /* Skip keys that were deleted */
if(types[i]==TYPE_NONE) if(types[i]==TYPE_NONE)
continue; continue;
redisAppendCommand(context, "%s %s", sizecmds[types[i]], redisAppendCommand(context, "%s %s", sizecmds[types[i]],
keys->element[i]->str); keys->element[i]->str);
} }
@ -1460,14 +1460,14 @@ static void getKeySizes(redisReply *keys, int *types,
} else if(reply->type != REDIS_REPLY_INTEGER) { } else if(reply->type != REDIS_REPLY_INTEGER) {
/* Theoretically the key could have been removed and /* Theoretically the key could have been removed and
* added as a different type between TYPE and SIZE */ * added as a different type between TYPE and SIZE */
fprintf(stderr, fprintf(stderr,
"Warning: %s on '%s' failed (may have changed type)\n", "Warning: %s on '%s' failed (may have changed type)\n",
sizecmds[types[i]], keys->element[i]->str); sizecmds[types[i]], keys->element[i]->str);
sizes[i] = 0; sizes[i] = 0;
} else { } else {
sizes[i] = reply->integer; sizes[i] = reply->integer;
} }
freeReplyObject(reply); freeReplyObject(reply);
} }
} }
@ -1524,12 +1524,12 @@ static void findBigKeys(void) {
/* Retreive types and then sizes */ /* Retreive types and then sizes */
getKeyTypes(keys, types); getKeyTypes(keys, types);
getKeySizes(keys, types, sizes); getKeySizes(keys, types, sizes);
/* Now update our stats */ /* Now update our stats */
for(i=0;i<keys->elements;i++) { for(i=0;i<keys->elements;i++) {
if((type = types[i]) == TYPE_NONE) if((type = types[i]) == TYPE_NONE)
continue; continue;
totalsize[type] += sizes[i]; totalsize[type] += sizes[i];
counts[type]++; counts[type]++;
totlen += keys->element[i]->len; totlen += keys->element[i]->len;
@ -1549,7 +1549,7 @@ static void findBigKeys(void) {
} }
/* Keep track of the biggest size for this type */ /* Keep track of the biggest size for this type */
biggest[type] = sizes[i]; biggest[type] = sizes[i];
} }
/* Update overall progress */ /* Update overall progress */
@ -1562,7 +1562,7 @@ static void findBigKeys(void) {
if(sampled && (sampled %100) == 0 && config.interval) { if(sampled && (sampled %100) == 0 && config.interval) {
usleep(config.interval); usleep(config.interval);
} }
freeReplyObject(reply); freeReplyObject(reply);
} while(it != 0); } while(it != 0);

View File

@ -356,7 +356,7 @@ void redisLogFromHandler(int level, const char *msg) {
if ((level&0xff) < server.verbosity || (log_to_stdout && server.daemonize)) if ((level&0xff) < server.verbosity || (log_to_stdout && server.daemonize))
return; return;
fd = log_to_stdout ? STDOUT_FILENO : fd = log_to_stdout ? STDOUT_FILENO :
open(server.logfile, O_APPEND|O_CREAT|O_WRONLY, 0644); open(server.logfile, O_APPEND|O_CREAT|O_WRONLY, 0644);
if (fd == -1) return; if (fd == -1) return;
ll2string(buf,sizeof(buf),getpid()); ll2string(buf,sizeof(buf),getpid());
@ -1140,7 +1140,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
if ((pid = wait3(&statloc,WNOHANG,NULL)) != 0) { if ((pid = wait3(&statloc,WNOHANG,NULL)) != 0) {
int exitcode = WEXITSTATUS(statloc); int exitcode = WEXITSTATUS(statloc);
int bysignal = 0; int bysignal = 0;
if (WIFSIGNALED(statloc)) bysignal = WTERMSIG(statloc); if (WIFSIGNALED(statloc)) bysignal = WTERMSIG(statloc);
if (pid == server.rdb_child_pid) { if (pid == server.rdb_child_pid) {
@ -1506,7 +1506,7 @@ void initServerConfig() {
server.lpushCommand = lookupCommandByCString("lpush"); server.lpushCommand = lookupCommandByCString("lpush");
server.lpopCommand = lookupCommandByCString("lpop"); server.lpopCommand = lookupCommandByCString("lpop");
server.rpopCommand = lookupCommandByCString("rpop"); server.rpopCommand = lookupCommandByCString("rpop");
/* Slow log */ /* Slow log */
server.slowlog_log_slower_than = REDIS_SLOWLOG_LOG_SLOWER_THAN; server.slowlog_log_slower_than = REDIS_SLOWLOG_LOG_SLOWER_THAN;
server.slowlog_max_len = REDIS_SLOWLOG_MAX_LEN; server.slowlog_max_len = REDIS_SLOWLOG_MAX_LEN;
@ -2452,7 +2452,7 @@ sds genRedisInfoString(char *section) {
if (server.cluster_enabled) mode = "cluster"; if (server.cluster_enabled) mode = "cluster";
else if (server.sentinel_mode) mode = "sentinel"; else if (server.sentinel_mode) mode = "sentinel";
else mode = "standalone"; else mode = "standalone";
if (sections++) info = sdscat(info,"\r\n"); if (sections++) info = sdscat(info,"\r\n");
if (call_uname) { if (call_uname) {

View File

@ -69,7 +69,7 @@
/* Static server configuration */ /* Static server configuration */
#define REDIS_DEFAULT_HZ 10 /* Time interrupt calls/sec. */ #define REDIS_DEFAULT_HZ 10 /* Time interrupt calls/sec. */
#define REDIS_MIN_HZ 1 #define REDIS_MIN_HZ 1
#define REDIS_MAX_HZ 500 #define REDIS_MAX_HZ 500
#define REDIS_SERVERPORT 6379 /* TCP port */ #define REDIS_SERVERPORT 6379 /* TCP port */
#define REDIS_TCP_BACKLOG 511 /* TCP listen backlog */ #define REDIS_TCP_BACKLOG 511 /* TCP listen backlog */
#define REDIS_MAXIDLETIME 0 /* default client timeout: infinite */ #define REDIS_MAXIDLETIME 0 /* default client timeout: infinite */

View File

@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/* Every time the Redis Git SHA1 or Dirty status changes only this small /* Every time the Redis Git SHA1 or Dirty status changes only this small
* file is recompiled, as we access this information in all the other * file is recompiled, as we access this information in all the other
* files using this functions. */ * files using this functions. */

View File

@ -199,7 +199,7 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) {
long objlen = stringObjectLen(argv[j]); long objlen = stringObjectLen(argv[j]);
/* We need to feed the buffer with the object as a bulk reply /* We need to feed the buffer with the object as a bulk reply
* not just as a plain string, so create the $..CRLF payload len * not just as a plain string, so create the $..CRLF payload len
* ad add the final CRLF */ * ad add the final CRLF */
aux[0] = '$'; aux[0] = '$';
len = ll2string(aux+1,sizeof(aux)-1,objlen); len = ll2string(aux+1,sizeof(aux)-1,objlen);
@ -446,7 +446,7 @@ void syncCommand(redisClient *c) {
return; /* No full resync needed, return. */ return; /* No full resync needed, return. */
} else { } else {
char *master_runid = c->argv[1]->ptr; char *master_runid = c->argv[1]->ptr;
/* Increment stats for failed PSYNCs, but only if the /* Increment stats for failed PSYNCs, but only if the
* runid is not "?", as this is used by slaves to force a full * runid is not "?", as this is used by slaves to force a full
* resync on purpose when they are not albe to partially * resync on purpose when they are not albe to partially
@ -1793,7 +1793,7 @@ void replicationCron(void) {
if (server.masterhost && server.master && if (server.masterhost && server.master &&
!(server.master->flags & REDIS_PRE_PSYNC)) !(server.master->flags & REDIS_PRE_PSYNC))
replicationSendAck(); replicationSendAck();
/* If we have attached slaves, PING them from time to time. /* If we have attached slaves, PING them from time to time.
* So slaves can implement an explicit timeout to masters, and will * So slaves can implement an explicit timeout to masters, and will
* be able to detect a link disconnection even if the TCP connection * be able to detect a link disconnection even if the TCP connection

View File

@ -123,7 +123,7 @@ void sdsclear(sds s) {
/* Enlarge the free space at the end of the sds string so that the caller /* Enlarge the free space at the end of the sds string so that the caller
* is sure that after calling this function can overwrite up to addlen * is sure that after calling this function can overwrite up to addlen
* bytes after the end of the string, plus one more byte for nul term. * bytes after the end of the string, plus one more byte for nul term.
* *
* Note: this does not change the *length* of the sds string as returned * Note: this does not change the *length* of the sds string as returned
* by sdslen(), but only the free buffer space we have. */ * by sdslen(), but only the free buffer space we have. */
sds sdsMakeRoomFor(sds s, size_t addlen) { sds sdsMakeRoomFor(sds s, size_t addlen) {

View File

@ -119,7 +119,7 @@ ssize_t syncRead(int fd, char *ptr, ssize_t size, long long timeout) {
/* Read a line making sure that every char will not require more than 'timeout' /* Read a line making sure that every char will not require more than 'timeout'
* milliseconds to be read. * milliseconds to be read.
* *
* On success the number of bytes read is returned, otherwise -1. * On success the number of bytes read is returned, otherwise -1.
* On success the string is always correctly terminated with a 0 byte. */ * On success the string is always correctly terminated with a 0 byte. */
ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout) { ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout) {

View File

@ -1009,7 +1009,7 @@ void handleClientsBlockedOnLists(void) {
} }
} }
} }
if (listTypeLength(o) == 0) dbDelete(rl->db,rl->key); if (listTypeLength(o) == 0) dbDelete(rl->db,rl->key);
/* We don't call signalModifiedKey() as it was already called /* We don't call signalModifiedKey() as it was already called
* when an element was pushed on the list. */ * when an element was pushed on the list. */

View File

@ -512,7 +512,7 @@ void srandmemberWithCountCommand(redisClient *c) {
size--; size--;
} }
} }
/* CASE 4: We have a big set compared to the requested number of elements. /* CASE 4: We have a big set compared to the requested number of elements.
* In this case we can simply get random elements from the set and add * In this case we can simply get random elements from the set and add
* to the temporary set, trying to eventually get enough unique elements * to the temporary set, trying to eventually get enough unique elements

View File

@ -1169,7 +1169,7 @@ void zsetConvert(robj *zobj, int encoding) {
} }
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
* Sorted set commands * Sorted set commands
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
/* This generic command implements both ZADD and ZINCRBY. */ /* This generic command implements both ZADD and ZINCRBY. */

View File

@ -56,7 +56,7 @@
* signal the end of the hash. The special value 254 is used to mark * signal the end of the hash. The special value 254 is used to mark
* empty space that can be used to add new key/value pairs. * empty space that can be used to add new key/value pairs.
* *
* <free> is the number of free unused bytes after the string, resulting * <free> is the number of free unused bytes after the string, resulting
* from modification of values associated to a key. For instance if "foo" * from modification of values associated to a key. For instance if "foo"
* is set to "bar", and later "foo" will be set to "hi", it will have a * is set to "bar", and later "foo" will be set to "hi", it will have a
* free byte to use if the value will enlarge again later, or even in * free byte to use if the value will enlarge again later, or even in
@ -186,7 +186,7 @@ static unsigned int zipmapRawKeyLength(unsigned char *p) {
static unsigned int zipmapRawValueLength(unsigned char *p) { static unsigned int zipmapRawValueLength(unsigned char *p) {
unsigned int l = zipmapDecodeLength(p); unsigned int l = zipmapDecodeLength(p);
unsigned int used; unsigned int used;
used = zipmapEncodeLength(NULL,l); used = zipmapEncodeLength(NULL,l);
used += p[used] + 1 + l; used += p[used] + 1 + l;
return used; return used;
@ -214,7 +214,7 @@ unsigned char *zipmapSet(unsigned char *zm, unsigned char *key, unsigned int kle
unsigned int freelen, reqlen = zipmapRequiredLength(klen,vlen); unsigned int freelen, reqlen = zipmapRequiredLength(klen,vlen);
unsigned int empty, vempty; unsigned int empty, vempty;
unsigned char *p; unsigned char *p;
freelen = reqlen; freelen = reqlen;
if (update) *update = 0; if (update) *update = 0;
p = zipmapLookupRaw(zm,key,klen,&zmlen); p = zipmapLookupRaw(zm,key,klen,&zmlen);