Server 0.0.1
HTTP/REST server implementation

src/hash/delete.c

Go to the documentation of this file.
00001 
00023 #include <search.h>
00024 #include <sys/types.h>
00025 
00026 #include "hash.h"
00027 #include "utils/hash.h"
00028 
00029 static
00030 inline
00031 int
00032 hashDeleteComp(const void * a, const void * b)
00033 {
00034         return hashableGetHash((void*)b) - *(const unsigned long*)a;
00035 }
00036 
00037 void *
00038 hashDelete(Hash this, const char * search, size_t nsearch)
00039 {
00040         unsigned long hash  = sdbm((const unsigned char *)search, nsearch);
00041         void *        found = tfind(&hash, &(this->root), hashDeleteComp);
00042 
00043         return (NULL != found)? *(void**)found : NULL;
00044 }
00045 
00046 // vim: set ts=4 sw=4:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines