[augeas-devel] [PATCH] strcat => stpcpy change (put.c)

James Antill james.antill at redhat.com
Wed May 21 18:20:35 UTC 2008


# HG changeset patch
# User james at and.org
# Date 1211393372 14400
# Node ID 80b93f8f9ee17f64e489a2395dcad283d39de4e3
# Parent  3501e5535b70717230a15d4f219d2dbb7bca247e
 Remove strcat's for stpcpy's

diff --git a/src/put.c b/src/put.c
--- a/src/put.c
+++ b/src/put.c
@@ -110,14 +110,15 @@
             split->end += strlen(t->label);
         split->end += 1;
     }
-    char *l;
-    CALLOC(l, split->end + 1);
+    char *labels;
+    CALLOC(labels, split->end + 1);
+    char *l = labels;
     for (struct tree *t = tree; t != NULL; t = t->next) {
         if (t->label != NULL)
-            strcat(l, t->label);
-        strcat(l, "/");
+            l = stpcpy(l, t->label);
+        l = stpcpy(l, "/");
     }
-    split->labels = l;
+    split->labels = labels;
     return split;
 }
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080521/2bdb6733/attachment.sig>


More information about the augeas-devel mailing list