svn commit: samba r25214 - in branches/SAMBA_4_0/source/scripting/ejs: .

metze at samba.org metze at samba.org
Tue Sep 18 13:33:44 GMT 2007


Author: metze
Date: 2007-09-18 13:33:44 +0000 (Tue, 18 Sep 2007)
New Revision: 25214

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25214

Log:
use talloc_strndup_append() instead of talloc_append_string()
and ugly hacks to handle the string termination.

metze
Modified:
   branches/SAMBA_4_0/source/scripting/ejs/literal.c


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/ejs/literal.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/literal.c	2007-09-18 13:31:55 UTC (rev 25213)
+++ branches/SAMBA_4_0/source/scripting/ejs/literal.c	2007-09-18 13:33:44 UTC (rev 25214)
@@ -132,27 +132,11 @@
                            char *append,
                            int size)
 {
-    char c;
-    char *end_p = append + size;
-    void *ret;
+	if (!orig) {
+		return talloc_strndup(ctx, append, size);
+	}
 
-    /*
-     * We need to null terminate the string to be copied.  Save character at
-     * the size limit of the source string.
-     */
-    c = *end_p;
-
-    /* Temporarily null-terminate it */
-    *end_p = '\0';
-
-    /* Append the requested data */
-    ret = talloc_append_string(ctx, orig, append);
-    
-    /* Restore the original character in place of our temporary null byte */
-    *end_p = c;
-
-    /* Give 'em what they came for */
-    return ret;
+	return talloc_strndup_append(orig, append, size);
 }
 
 



More information about the samba-cvs mailing list