]> git.ozlabs.org Git - ccan/commitdiff
tal/str: use tal_ prefix.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 3 Dec 2012 08:59:39 +0000 (19:29 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 3 Dec 2012 08:59:39 +0000 (19:29 +1030)
It's short, and much clearer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/tal/path/path.c
ccan/tal/str/_info
ccan/tal/str/str.c
ccan/tal/str/str.h
ccan/tal/str/test/run-strreg.c
ccan/tal/str/test/run.c

index 0ad168c872d219d3b485e23d53d39ab430d40eb7..e6e94dbe080dca24fcdb5ec02a4701381029647b 100644 (file)
@@ -525,7 +525,7 @@ bool path_is_dir(const char *path)
 char **path_split(const tal_t *ctx, const char *path)
 {
        bool empty = path && !path[0];
 char **path_split(const tal_t *ctx, const char *path)
 {
        bool empty = path && !path[0];
-       char **ret = strsplit(ctx, path, PATH_SEP_STR, STR_NO_EMPTY);
+       char **ret = tal_strsplit(ctx, path, PATH_SEP_STR, STR_NO_EMPTY);
 
        /* Handle the "/" case */
        if (ret && !empty && !ret[0]) {
 
        /* Handle the "/" case */
        if (ret && !empty && !ret[0]) {
index 24229bca287a09511a70b7ecd876071b91ef623a..f95fc10eb8d35426ab7ebb384759413a01340544 100644 (file)
  *             textfile = grab_file(NULL, argv[1], NULL);
  *             if (!textfile)
  *                     err(1, "Failed reading %s", argv[1]);
  *             textfile = grab_file(NULL, argv[1], NULL);
  *             if (!textfile)
  *                     err(1, "Failed reading %s", argv[1]);
- *             lines = strsplit(textfile, textfile, "\n", STR_EMPTY_OK);
+ *             lines = tal_strsplit(textfile, textfile, "\n", STR_EMPTY_OK);
  *
  *             // Join them back together with two linefeeds.
  *
  *             // Join them back together with two linefeeds.
- *             printf("%s", strjoin(textfile, lines, "\n\n", STR_TRAIL));
+ *             printf("%s", tal_strjoin(textfile, lines, "\n\n", STR_TRAIL));
  *
  *             // Free everything, just because we can.
  *             tal_free(textfile);
  *
  *             // Free everything, just because we can.
  *             tal_free(textfile);
index 7d5b103a66cffd848fd6a8371fc1bce5f7c25eca..cafb04bb50a7d2a78aea39113b1d32fec32334d8 100644 (file)
@@ -13,8 +13,8 @@
 #include <ccan/tal/tal.h>
 #include <ccan/take/take.h>
 
 #include <ccan/tal/tal.h>
 #include <ccan/take/take.h>
 
-char **strsplit(const tal_t *ctx,
-               const char *string, const char *delims, enum strsplit flags)
+char **tal_strsplit(const tal_t *ctx,
+                   const char *string, const char *delims, enum strsplit flags)
 {
        char **parts, *str;
        size_t max = 64, num = 0;
 {
        char **parts, *str;
        size_t max = 64, num = 0;
@@ -65,8 +65,8 @@ fail:
        return NULL;
 }
 
        return NULL;
 }
 
-char *strjoin(const tal_t *ctx,
-             char *strings[], const char *delim, enum strjoin flags)
+char *tal_strjoin(const tal_t *ctx,
+                 char *strings[], const char *delim, enum strjoin flags)
 {
        unsigned int i;
        char *ret = NULL;
 {
        unsigned int i;
        char *ret = NULL;
@@ -108,7 +108,7 @@ fail:
        goto out;
 }
 
        goto out;
 }
 
-bool strreg(const tal_t *ctx, const char *string, const char *regex, ...)
+bool tal_strreg(const tal_t *ctx, const char *string, const char *regex, ...)
 {
        size_t nmatch = 1 + strcount(regex, "(");
        regmatch_t matches[nmatch];
 {
        size_t nmatch = 1 + strcount(regex, "(");
        regmatch_t matches[nmatch];
index 295c3a6b9cb0b0c63d779877b0001b012641ce9b..f30911e2df6f246cb39897fe11f00af0c61d0918 100644 (file)
@@ -12,7 +12,7 @@ enum strsplit {
 };
 
 /**
 };
 
 /**
- * strsplit - Split string into an array of substrings
+ * tal_strsplit - Split string into an array of substrings
  * @ctx: the context to tal from (often NULL).
  * @string: the string to split (can be take()).
  * @delims: delimiters where lines should be split (can be take()).
  * @ctx: the context to tal from (often NULL).
  * @string: the string to split (can be take()).
  * @delims: delimiters where lines should be split (can be take()).
@@ -38,7 +38,7 @@ enum strsplit {
  *             unsigned int i, long_lines = 0;
  *
  *             // Can only fail on out-of-memory.
  *             unsigned int i, long_lines = 0;
  *
  *             // Can only fail on out-of-memory.
- *             lines = strsplit(NULL, string, "\n", STR_NO_EMPTY);
+ *             lines = tal_strsplit(NULL, string, "\n", STR_NO_EMPTY);
  *             for (i = 0; lines[i] != NULL; i++)
  *                     if (strlen(lines[i]) > 80)
  *                             long_lines++;
  *             for (i = 0; lines[i] != NULL; i++)
  *                     if (strlen(lines[i]) > 80)
  *                             long_lines++;
@@ -46,8 +46,8 @@ enum strsplit {
  *             return long_lines;
  *     }
  */
  *             return long_lines;
  *     }
  */
-char **strsplit(const tal_t *ctx,
-               const char *string, const char *delims, enum strsplit flags);
+char **tal_strsplit(const tal_t *ctx,
+                   const char *string, const char *delims, enum strsplit flag);
 
 enum strjoin {
        STR_TRAIL,
 
 enum strjoin {
        STR_TRAIL,
@@ -55,7 +55,7 @@ enum strjoin {
 };
 
 /**
 };
 
 /**
- * strjoin - Join an array of substrings into one long string
+ * tal_strjoin - Join an array of substrings into one long string
  * @ctx: the context to tal from (often NULL).
  * @strings: the NULL-terminated array of strings to join (can be take())
  * @delim: the delimiter to insert between the strings (can be take())
  * @ctx: the context to tal from (often NULL).
  * @strings: the NULL-terminated array of strings to join (can be take())
  * @delim: the delimiter to insert between the strings (can be take())
@@ -71,17 +71,17 @@ enum strjoin {
  *     {
  *             char **lines, *ret;
  *
  *     {
  *             char **lines, *ret;
  *
- *             lines = strsplit(NULL, string, "\n", STR_EMPTY_OK);
- *             ret = strjoin(NULL, lines, "-- EOL\n", STR_TRAIL);
+ *             lines = tal_strsplit(NULL, string, "\n", STR_EMPTY_OK);
+ *             ret = tal_strjoin(NULL, lines, "-- EOL\n", STR_TRAIL);
  *             tal_free(lines);
  *             return ret;
  *     }
  */
  *             tal_free(lines);
  *             return ret;
  *     }
  */
-char *strjoin(const void *ctx, char *strings[], const char *delim,
-             enum strjoin flags);
+char *tal_strjoin(const void *ctx, char *strings[], const char *delim,
+                 enum strjoin flags);
 
 /**
 
 /**
- * strreg - match and extract from a string via (extended) regular expressions.
+ * tal_strreg - match/extract from a string via (extended) regular expressions.
  * @ctx: the context to tal from (often NULL)
  * @string: the string to try to match (can be take())
  * @regex: the regular expression to match (can be take())
  * @ctx: the context to tal from (often NULL)
  * @string: the string to try to match (can be take())
  * @regex: the regular expression to match (can be take())
@@ -109,14 +109,15 @@ char *strjoin(const void *ctx, char *strings[], const char *delim,
  *             char *person, *input;
  *
  *             // Join args and trim trailing space.
  *             char *person, *input;
  *
  *             // Join args and trim trailing space.
- *             input = strjoin(NULL, argv+1, " ", STR_NO_TRAIL);
- *             if (strreg(NULL, input, "[Mm]y (first )?name is ([A-Za-z ]+)",
- *                        NULL, &person))
+ *             input = tal_strjoin(NULL, argv+1, " ", STR_NO_TRAIL);
+ *             if (tal_strreg(NULL, input,
+ *                            "[Mm]y (first )?name is ([A-Za-z ]+)",
+ *                            NULL, &person))
  *                     printf("Hello %s!\n", person);
  *             else
  *                     printf("Hello there!\n");
  *             return 0;
  *     }
  */
  *                     printf("Hello %s!\n", person);
  *             else
  *                     printf("Hello there!\n");
  *             return 0;
  *     }
  */
-bool strreg(const void *ctx, const char *string, const char *regex, ...);
+bool tal_strreg(const void *ctx, const char *string, const char *regex, ...);
 #endif /* CCAN_STR_TAL_H */
 #endif /* CCAN_STR_TAL_H */
index cf0b9b1d9a8a888a8616b36ae9df1b9bc8f04633..47671efd9270ec4a65d2ec7253fb65db5f31a257 100644 (file)
@@ -22,23 +22,23 @@ int main(int argc, char *argv[])
 
        plan_tests(40);
        /* Simple matching. */
 
        plan_tests(40);
        /* Simple matching. */
-       ok1(strreg(ctx, "hello world!", "hello") == true);
-       ok1(strreg(ctx, "hello world!", "hi") == false);
+       ok1(tal_strreg(ctx, "hello world!", "hello") == true);
+       ok1(tal_strreg(ctx, "hello world!", "hi") == false);
 
        /* No parentheses means we don't use any extra args. */
 
        /* No parentheses means we don't use any extra args. */
-       ok1(strreg(ctx, "hello world!", "hello", invalid) == true);
-       ok1(strreg(ctx, "hello world!", "hi", invalid) == false);
+       ok1(tal_strreg(ctx, "hello world!", "hello", invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "hi", invalid) == false);
 
 
-       ok1(strreg(ctx, "hello world!", "[a-z]+", invalid) == true);
-       ok1(strreg(ctx, "hello world!", "([a-z]+)", &a, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "[a-z]+", invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "([a-z]+)", &a, invalid) == true);
        /* Found string */
        ok1(streq(a, "hello"));
        /* Allocated off ctx */
        ok1(find_parent(a, ctx));
        tal_free(a);
 
        /* Found string */
        ok1(streq(a, "hello"));
        /* Allocated off ctx */
        ok1(find_parent(a, ctx));
        tal_free(a);
 
-       ok1(strreg(ctx, "hello world!", "([a-z]*) ([a-z]+)",
-                  &a, &b, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "([a-z]*) ([a-z]+)",
+                      &a, &b, invalid) == true);
        ok1(streq(a, "hello"));
        ok1(streq(b, "world"));
        ok1(find_parent(a, ctx));
        ok1(streq(a, "hello"));
        ok1(streq(b, "world"));
        ok1(find_parent(a, ctx));
@@ -47,32 +47,32 @@ int main(int argc, char *argv[])
        tal_free(b);
 
        /* * after parentheses returns last match. */
        tal_free(b);
 
        /* * after parentheses returns last match. */
-       ok1(strreg(ctx, "hello world!", "([a-z])* ([a-z]+)",
-                  &a, &b, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "([a-z])* ([a-z]+)",
+                      &a, &b, invalid) == true);
        ok1(streq(a, "o"));
        ok1(streq(b, "world"));
        tal_free(a);
        tal_free(b);
 
        /* Nested parentheses are ordered by open brace. */
        ok1(streq(a, "o"));
        ok1(streq(b, "world"));
        tal_free(a);
        tal_free(b);
 
        /* Nested parentheses are ordered by open brace. */
-       ok1(strreg(ctx, "hello world!", "(([a-z]*) world)",
-                  &a, &b, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "(([a-z]*) world)",
+                      &a, &b, invalid) == true);
        ok1(streq(a, "hello world"));
        ok1(streq(b, "hello"));
        tal_free(a);
        tal_free(b);
 
        /* Nested parentheses are ordered by open brace. */
        ok1(streq(a, "hello world"));
        ok1(streq(b, "hello"));
        tal_free(a);
        tal_free(b);
 
        /* Nested parentheses are ordered by open brace. */
-       ok1(strreg(ctx, "hello world!", "(([a-z]*) world)",
-                  &a, &b, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "(([a-z]*) world)",
+                      &a, &b, invalid) == true);
        ok1(streq(a, "hello world"));
        ok1(streq(b, "hello"));
        tal_free(a);
        tal_free(b);
 
        /* NULL means we're not interested. */
        ok1(streq(a, "hello world"));
        ok1(streq(b, "hello"));
        tal_free(a);
        tal_free(b);
 
        /* NULL means we're not interested. */
-       ok1(strreg(ctx, "hello world!", "((hello|goodbye) world)",
-                  &a, NULL, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", "((hello|goodbye) world)",
+                      &a, NULL, invalid) == true);
        ok1(streq(a, "hello world"));
        tal_free(a);
 
        ok1(streq(a, "hello world"));
        tal_free(a);
 
@@ -80,12 +80,12 @@ int main(int argc, char *argv[])
        ok1(!tal_first(ctx));
 
        /* NULL arg with take means always fail. */
        ok1(!tal_first(ctx));
 
        /* NULL arg with take means always fail. */
-       ok1(strreg(ctx, take(NULL), "((hello|goodbye) world)",
-                  &b, NULL, invalid) == false);
+       ok1(tal_strreg(ctx, take(NULL), "((hello|goodbye) world)",
+                      &b, NULL, invalid) == false);
 
        /* Take string. */
        a = tal_strdup(ctx, "hello world!");
 
        /* Take string. */
        a = tal_strdup(ctx, "hello world!");
-       ok1(strreg(ctx, take(a), "([a-z]+)", &b, invalid) == true);
+       ok1(tal_strreg(ctx, take(a), "([a-z]+)", &b, invalid) == true);
        ok1(streq(b, "hello"));
        ok1(tal_parent(b) == ctx);
        tal_free(b);
        ok1(streq(b, "hello"));
        ok1(tal_parent(b) == ctx);
        tal_free(b);
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
 
        /* Take regex. */
        a = tal_strdup(ctx, "([a-z]+)");
 
        /* Take regex. */
        a = tal_strdup(ctx, "([a-z]+)");
-       ok1(strreg(ctx, "hello world!", take(a), &b, invalid) == true);
+       ok1(tal_strreg(ctx, "hello world!", take(a), &b, invalid) == true);
        ok1(streq(b, "hello"));
        ok1(tal_parent(b) == ctx);
        tal_free(b);
        ok1(streq(b, "hello"));
        ok1(tal_parent(b) == ctx);
        tal_free(b);
@@ -101,8 +101,8 @@ int main(int argc, char *argv[])
 
        /* Take both. */
        a = tal_strdup(ctx, "([a-z]+)");
 
        /* Take both. */
        a = tal_strdup(ctx, "([a-z]+)");
-       ok1(strreg(ctx, take(tal_strdup(ctx, "hello world!")),
-                  take(a), &b, invalid) == true);
+       ok1(tal_strreg(ctx, take(tal_strdup(ctx, "hello world!")),
+                      take(a), &b, invalid) == true);
        ok1(streq(b, "hello"));
        ok1(tal_parent(b) == ctx);
        tal_free(b);
        ok1(streq(b, "hello"));
        ok1(tal_parent(b) == ctx);
        tal_free(b);
@@ -110,8 +110,8 @@ int main(int argc, char *argv[])
 
        /* ... even if we fail to match. */
        a = tal_strdup(ctx, "([a-z]+)");
 
        /* ... even if we fail to match. */
        a = tal_strdup(ctx, "([a-z]+)");
-       ok1(strreg(ctx, take(tal_strdup(ctx, "HELLO WORLD!")),
-                  take(a), &b, invalid) == false);
+       ok1(tal_strreg(ctx, take(tal_strdup(ctx, "HELLO WORLD!")),
+                      take(a), &b, invalid) == false);
        ok1(tal_first(ctx) == NULL);
        tal_free(ctx);
 
        ok1(tal_first(ctx) == NULL);
        tal_free(ctx);
 
index 303a0fd273e14e445ffb1f4406d9c89edbaa5f06..cb7cc199647397f4c5c74fa1174f003976fce84d 100644 (file)
@@ -15,7 +15,7 @@ int main(int argc, char *argv[])
        void *ctx;
 
        plan_tests(69);
        void *ctx;
 
        plan_tests(69);
-       split = strsplit(NULL, "hello  world", " ", STR_EMPTY_OK);
+       split = tal_strsplit(NULL, "hello  world", " ", STR_EMPTY_OK);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], ""));
        ok1(!strcmp(split[2], "world"));
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], ""));
        ok1(!strcmp(split[2], "world"));
