Repositories » libk0
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

_strcmp() wraps strcmp() to match the interfaces parameters.

Changeset 2ee7a6ba1424

Parent 470f02711d87

by Rup Palchowdhury

Changes to 2 files · Browse files at 2ee7a6ba1424 Showing diff from parent 470f02711d87 Diff from another changeset...

Change 1 of 2 Show Entire File khash.c Stacked
 
1
2
 
3
4
5
 
26
27
28
29
 
 
 
 
 
 
30
31
32
 
1
2
3
4
5
6
 
27
28
29
 
30
31
32
33
34
35
36
37
38
@@ -1,5 +1,6 @@
 #include <stdio.h>  #include <stdlib.h> +#include <string.h>  #include "kcommon.h"  #include "klist.h"  #include "khash.h" @@ -26,7 +27,12 @@
  free(h);  }   -unsigned strhash(void *data, unsigned size) +int _strcmp(void *d1, void *d2) +{ + return strcmp((char *)d1, (char *)d2); +} + +unsigned _strhash(void *data, unsigned size)  {   static unsigned MULTIPLIER = 31;   unsigned h;
Change 1 of 1 Show Entire File khash.h Stacked
 
10
11
12
13
 
 
14
15
 
10
11
12
 
13
14
15
16
@@ -10,6 +10,7 @@
 Hash *newhash(unsigned, fn_cmp, fn_hash);  void freehash(Hash*, void (*freedata)(void*));  Node *hlookup(Hash*, Node*, int); -unsigned strhash(void*, unsigned); +int _strcmp(void *d1, void *d2); +unsigned _strhash(void*, unsigned);  void fprinthashstats(FILE*, Hash*);  void fprinthash(FILE*, Hash*, void (*printdata)(FILE*, void*));