-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
47 lines (31 loc) · 787 Bytes
/
utils.h
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef _DEDUP_UTILS_H_
#define _DEDUP_UTILS_H_
struct cmp_uchar_p {
bool operator()(const unsigned char* a, const unsigned char* b) const {
int ret = memcmp((const char*)a,(const char*)b, HASH_DIGEST_LENGTH );
if ( ret < 0 ){
//printf(" a %s < b: %s\n",a,b);
return true;
}
/*if ( ret == 0 )
printf(" a %s == b: %s\n",a,b);
if ( ret > 0 )
printf(" a %s > b: %s\n",a,b);*/
return false;
}
};
struct cmp_char_p {
bool operator()(const char* a, const char* b) const {
int ret = strcmp(a,b);
if ( ret < 0 ){
//printf(" a %s < b: %s\n",a,b);
return true;
}
/*if ( ret == 0 )
printf(" a %s == b: %s\n",a,b);
if ( ret > 0 )
printf(" a %s > b: %s\n",a,b);*/
return false;
}
};
#endif