@@ -23,21 +23,21 @@ int main(int argc, char *argv[])
        ok1(tal_count(split) == 4);
        tal_free(split);
 
        ok1(tal_count(split) == 4);
        tal_free(split);
 
-       split = strsplit(NULL, "hello  world", " ", STR_NO_EMPTY);
+       split = tal_strsplit(NULL, "hello  world", " ", STR_NO_EMPTY);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(split[2] == NULL);
        ok1(tal_count(split) == 3);
        tal_free(split);
 
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(split[2] == NULL);
        ok1(tal_count(split) == 3);
        tal_free(split);
 
-       split = strsplit(NULL, "  hello  world", " ", STR_NO_EMPTY);
+       split = tal_strsplit(NULL, "  hello  world", " ", STR_NO_EMPTY);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(split[2] == NULL);
        ok1(tal_count(split) == 3);
        tal_free(split);
 
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(split[2] == NULL);
        ok1(tal_count(split) == 3);
        tal_free(split);
 
-       split = strsplit(NULL, "hello  world", "o ", STR_EMPTY_OK);
+       split = tal_strsplit(NULL, "hello  world", "o ", STR_EMPTY_OK);
        ok1(!strcmp(split[0], "hell"));
        ok1(!strcmp(split[1], ""));
        ok1(!strcmp(split[2], ""));
        ok1(!strcmp(split[0], "hell"));
        ok1(!strcmp(split[1], ""));
        ok1(!strcmp(split[2], ""));
@@ -47,36 +47,36 @@ int main(int argc, char *argv[])
        ok1(tal_count(split) == 6);
 
        ctx = split;
        ok1(tal_count(split) == 6);
 
        ctx = split;
-       split = strsplit(ctx, "hello  world", "o ", STR_EMPTY_OK);
+       split = tal_strsplit(ctx, "hello  world", "o ", STR_EMPTY_OK);
        ok1(tal_parent(split) == ctx);
        tal_free(ctx);
 
        ok1(tal_parent(split) == ctx);
        tal_free(ctx);
 
-       str = strjoin(NULL, (char **)substrings, ", ", STR_TRAIL);
+       str = tal_strjoin(NULL, (char **)substrings, ", ", STR_TRAIL);
        ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar, "));
        ctx = str;
        ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar, "));
        ctx = str;
-       str = strjoin(ctx, (char **)substrings, "", STR_TRAIL);
+       str = tal_strjoin(ctx, (char **)substrings, "", STR_TRAIL);
        ok1(!strcmp(str, "farbarbazbbazar"));
        ok1(tal_parent(str) == ctx);
        ok1(!strcmp(str, "farbarbazbbazar"));
        ok1(tal_parent(str) == ctx);
-       str = strjoin(ctx, (char **)substrings, ", ", STR_NO_TRAIL);
+       str = tal_strjoin(ctx, (char **)substrings, ", ", STR_NO_TRAIL);
        ok1(tal_parent(str) == ctx);
        ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar"));
        ok1(tal_parent(str) == ctx);
        ok1(!strcmp(str, "far, bar, baz, b, ba, z, ar"));
-       str = strjoin(ctx, (char **)substrings, "", STR_NO_TRAIL);
+       str = tal_strjoin(ctx, (char **)substrings, "", STR_NO_TRAIL);
        ok1(!strcmp(str, "farbarbazbbazar"));
        ok1(tal_parent(str) == ctx);
        tal_free(ctx);
 
        ctx = tal_strdup(NULL, "context");
        /* Pass through NULLs from take. */
        ok1(!strcmp(str, "farbarbazbbazar"));
        ok1(tal_parent(str) == ctx);
        tal_free(ctx);
 
        ctx = tal_strdup(NULL, "context");
        /* Pass through NULLs from take. */
-       ok1(strsplit(NULL, take(NULL), " ", STR_EMPTY_OK) == NULL);
-       ok1(strsplit(NULL, "foo", take(NULL), STR_EMPTY_OK) == NULL);
+       ok1(tal_strsplit(NULL, take(NULL), " ", STR_EMPTY_OK) == NULL);
+       ok1(tal_strsplit(NULL, "foo", take(NULL), STR_EMPTY_OK) == NULL);
 
 
-       /* strsplit take string.  It reallocs it to same size, but
+       /* tal_strsplit take string.  It reallocs it to same size, but
         * that sometimes causes a move, so we can't directly check
         * that split[0] == str. */
        str = tal_strdup(ctx, "hello world");
        ok1(tal_check(ctx, NULL));
        ok1(tal_check(str, NULL));
         * that sometimes causes a move, so we can't directly check
         * that split[0] == str. */
        str = tal_strdup(ctx, "hello world");
        ok1(tal_check(ctx, NULL));
        ok1(tal_check(str, NULL));
