intset housekeeping

This commit is contained in:
Pieter Noordhuis 2010-06-11 19:22:27 +02:00
parent 35cabcb505
commit e24d93762f
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include "intset.h" #include "intset.h"
#include "zmalloc.h" #include "zmalloc.h"
@ -152,7 +151,7 @@ intset *intsetAdd(intset *is, int64_t value, uint8_t *success) {
} }
/* Delete integer from intset */ /* Delete integer from intset */
intset *intsetDelete(intset *is, int64_t value, uint8_t *success) { intset *intsetRemove(intset *is, int64_t value, uint8_t *success) {
uint8_t valenc = INTSET_VALUE_ENCODING(value); uint8_t valenc = INTSET_VALUE_ENCODING(value);
uint32_t pos; uint32_t pos;
if (success) *success = 0; if (success) *success = 0;
@ -370,7 +369,7 @@ int main(int argc, char **argv) {
assert(intsetFind(is,v1)); assert(intsetFind(is,v1));
v2 = rand() % 0xfff; v2 = rand() % 0xfff;
is = intsetDelete(is,v2,NULL); is = intsetRemove(is,v2,NULL);
assert(!intsetFind(is,v2)); assert(!intsetFind(is,v2));
} }
checkConsistency(is); checkConsistency(is);

View File

@ -1,5 +1,6 @@
#ifndef __INTSET_H #ifndef __INTSET_H
#define __INTSET_H #define __INTSET_H
#include <stdint.h>
typedef struct intset { typedef struct intset {
uint32_t encoding; uint32_t encoding;
@ -9,7 +10,7 @@ typedef struct intset {
intset *intsetNew(void); intset *intsetNew(void);
intset *intsetAdd(intset *is, int64_t value, uint8_t *success); intset *intsetAdd(intset *is, int64_t value, uint8_t *success);
intset *intsetDelete(intset *is, int64_t value, uint8_t *success); intset *intsetRemove(intset *is, int64_t value, uint8_t *success);
uint8_t intsetFind(intset *is, int64_t value); uint8_t intsetFind(intset *is, int64_t value);
int64_t intsetRandom(intset *is); int64_t intsetRandom(intset *is);