From: Michihiro NAKAJIMA Date: Fri, 8 Apr 2011 08:59:20 +0000 (-0400) Subject: Use of archive_strcat() in archive_string_append_from_wcs_to_mbs() is slightly ineffi... X-Git-Tag: v3.0.0a~505 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c20be08d759b8aeb38150fde697ee06bcf93458d;p=thirdparty%2Flibarchive.git Use of archive_strcat() in archive_string_append_from_wcs_to_mbs() is slightly inefficient. We can trust a contents of buffer, so we should use archive_string_append() instead. SVN-Revision: 3181 --- diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 672337596..3e433ff5d 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -491,8 +491,7 @@ archive_string_append_from_wcs_to_mbs(struct archive *a, /* Flush the buffer when we have <=16 bytes free. */ /* (No encoding has a single character >16 bytes.) */ if ((size_t)(p - buff) >= (size_t)(sizeof(buff) - MB_CUR_MAX)) { - *p = '\0'; - archive_strcat(as, buff); + archive_string_append(as, buff, p - buff); p = buff; } #if HAVE_WCRTOMB @@ -504,8 +503,7 @@ archive_string_append_from_wcs_to_mbs(struct archive *a, return (-1); p += n; } - *p = '\0'; - archive_strcat(as, buff); + archive_string_append(as, buff, p - buff); return (0); }