-       split = strsplit(ctx, take(str), " ", STR_EMPTY_OK);
+       split = tal_strsplit(ctx, take(str), " ", STR_EMPTY_OK);
        ok1(tal_parent(split) == ctx);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(tal_parent(split) == ctx);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
@@ -87,9 +87,9 @@ int main(int argc, char *argv[])
        /* Previous free should get rid of str */
        ok1(!tal_first(ctx));
 
        /* Previous free should get rid of str */
        ok1(!tal_first(ctx));
 
-       /* strsplit take delims */
+       /* tal_strsplit take delims */
        str = tal_strdup(ctx, " ");
        str = tal_strdup(ctx, " ");
-       split = strsplit(ctx, "hello world", take(str), STR_EMPTY_OK);
+       split = tal_strsplit(ctx, "hello world", take(str), STR_EMPTY_OK);
        ok1(tal_parent(split) == ctx);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(tal_parent(split) == ctx);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
@@ -100,9 +100,9 @@ int main(int argc, char *argv[])
        /* str is gone... */
        ok1(!tal_first(ctx));
 
        /* str is gone... */
        ok1(!tal_first(ctx));
 
-       /* strsplit takes both. */
-       split = strsplit(ctx, take(tal_strdup(NULL, "hello world")),
-                        take(tal_strdup(NULL, " ")), STR_EMPTY_OK);
+       /* tal_strsplit takes both. */
+       split = tal_strsplit(ctx, take(tal_strdup(NULL, "hello world")),
+                            take(tal_strdup(NULL, " ")), STR_EMPTY_OK);
        ok1(tal_parent(split) == ctx);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
        ok1(tal_parent(split) == ctx);
        ok1(!strcmp(split[0], "hello"));
        ok1(!strcmp(split[1], "world"));
