Skip to content

Commit

Permalink
remove old hash.[ch] implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Karsten Blees authored and Junio C Hamano committed Nov 18, 2013
1 parent 419a597 commit efc6842
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 299 deletions.
52 changes: 0 additions & 52 deletions Documentation/technical/api-hash.txt

This file was deleted.

2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ LIB_H += git-compat-util.h
LIB_H += gpg-interface.h
LIB_H += graph.h
LIB_H += grep.h
LIB_H += hash.h
LIB_H += hashmap.h
LIB_H += help.h
LIB_H += http.h
Expand Down Expand Up @@ -809,7 +808,6 @@ LIB_OBJS += gettext.o
LIB_OBJS += gpg-interface.o
LIB_OBJS += graph.o
LIB_OBJS += grep.o
LIB_OBJS += hash.o
LIB_OBJS += hashmap.o
LIB_OBJS += help.o
LIB_OBJS += hex.o
Expand Down
1 change: 0 additions & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "git-compat-util.h"
#include "strbuf.h"
#include "hash.h"
#include "hashmap.h"
#include "advice.h"
#include "gettext.h"
Expand Down
110 changes: 0 additions & 110 deletions hash.c

This file was deleted.

50 changes: 0 additions & 50 deletions hash.h

This file was deleted.

84 changes: 0 additions & 84 deletions test-hashmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,85 +126,6 @@ static void perf_hashmap(unsigned int method, unsigned int rounds)
}
}

struct hash_entry
{
struct hash_entry *next;
char key[FLEX_ARRAY];
};

/*
* Test performance of hash.[ch]
* Usage: time echo "perfhash method rounds" | test-hashmap
*/
static void perf_hash(unsigned int method, unsigned int rounds)
{
struct hash_table map;
char buf[16];
struct hash_entry **entries, **res, *entry;
unsigned int *hashes;
unsigned int i, j;

entries = malloc(TEST_SIZE * sizeof(struct hash_entry *));
hashes = malloc(TEST_SIZE * sizeof(int));
for (i = 0; i < TEST_SIZE; i++) {
snprintf(buf, sizeof(buf), "%i", i);
entries[i] = malloc(sizeof(struct hash_entry) + strlen(buf) + 1);
strcpy(entries[i]->key, buf);
hashes[i] = hash(method, i, entries[i]->key);
}

if (method & TEST_ADD) {
/* test adding to the map */
for (j = 0; j < rounds; j++) {
init_hash(&map);

/* add entries */
for (i = 0; i < TEST_SIZE; i++) {
res = (struct hash_entry **) insert_hash(
hashes[i], entries[i], &map);
if (res) {
entries[i]->next = *res;
*res = entries[i];
} else {
entries[i]->next = NULL;
}
}

free_hash(&map);
}
} else {
/* test map lookups */
init_hash(&map);

/* fill the map (sparsely if specified) */
j = (method & TEST_SPARSE) ? TEST_SIZE / 10 : TEST_SIZE;
for (i = 0; i < j; i++) {
res = (struct hash_entry **) insert_hash(hashes[i],
entries[i], &map);
if (res) {
entries[i]->next = *res;
*res = entries[i];
} else {
entries[i]->next = NULL;
}
}

for (j = 0; j < rounds; j++) {
for (i = 0; i < TEST_SIZE; i++) {
entry = lookup_hash(hashes[i], &map);
while (entry) {
if (!strcmp(entries[i]->key, entry->key))
break;
entry = entry->next;
}
}
}

free_hash(&map);

}
}

#define DELIM " \t\r\n"

/*
Expand All @@ -218,7 +139,6 @@ static void perf_hash(unsigned int method, unsigned int rounds)
* size -> tablesize numentries
*
* perfhashmap method rounds -> test hashmap.[ch] performance
* perfhash method rounds -> test hash.[ch] performance
*/
int main(int argc, char *argv[])
{
Expand Down Expand Up @@ -324,10 +244,6 @@ int main(int argc, char *argv[])

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

} else if (!strcmp("perfhash", cmd) && l1 && l2) {

perf_hash(atoi(p1), atoi(p2));

} else {

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

0 comments on commit efc6842

Please sign in to comment.