ruby-changes:11577
From: yugui <ko1@a...>
Date: Sun, 19 Apr 2009 22:33:43 +0900 (JST)
Subject: [ruby-changes:11577] Ruby:r23213 (ruby_1_9_1): merges r22919 from trunk into ruby_1_9_1.
yugui 2009-04-19 22:32:41 +0900 (Sun, 19 Apr 2009) New Revision: 23213 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23213 Log: merges r22919 from trunk into ruby_1_9_1. -- * util.c (rv_strdup): macro to duplicate nul-terminated string. [ruby-core:22852] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/util.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23212) +++ ruby_1_9_1/ChangeLog (revision 23213) @@ -1,3 +1,8 @@ +Fri Mar 13 08:06:48 2009 Nobuyoshi Nakada <nobu@r...> + + * util.c (rv_strdup): macro to duplicate nul-terminated string. + [ruby-core:22852] + Thu Mar 12 22:14:01 2009 Tanaka Akira <akr@f...> * ext/openssl/ossl_ssl.c (ossl_ssl_def_const): use INT2NUM because Index: ruby_1_9_1/util.c =================================================================== --- ruby_1_9_1/util.c (revision 23212) +++ ruby_1_9_1/util.c (revision 23213) @@ -3063,15 +3063,15 @@ static char *dtoa_result; #endif +#ifndef MULTIPLE_THREADS static char * rv_alloc(int i) { - return -#ifndef MULTIPLE_THREADS - dtoa_result = + return dtoa_result = xmalloc(i); +} +#else +#define rv_alloc(i) xmalloc(i) #endif - xmalloc(i); -} static char * nrv_alloc(const char *s, char **rve, int n) @@ -3085,6 +3085,8 @@ return rv; } +#define rv_strdup(s, rve) nrv_alloc(s, rve, strlen(s)+1) + #ifndef MULTIPLE_THREADS /* freedtoa(s) must be used to free values s returned by dtoa * when MULTIPLE_THREADS is #defined. It should be used in all cases, @@ -3217,9 +3219,9 @@ *decpt = 9999; #ifdef IEEE_Arith if (!word1(d) && !(word0(d) & 0xfffff)) - return nrv_alloc("Infinity", rve, 8); + return rv_strdup("Infinity", rve); #endif - return nrv_alloc("NaN", rve, 3); + return rv_strdup("NaN", rve); } #endif #ifdef IBM @@ -3227,7 +3229,7 @@ #endif if (!dval(d)) { *decpt = 1; - return nrv_alloc("0", rve, 1); + return rv_strdup("0", rve); } #ifdef SET_INEXACT -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/