@@ -113,15 +113,15 @@ int main(int argc, char *argv[])
        /* temp allocs are gone... */
        ok1(!tal_first(ctx));
 
        /* temp allocs are gone... */
        ok1(!tal_first(ctx));
 
-       /* strjoin passthrough taken NULLs OK. */
-       ok1(strjoin(ctx, take(NULL), "", STR_TRAIL) == NULL);
-       ok1(strjoin(ctx, take(NULL), "", STR_NO_TRAIL) == NULL);
-       ok1(strjoin(ctx, split, take(NULL), STR_TRAIL) == NULL);
-       ok1(strjoin(ctx, split, take(NULL), STR_NO_TRAIL) == NULL);
+       /* tal_strjoin passthrough taken NULLs OK. */
+       ok1(tal_strjoin(ctx, take(NULL), "", STR_TRAIL) == NULL);
+       ok1(tal_strjoin(ctx, take(NULL), "", STR_NO_TRAIL) == NULL);
+       ok1(tal_strjoin(ctx, split, take(NULL), STR_TRAIL) == NULL);
+       ok1(tal_strjoin(ctx, split, take(NULL), STR_NO_TRAIL) == NULL);
 
 
-       /* strjoin take strings[] */
-       split = strsplit(ctx, "hello world", " ", STR_EMPTY_OK);
-       str = strjoin(ctx, take(split), " there ", STR_NO_TRAIL);
+       /* tal_strjoin take strings[] */
+       split = tal_strsplit(ctx, "hello world", " ", STR_EMPTY_OK);
+       str = tal_strjoin(ctx, take(split), " there ", STR_NO_TRAIL);
        ok1(!strcmp(str, "hello there world"));
        ok1(tal_parent(str) == ctx);
        /* split is gone... */
        ok1(!strcmp(str, "hello there world"));
        ok1(tal_parent(str) == ctx);
        /* split is gone... */
