[前][次][番号順一覧][スレッド一覧]

ruby-changes:45117

From: nobu <ko1@a...>
Date: Mon, 26 Dec 2016 18:28:54 +0900 (JST)
Subject: [ruby-changes:45117] nobu:r57190 (trunk): get rid of strcat

nobu	2016-12-26 18:28:47 +0900 (Mon, 26 Dec 2016)

  New Revision: 57190

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57190

  Log:
    get rid of strcat
    
    * regerror.c (onig_vsnprintf_with_pattern): use memcpy with the
      known length instead of strcat.

  Modified files:
    trunk/regerror.c
Index: regerror.c
===================================================================
--- regerror.c	(revision 57189)
+++ regerror.c	(revision 57190)
@@ -324,7 +324,8 @@ onig_vsnprintf_with_pattern(UChar buf[], https://github.com/ruby/ruby/blob/trunk/regerror.c#L324
   need = (pat_end - pat) * 4 + 4;
 
   if (n + need < (size_t )bufsize) {
-    xstrcat((char* )buf, ": /", bufsize);
+    static const char sep[] = ": /";
+    memcpy((char* )buf + n, sep, sizeof(sep));
     s = buf + onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, buf);
 
     p = pat;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]