This source file includes following definitions.
- triple_hash
- triple_compare_ino_str
- triple_free
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21
22 #include "hash-triple.h"
23
24 #include <stdlib.h>
25 #include <string.h>
26
27 #include "hash-pjw.h"
28 #include "same-inode.h"
29
30 #define STREQ(a, b) (strcmp (a, b) == 0)
31
32
33 size_t
34 triple_hash (void const *x, size_t table_size)
35 {
36 struct F_triple const *p = x;
37 size_t tmp = hash_pjw (p->name, table_size);
38
39
40 return (tmp ^ p->st_ino) % table_size;
41 }
42
43
44 bool
45 triple_compare_ino_str (void const *x, void const *y)
46 {
47 struct F_triple const *a = x;
48 struct F_triple const *b = y;
49 return (SAME_INODE (*a, *b) && STREQ (a->name, b->name)) ? true : false;
50 }
51
52
53 void
54 triple_free (void *x)
55 {
56 struct F_triple *a = x;
57 free (a->name);
58 free (a);
59 }