diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-20 14:29:00 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-20 14:29:00 +0000 |
commit | 5cc761a37a6d7471460042787dcab0f63173c9f2 (patch) | |
tree | 0a36ac2cbf0467d1253ad0c8c2df7de1c42a5883 /util.c | |
parent | f225d96a36c6efbccb62e7db04bdcea3b1c963c1 (diff) | |
download | ruby-5cc761a37a6d7471460042787dcab0f63173c9f2.tar.gz ruby-5cc761a37a6d7471460042787dcab0f63173c9f2.tar.xz ruby-5cc761a37a6d7471460042787dcab0f63173c9f2.zip |
* util.c (rv_alloc, freedtoa): use our normal xmalloc()/xfree() because
couldn't free the returned pointer from ruby_dtoa().
* missing/vsnprintf.c (cvt): receive buffer and use/return it instead
of returning the pointer returned from BSD__dtoa().
* missing/vsnprintf.c (BSD_vfprintf): pass buf to cvt() as the buffer.
[ruby-core:22184]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -3058,20 +3058,11 @@ static char *dtoa_result; static char * rv_alloc(int i) { - int j, k, *r; - - j = sizeof(ULong); - for (k = 0; - sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i; - j <<= 1) - k++; - r = (int*)Balloc(k); - *r = k; return #ifndef MULTIPLE_THREADS dtoa_result = #endif - (char *)(r+1); + xmalloc(i); } static char * @@ -3096,9 +3087,7 @@ nrv_alloc(const char *s, char **rve, int n) static void freedtoa(char *s) { - Bigint *b = (Bigint *)((int *)s - 1); - b->maxwds = 1 << (b->k = *(int*)b); - Bfree(b); + xfree(s); } #endif |