diff options
author | epochqwert <epoch@hacking.allowed.org> | 2015-04-30 13:39:15 -0500 |
---|---|---|
committer | epochqwert <epoch@hacking.allowed.org> | 2015-04-30 13:39:15 -0500 |
commit | 8a679c4ce561110321504d6149888e8868a1b249 (patch) | |
tree | 5283cf47eb8c2f3cce2346ab9ee845e3e38dca11 | |
parent | 8248b0d0feb145ec1c2a28dee5af44c4d7a25690 (diff) | |
download | libhashtable-8a679c4ce561110321504d6149888e8868a1b249.tar.gz libhashtable-8a679c4ce561110321504d6149888e8868a1b249.zip |
made genheader.sh not use static sizes for grepping out the structs.
-rwxr-xr-x | genheader.sh | 2 | ||||
-rw-r--r-- | libhashtable.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/genheader.sh b/genheader.sh index 3995579..b3a28e6 100755 --- a/genheader.sh +++ b/genheader.sh @@ -1,3 +1,3 @@ #!/bin/sh -cat libhashtable.c | head -n 22 | tail -n 16 > hashtable.h +cat libhashtable.c | grep -A 100 _A_ | grep -B 100 _B_ | grep -v "_[AB]_" > hashtable.h cat libhashtable.c | grep '(.*) *{' | egrep -v 'if|for|while' | sed 's/ {/;/' >> hashtable.h diff --git a/libhashtable.c b/libhashtable.c index 9eb0ed4..e838433 100644 --- a/libhashtable.c +++ b/libhashtable.c @@ -3,7 +3,7 @@ #include <string.h> #include "hashtable.h" -/* +/* _A_ struct entry {//linked list node. char *original; void *target; @@ -20,7 +20,7 @@ struct hashtable { struct hitem **bucket; int *keys; }; -*/ + _B_ */ unsigned short hash(char *key) {//maybe use a seeded rand()? :) Thanks FreeArtMan return (strlen(key)<<8)+(key[0]<<4)+key[1]; |