File src/Makefile.am changed (mode: 100644) (index 0476e56..ee05677) |
... |
... |
hh_SOURCES = \ |
11 |
11 |
hstr_history.c include/hstr_history.h \ |
hstr_history.c include/hstr_history.h \ |
12 |
12 |
hstr_utils.c include/hstr_utils.h \ |
hstr_utils.c include/hstr_utils.h \ |
13 |
13 |
hstr_favorites.c include/hstr_favorites.h \ |
hstr_favorites.c include/hstr_favorites.h \ |
|
14 |
|
hstr_regexp.c include/hstr_regexp.h \ |
14 |
15 |
radixsort.c include/radixsort.h \ |
radixsort.c include/radixsort.h \ |
15 |
16 |
hstr.c |
hstr.c |
File src/hashset.c changed (mode: 100644) (index 0f79a2a..ecfadde) |
... |
... |
int hashset_put(HashSet *hs, const char *key, void *value) |
74 |
74 |
return 1; |
return 1; |
75 |
75 |
} |
} |
76 |
76 |
|
|
77 |
|
int hashset_add(const HashSet * hs, const char *key) |
|
|
77 |
|
int hashset_add(HashSet * hs, const char *key) |
78 |
78 |
{ |
{ |
79 |
79 |
return hashset_put(hs, key, "nil"); |
return hashset_put(hs, key, "nil"); |
80 |
80 |
} |
} |
File src/hstr_regexp.c changed (mode: 100644) (index 61cea9d..64690ed) |
9 |
9 |
|
|
10 |
10 |
#include "include/hstr_regexp.h" |
#include "include/hstr_regexp.h" |
11 |
11 |
|
|
|
12 |
|
#include "include/hstr_utils.h" |
|
13 |
|
|
12 |
14 |
#define REGEXP_MATCH_BUFFER_SIZE 1 |
#define REGEXP_MATCH_BUFFER_SIZE 1 |
13 |
15 |
|
|
14 |
16 |
void hstr_regexp_init(HstrRegexp *hstrRegexp) |
void hstr_regexp_init(HstrRegexp *hstrRegexp) |
|
... |
... |
bool hstr_regexp_match(HstrRegexp *hstrRegexp, char *regexp, char *text, regmatc |
27 |
29 |
int compilationStatus=regcomp(compiled, regexp, compilationFlags); |
int compilationStatus=regcomp(compiled, regexp, compilationFlags); |
28 |
30 |
//printf("\nCompilation: %d",compilationStatus); |
//printf("\nCompilation: %d",compilationStatus); |
29 |
31 |
if(!compilationStatus) { |
if(!compilationStatus) { |
30 |
|
hashset_put(&hstrRegexp->cache, strdup(regexp), compiled); |
|
|
32 |
|
hashset_put(&hstrRegexp->cache, hstr_strdup(regexp), compiled); |
31 |
33 |
} else { |
} else { |
32 |
34 |
free(compiled); |
free(compiled); |
33 |
35 |
// TODO error handling: regerror() to turn error codes to messages |
// TODO error handling: regerror() to turn error codes to messages |
File src/include/hashset.h changed (mode: 100644) (index 43f4bd8..b6424e3) |
... |
... |
typedef struct { |
30 |
30 |
void hashset_init(HashSet *hs); |
void hashset_init(HashSet *hs); |
31 |
31 |
|
|
32 |
32 |
int hashset_contains(const HashSet *hs, const char *key); |
int hashset_contains(const HashSet *hs, const char *key); |
33 |
|
int hashset_add(const HashSet *hs, const char *key); |
|
|
33 |
|
int hashset_add(HashSet *hs, const char *key); |
34 |
34 |
int hashset_size(const HashSet *hs); |
int hashset_size(const HashSet *hs); |
35 |
35 |
char** hashset_keys(const HashSet *hs); |
char** hashset_keys(const HashSet *hs); |
36 |
36 |
|
|