X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstrset%2Ftools%2Fcbspeed.c;h=9763efcbd88970ff9cd6d7b2973c195ce176a261;hp=3018da9806daec0c404f2c6b245afccd20505c26;hb=f3eecc2c76e7ebbd0024b1528326bbb18a7d7742;hpb=86502ad3411f351aab40bbb5ed6b8089f198eb26 diff --git a/ccan/strset/tools/cbspeed.c b/ccan/strset/tools/cbspeed.c index 3018da98..9763efcb 100644 --- a/ccan/strset/tools/cbspeed.c +++ b/ccan/strset/tools/cbspeed.c @@ -19,9 +19,9 @@ #15: Post-Churn lookup (miss): 189-197(191) #16: Post-Churn lookup (random): 500-531(506) */ -#include -#include -#include +#include +#include +#include #include #include #include @@ -395,23 +395,22 @@ int main(int argc, char *argv[]) critbit0_tree ct; char **words, **misswords; - words = strsplit(NULL, grab_file(NULL, - argv[1] ? argv[1] : "/usr/share/dict/words", - NULL), "\n"); + words = tal_strsplit(NULL, grab_file(NULL, + argv[1] ? argv[1] : "/usr/share/dict/words"), "\n", STR_NO_EMPTY); ct.root = NULL; - num = talloc_array_length(words) - 1; + num = tal_count(words) - 1; printf("%zu words\n", num); /* Append and prepend last char for miss testing. */ - misswords = talloc_array(words, char *, num); + misswords = tal_arr(words, char *, num); for (i = 0; i < num; i++) { char lastc; if (strlen(words[i])) lastc = words[i][strlen(words[i])-1]; else lastc = 'z'; - misswords[i] = talloc_asprintf(misswords, "%c%s%c%c", - lastc, words[i], lastc, lastc); + misswords[i] = tal_fmt(misswords, "%c%s%c%c", + lastc, words[i], lastc, lastc); } printf("#01: Initial insert: ");