From cb72d0f155cb8faf6aa02f68318ba9b7477447c3 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Sat, 21 Aug 2010 11:25:13 +0200 Subject: [PATCH 1/1] Rename iterator to setTypeIterator for consistency --- src/debug.c | 2 +- src/redis.h | 8 ++++---- src/sort.c | 2 +- src/t_set.c | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/debug.c b/src/debug.c index f58fcbae..76d18b21 100644 --- a/src/debug.c +++ b/src/debug.c @@ -119,7 +119,7 @@ void computeDatasetDigest(unsigned char *final) { } listTypeReleaseIterator(li); } else if (o->type == REDIS_SET) { - setIterator *si = setTypeInitIterator(o); + setTypeIterator *si = setTypeInitIterator(o); robj *ele; while((ele = setTypeNext(si)) != NULL) { xorObjectDigest(digest,ele); diff --git a/src/redis.h b/src/redis.h index 288c9069..0b78320c 100644 --- a/src/redis.h +++ b/src/redis.h @@ -545,7 +545,7 @@ typedef struct { int encoding; int ii; /* intset iterator */ dictIterator *di; -} setIterator; +} setTypeIterator; /* Structure to hold hash iteration abstration. Note that iteration over * hashes involves both fields and values. Because it is possible that @@ -734,9 +734,9 @@ robj *setTypeCreate(robj *value); int setTypeAdd(robj *subject, robj *value); int setTypeRemove(robj *subject, robj *value); int setTypeIsMember(robj *subject, robj *value); -setIterator *setTypeInitIterator(robj *subject); -void setTypeReleaseIterator(setIterator *si); -robj *setTypeNext(setIterator *si); +setTypeIterator *setTypeInitIterator(robj *subject); +void setTypeReleaseIterator(setTypeIterator *si); +robj *setTypeNext(setTypeIterator *si); robj *setTypeRandomElement(robj *subject); unsigned long setTypeSize(robj *subject); void setTypeConvert(robj *subject, int enc); diff --git a/src/sort.c b/src/sort.c index 06696cc5..aa1ce929 100644 --- a/src/sort.c +++ b/src/sort.c @@ -220,7 +220,7 @@ void sortCommand(redisClient *c) { } listTypeReleaseIterator(li); } else if (sortval->type == REDIS_SET) { - setIterator *si = setTypeInitIterator(sortval); + setTypeIterator *si = setTypeInitIterator(sortval); robj *ele; while((ele = setTypeNext(si)) != NULL) { vector[j].obj = ele; diff --git a/src/t_set.c b/src/t_set.c index bcb8dd3f..01c851ba 100644 --- a/src/t_set.c +++ b/src/t_set.c @@ -80,8 +80,8 @@ int setTypeIsMember(robj *subject, robj *value) { return 0; } -setIterator *setTypeInitIterator(robj *subject) { - setIterator *si = zmalloc(sizeof(setIterator)); +setTypeIterator *setTypeInitIterator(robj *subject) { + setTypeIterator *si = zmalloc(sizeof(setIterator)); si->subject = subject; si->encoding = subject->encoding; if (si->encoding == REDIS_ENCODING_HT) { @@ -94,7 +94,7 @@ setIterator *setTypeInitIterator(robj *subject) { return si; } -void setTypeReleaseIterator(setIterator *si) { +void setTypeReleaseIterator(setTypeIterator *si) { if (si->encoding == REDIS_ENCODING_HT) dictReleaseIterator(si->di); zfree(si); @@ -103,7 +103,7 @@ void setTypeReleaseIterator(setIterator *si) { /* Move to the next entry in the set. Returns the object at the current * position, or NULL when the end is reached. This object will have its * refcount incremented, so the caller needs to take care of this. */ -robj *setTypeNext(setIterator *si) { +robj *setTypeNext(setTypeIterator *si) { robj *ret = NULL; if (si->encoding == REDIS_ENCODING_HT) { dictEntry *de = dictNext(si->di); @@ -151,7 +151,7 @@ unsigned long setTypeSize(robj *subject) { * to a hashtable) is presized to hold the number of elements in the original * set. */ void setTypeConvert(robj *subject, int enc) { - setIterator *si; + setTypeIterator *si; robj *element; redisAssert(subject->type == REDIS_SET); @@ -319,7 +319,7 @@ int qsortCompareSetsByCardinality(const void *s1, const void *s2) { void sinterGenericCommand(redisClient *c, robj **setkeys, unsigned long setnum, robj *dstkey) { robj **sets = zmalloc(sizeof(robj*)*setnum); - setIterator *si; + setTypeIterator *si; robj *ele, *lenobj = NULL, *dstset = NULL; unsigned long j, cardinality = 0; @@ -419,7 +419,7 @@ void sinterstoreCommand(redisClient *c) { void sunionDiffGenericCommand(redisClient *c, robj **setkeys, int setnum, robj *dstkey, int op) { robj **sets = zmalloc(sizeof(robj*)*setnum); - setIterator *si; + setTypeIterator *si; robj *ele, *dstset = NULL; int j, cardinality = 0; -- 2.45.2