summaryrefslogtreecommitdiff
path: root/lib/fprint.h
blob: d79a9ce8a11b2aaede809bf7ec49c308b6def37b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef H_FINGERPRINT
#define H_FINGERPRINT

typedef struct fingerprint_s {
    dev_t dev;
    ino_t ino;
    const char * basename;
} fingerPrint;

/* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */
fingerPrint fpLookup(const char * fullName, int scareMemory);
unsigned int fpHashFunction(const void * string);
int fpEqual(const void * key1, const void * key2);
/* scareMemory is assumed here! */
void fpLookupList(const char ** fullNames, fingerPrint * fpList, int numItems,
		  int alreadySorted);

/* only if !scarceMemory */
#define fpFree(a) free((void *)(a).basename)

#define FP_EQUAL(a, b) ((&(a) == &(b)) || \
			       (((a).dev == (b).dev) && \
			        ((a).ino == (b).ino) && \
			        !strcmp((a).basename, (b).basename)))

#endif