taskrambler  0.1.9
Web server and task management solution.
hash/delete.c File Reference
#include <sys/types.h>
#include "asset.h"
#include "hash.h"
#include "utils/hash.h"
+ Include dependency graph for hash/delete.c:

Go to the source code of this file.

Functions

static int hashDeleteComp (const void *a, const void *b)
 
void * hashDelete (Hash this, const char *search, size_t nsearch)
 
void * hashDeleteByVal (Hash this, unsigned long hash)
 

Detailed Description

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file hash/delete.c.

Function Documentation

void* hashDelete ( Hash  this,
const char *  search,
size_t  nsearch 
)

Definition at line 48 of file hash/delete.c.

References hashDeleteComp(), sdbm(), and treeDelete().

Referenced by applicationSessionGet(), assetPoolRelease(), and main().

49 {
50  unsigned long hash = sdbm((const unsigned char *)search, nsearch);
51  void * found = NULL;
52 
53  found = treeDelete(&(this->root), &hash, hashDeleteComp);
54 
55  return found;
56 }
unsigned long sdbm(const unsigned char *, size_t)
Definition: utils/hash.c:45
static int hashDeleteComp(const void *a, const void *b)
Definition: hash/delete.c:32
void * treeDelete(Tree *, const void *, TreeComp)
Definition: tree/delete.c:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void* hashDeleteByVal ( Hash  this,
unsigned long  hash 
)

Definition at line 59 of file hash/delete.c.

References hashDeleteComp(), and treeDelete().

Referenced by applicationSessionStop().

60 {
61  void * found = treeDelete(&(this->root), &hash, hashDeleteComp);
62 
63  return found;
64 }
static int hashDeleteComp(const void *a, const void *b)
Definition: hash/delete.c:32
void * treeDelete(Tree *, const void *, TreeComp)
Definition: tree/delete.c:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int hashDeleteComp ( const void *  a,
const void *  b 
)
inlinestatic

Definition at line 32 of file hash/delete.c.

References hashableGetHash().

Referenced by hashDelete(), and hashDeleteByVal().

33 {
34  unsigned long hash_a = hashableGetHash((void*)a);
35 
36  if (hash_a < *(const unsigned long*)b) {
37  return -1;
38  }
39 
40  if (hash_a > *(const unsigned long*)b) {
41  return 1;
42  }
43 
44  return 0;
45 }
unsigned long hashableGetHash(void *)
Definition: hashable.c:36

+ Here is the call graph for this function:

+ Here is the caller graph for this function: