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

ruby-changes:50123

From: nobu <ko1@a...>
Date: Tue, 6 Feb 2018 10:42:43 +0900 (JST)
Subject: [ruby-changes:50123] nobu:r62241 (trunk): mjit.c: use ruby_strdup as get_string

nobu	2018-02-06 10:42:37 +0900 (Tue, 06 Feb 2018)

  New Revision: 62241

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

  Log:
    mjit.c: use ruby_strdup as get_string

  Modified files:
    trunk/common.mk
    trunk/mjit.c
Index: common.mk
===================================================================
--- common.mk	(revision 62240)
+++ common.mk	(revision 62241)
@@ -2010,6 +2010,7 @@ mjit.$(OBJEXT): $(top_srcdir)/revision.h https://github.com/ruby/ruby/blob/trunk/common.mk#L2010
 mjit.$(OBJEXT): {$(VPATH)}mjit.c
 mjit.$(OBJEXT): {$(VPATH)}mjit.h
 mjit.$(OBJEXT): {$(VPATH)}ruby_assert.h
+mjit.$(OBJEXT): {$(VPATH)}util.h
 mjit.$(OBJEXT): {$(VPATH)}version.h
 mjit.$(OBJEXT): {$(VPATH)}vm_core.h
 mjit_compile.$(OBJEXT): {$(VPATH)}insns.inc
Index: mjit.c
===================================================================
--- mjit.c	(revision 62240)
+++ mjit.c	(revision 62241)
@@ -81,6 +81,7 @@ https://github.com/ruby/ruby/blob/trunk/mjit.c#L81
 #include "constant.h"
 #include "id_table.h"
 #include "ruby_assert.h"
+#include "ruby/util.h"
 
 #ifdef _WIN32
 #include <winsock2.h>
@@ -221,15 +222,7 @@ real_ms_time(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L222
 
 /* Make and return copy of STR in the heap.  Return NULL in case of a
    failure.  */
-static char *
-get_string(const char *str)
-{
-    char *res;
-
-    if ((res = xmalloc(strlen(str) + 1)) != NULL)
-        strcpy(res, str);
-    return res;
-}
+#define get_string ruby_strdup
 
 static void
 sprint_uniq_filename(char *str, unsigned long id, const char *prefix, const char *suffix)

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

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