Skip to content

Commit efc6842

Browse files
kbleesgitster
authored andcommitted
remove old hash.[ch] implementation
Signed-off-by: Karsten Blees <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 419a597 commit efc6842

File tree

6 files changed

+0
-299
lines changed

6 files changed

+0
-299
lines changed

Documentation/technical/api-hash.txt

Lines changed: 0 additions & 52 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,6 @@ LIB_H += git-compat-util.h
677677
LIB_H += gpg-interface.h
678678
LIB_H += graph.h
679679
LIB_H += grep.h
680-
LIB_H += hash.h
681680
LIB_H += hashmap.h
682681
LIB_H += help.h
683682
LIB_H += http.h
@@ -809,7 +808,6 @@ LIB_OBJS += gettext.o
809808
LIB_OBJS += gpg-interface.o
810809
LIB_OBJS += graph.o
811810
LIB_OBJS += grep.o
812-
LIB_OBJS += hash.o
813811
LIB_OBJS += hashmap.o
814812
LIB_OBJS += help.o
815813
LIB_OBJS += hex.o

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include "git-compat-util.h"
55
#include "strbuf.h"
6-
#include "hash.h"
76
#include "hashmap.h"
87
#include "advice.h"
98
#include "gettext.h"

hash.c

Lines changed: 0 additions & 110 deletions
This file was deleted.

hash.h

Lines changed: 0 additions & 50 deletions
This file was deleted.

test-hashmap.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -126,85 +126,6 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
126126
}
127127
}
128128

129-
struct hash_entry
130-
{
131-
struct hash_entry *next;
132-
char key[FLEX_ARRAY];
133-
};
134-
135-
/*
136-
* Test performance of hash.[ch]
137-
* Usage: time echo "perfhash method rounds" | test-hashmap
138-
*/
139-
static void perf_hash(unsigned int method, unsigned int rounds)
140-
{
141-
struct hash_table map;
142-
char buf[16];
143-
struct hash_entry **entries, **res, *entry;
144-
unsigned int *hashes;
145-
unsigned int i, j;
146-
147-
entries = malloc(TEST_SIZE * sizeof(struct hash_entry *));
148-
hashes = malloc(TEST_SIZE * sizeof(int));
149-
for (i = 0; i < TEST_SIZE; i++) {
150-
snprintf(buf, sizeof(buf), "%i", i);
151-
entries[i] = malloc(sizeof(struct hash_entry) + strlen(buf) + 1);
152-
strcpy(entries[i]->key, buf);
153-
hashes[i] = hash(method, i, entries[i]->key);
154-
}
155-
156-
if (method & TEST_ADD) {
157-
/* test adding to the map */
158-
for (j = 0; j < rounds; j++) {
159-
init_hash(&map);
160-
161-
/* add entries */
162-
for (i = 0; i < TEST_SIZE; i++) {
163-
res = (struct hash_entry **) insert_hash(
164-
hashes[i], entries[i], &map);
165-
if (res) {
166-
entries[i]->next = *res;
167-
*res = entries[i];
168-
} else {
169-
entries[i]->next = NULL;
170-
}
171-
}
172-
173-
free_hash(&map);
174-
}
175-
} else {
176-
/* test map lookups */
177-
init_hash(&map);
178-
179-
/* fill the map (sparsely if specified) */
180-
j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE;
181-
for (i = 0; i < j; i++) {
182-
res = (struct hash_entry **) insert_hash(hashes[i],
183-
entries[i], &map);
184-
if (res) {
185-
entries[i]->next = *res;
186-
*res = entries[i];
187-
} else {
188-
entries[i]->next = NULL;
189-
}
190-
}
191-
192-
for (j = 0; j < rounds; j++) {
193-
for (i = 0; i < TEST_SIZE; i++) {
194-
entry = lookup_hash(hashes[i], &map);
195-
while (entry) {
196-
if (!strcmp(entries[i]->key, entry->key))
197-
break;
198-
entry = entry->next;
199-
}
200-
}
201-
}
202-
203-
free_hash(&map);
204-
205-
}
206-
}
207-
208129
#define DELIM " \t\r\n"
209130

210131
/*
@@ -218,7 +139,6 @@ static void perf_hash(unsigned int method, unsigned int rounds)
218139
* size -> tablesize numentries
219140
*
220141
* perfhashmap method rounds -> test hashmap.[ch] performance
221-
* perfhash method rounds -> test hash.[ch] performance
222142
*/
223143
int main(int argc, char *argv[])
224144
{
@@ -324,10 +244,6 @@ int main(int argc, char *argv[])
324244

325245
perf_hashmap(atoi(p1), atoi(p2));
326246

327-
} else if (!strcmp("perfhash", cmd) && l1 && l2) {
328-
329-
perf_hash(atoi(p1), atoi(p2));
330-
331247
} else {
332248

333249
printf("Unknown command %s\n", cmd);

0 commit comments

Comments
 (0)