r25216: make talloc_append_string() a deprecated macro instead of
authorStefan Metzmacher <metze@samba.org>
Tue, 18 Sep 2007 13:45:43 +0000 (13:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:06:56 +0000 (15:06 -0500)
having it as a real function.

metze

source/lib/talloc/talloc.c
source/lib/talloc/talloc.h

index ea32b3273aa5c037a174766e61fe46f6020dc22f..4d72c0e871a2d190d37a5021aaa40e3e629250bd 100644 (file)
@@ -1132,32 +1132,6 @@ char *talloc_strdup(const void *t, const char *p)
        return __talloc_strlendup(t, p, strlen(p));
 }
 
-/*
- append to a talloced string 
-*/
-char *talloc_append_string(const void *t, char *orig, const char *append)
-{
-       char *ret;
-       size_t olen = strlen(orig);
-       size_t alenz;
-
-       if (!append)
-               return orig;
-
-       alenz = strlen(append) + 1;
-
-       ret = talloc_realloc(t, orig, char, olen + alenz);
-       if (!ret)
-               return NULL;
-
-       /* append the string with the trailing \0 */
-       memcpy(&ret[olen], append, alenz);
-
-       _talloc_set_name_const(ret, ret);
-
-       return ret;
-}
-
 /*
   strndup with a talloc
 */
index 72af4dbfa843b210320038206fc7824724bc1fe1..e1033916817d86b913393824a8a711e30acc6968 100644 (file)
@@ -111,6 +111,7 @@ typedef void TALLOC_CTX;
 #define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count)
 #define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count)
 #define talloc_destroy(ctx) talloc_free(ctx)
+#define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a))
 #endif
 
 /* The following definitions come from talloc.c  */
@@ -178,6 +179,4 @@ char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3)
 char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
 char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
 
-char *talloc_append_string(const void *t, char *orig, const char *append);
-
 #endif