axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r518965 - /webservices/axis2/trunk/c/util/src/string.c
Date Fri, 16 Mar 2007 13:16:47 GMT
Author: samisa
Date: Fri Mar 16 06:16:46 2007
New Revision: 518965

URL: http://svn.apache.org/viewvc?view=rev&rev=518965
Log:
Applied patch supplied in AXIS2C-502

Modified:
    webservices/axis2/trunk/c/util/src/string.c

Modified: webservices/axis2/trunk/c/util/src/string.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/string.c?view=diff&rev=518965&r1=518964&r2=518965
==============================================================================
--- webservices/axis2/trunk/c/util/src/string.c (original)
+++ webservices/axis2/trunk/c/util/src/string.c Fri Mar 16 06:16:46 2007
@@ -400,6 +400,8 @@
 {
     axis2_char_t *ret = NULL;
     int alloc_len = -1;
+	int len1 = 0;
+	int len2 = 0;
 
     if (NULL == s1 && NULL == s2)
     {
@@ -413,13 +415,16 @@
     {
         return (axis2_char_t*)AXIS2_STRDUP(s1, env);
     }
-    alloc_len = axis2_strlen(s1) + axis2_strlen(s2) + 1;
+
+	len1 = axis2_strlen(s1);
+	len2 = axis2_strlen(s2);
+    alloc_len = len1 + len2 + 1;
     ret = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
             alloc_len * sizeof(axis2_char_t));
-    memcpy(ret, s1, axis2_strlen(s1)*sizeof(axis2_char_t));
-    memcpy((ret + axis2_strlen(s1)*sizeof(axis2_char_t)), s2,
-            axis2_strlen(s2)*sizeof(axis2_char_t));
-    ret[alloc_len*sizeof(axis2_char_t) - sizeof(axis2_char_t)] = '\0';
+    memcpy(ret, s1, len1 * sizeof(axis2_char_t));
+    memcpy((ret + len1 * sizeof(axis2_char_t)), s2,
+            len2 * sizeof(axis2_char_t));
+    ret[alloc_len * sizeof(axis2_char_t) - sizeof(axis2_char_t)] = '\0';
     return ret;
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message