X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fpatches%2Ftesting%2Fhash.c;h=7a5a53844e899f3abae7239429150e1e84b3fab8;hb=8fc14a69f0caa1820e4f24b1e7fb4d822759a60d;hp=cd808298d89064f25195832cfa4b130cf7ea54d5;hpb=4c89411092df8f48c412994c0a68bfd8a823067a;p=bacula%2Fbacula diff --git a/bacula/patches/testing/hash.c b/bacula/patches/testing/hash.c index cd808298d8..7a5a53844e 100644 --- a/bacula/patches/testing/hash.c +++ b/bacula/patches/testing/hash.c @@ -134,7 +134,7 @@ bool hash_put(char *key, char *val) { int ecode; - if (!tcbdbput2(hdb, key, val)) { + if (!tcbdbput(hdb, key, strlen(key), val, strlen(val)+1)) { ecode = tcbdbecode(hdb); fprintf(stderr, "put error: %s\n", tcbdberrmsg(ecode)); return 0; @@ -314,9 +314,11 @@ int main(int argc, char **argv) ctime = get_current_time(); fprintf(stderr, "elt;time\n"); while (fgets(line, sizeof(line), fp)) { + i++; + hash_put(line, data); - if (i++ == 99) { + if (i == 99) { strcpy(save_key, mkey); } @@ -347,6 +349,7 @@ int main(int argc, char **argv) char *p; fprintf(stderr, "elt;time\n"); while (fgets(line, sizeof(line), fp)) { + i++; p = hash_get(line, data, sizeof(data)); if (p) { p[5]='H'; @@ -358,7 +361,6 @@ int main(int argc, char **argv) fprintf(stderr, "%i;%i\n", i/100000, (int) ((ttime - ctime)/1000)); } - i++; hash_free(p); } @@ -370,12 +372,12 @@ int main(int argc, char **argv) hash_iterinit(); while(hash_next(line, sizeof(line), data, sizeof(data))) { + i++; if (i%100000 == 0) { ttime= get_current_time(); fprintf(stderr, "%i;%i\n", i/100000, (int) ((ttime - ctime)/1000)); } - i++; } hash_iterdone();