diff options
| -rw-r--r-- | hashtab.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -134,7 +134,7 @@ hash_free(struct hash_tab *ht) | |||
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | int | 137 | static int |
| 138 | getword(FILE *fp, char *buf, int size, int first(int), int rest(int)) | 138 | getword(FILE *fp, char *buf, int size, int first(int), int rest(int)) |
| 139 | { | 139 | { |
| 140 | int i = 0, c; | 140 | int i = 0, c; |
| @@ -163,19 +163,19 @@ getword(FILE *fp, char *buf, int size, int first(int), int rest(int)) | |||
| 163 | return c > 0; | 163 | return c > 0; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | int | 166 | static int |
| 167 | first(int c) | 167 | first(int c) |
| 168 | { | 168 | { |
| 169 | return isalpha(c); | 169 | return isalpha(c); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | int | 172 | static int |
| 173 | rest(int c) | 173 | rest(int c) |
| 174 | { | 174 | { |
| 175 | return isalpha(c) || c == '_'; | 175 | return isalpha(c) || c == '_'; |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | void | 178 | static void |
| 179 | print(const char *key, T data, void *cl) | 179 | print(const char *key, T data, void *cl) |
| 180 | { | 180 | { |
| 181 | fprintf(cl, "%s: %d\n", key, data); | 181 | fprintf(cl, "%s: %d\n", key, data); |
| @@ -190,7 +190,7 @@ main() | |||
| 190 | hash_init(ht); | 190 | hash_init(ht); |
| 191 | 191 | ||
| 192 | while ( getword(stdin, word, sizeof word, first, rest) ) { | 192 | while ( getword(stdin, word, sizeof word, first, rest) ) { |
| 193 | int *p = hash_lookup(ht, word, 0, 1); | 193 | T *p = hash_lookup(ht, word, 0, 1); |
| 194 | if ( p != NULL ) | 194 | if ( p != NULL ) |
| 195 | ++(*p); | 195 | ++(*p); |
| 196 | } | 196 | } |