@@ -129,10 +129,10 @@ int main(int argc, char *argv[])
        tal_free(str);
        ok1(!tal_first(ctx));
 
        tal_free(str);
        ok1(!tal_first(ctx));
 
-       /* strjoin take delim */
-       split = strsplit(ctx, "hello world", " ", STR_EMPTY_OK);
-       str = strjoin(ctx, split, take(tal_strdup(ctx, " there ")),
-                     STR_NO_TRAIL);
+       /* tal_strjoin take delim */
+       split = tal_strsplit(ctx, "hello world", " ", STR_EMPTY_OK);
+       str = tal_strjoin(ctx, split, take(tal_strdup(ctx, " there ")),
+                         STR_NO_TRAIL);
        ok1(!strcmp(str, "hello there world"));
        ok1(tal_parent(str) == ctx);
        tal_free(split);
        ok1(!strcmp(str, "hello there world"));
        ok1(tal_parent(str) == ctx);
        tal_free(split);
@@ -141,10 +141,10 @@ int main(int argc, char *argv[])
        tal_free(str);
        ok1(!tal_first(ctx));
 
        tal_free(str);
        ok1(!tal_first(ctx));
 
-       /* strjoin take both. */
-       str = strjoin(ctx, take(strsplit(ctx, "hello world", " ",
-                                          STR_EMPTY_OK)),
-                     take(tal_strdup(ctx, " there ")), STR_NO_TRAIL);
+       /* tal_strjoin take both. */
+       str = tal_strjoin(ctx, take(tal_strsplit(ctx, "hello world", " ",
+                                                STR_EMPTY_OK)),
+                         take(tal_strdup(ctx, " there ")), STR_NO_TRAIL);
        ok1(!strcmp(str, "hello there world"));
        ok1(tal_parent(str) == ctx);
        /* tmp allocs are gone, str is only remainder. */
        ok1(!strcmp(str, "hello there world"));
        ok1(tal_parent(str) == ctx);
        /* tmp allocs are gone, str is only remainder. */