[kaffe] CVS kaffe (robilad): Dynamically allocate memory when parsing strings

Kaffe CVS cvs-commits at kaffe.org
Mon Oct 11 14:40:56 PDT 2004


PatchSet 5268 
Date: 2004/10/11 21:36:48
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Dynamically allocate memory when parsing strings

2004-10-11  Noa Resare  <noa at resare.com>

        * libraries/clib/native/double.c:
        Use dynamic allocation when parsing.

Members: 
	ChangeLog:1.2820->1.2821 
	libraries/clib/native/Double.c:1.22->1.23 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2820 kaffe/ChangeLog:1.2821
--- kaffe/ChangeLog:1.2820	Mon Oct 11 20:55:57 2004
+++ kaffe/ChangeLog	Mon Oct 11 21:36:48 2004
@@ -1,3 +1,8 @@
+2004-10-11  Noa Resare  <noa at resare.com>
+
+	* libraries/clib/native/double.c:
+	Use dynamic allocation when parsing.
+
 2004-10-11  Dalibor Topic <robilad at kaffe.org>
 
 	* THIRDPARTY: Added notice for inet_pton and inet_ntop
Index: kaffe/libraries/clib/native/Double.c
diff -u kaffe/libraries/clib/native/Double.c:1.22 kaffe/libraries/clib/native/Double.c:1.23
--- kaffe/libraries/clib/native/Double.c:1.22	Fri May 21 15:19:24 2004
+++ kaffe/libraries/clib/native/Double.c	Mon Oct 11 21:36:51 2004
@@ -219,15 +219,18 @@
 double
 java_lang_Double_valueOf0(struct Hjava_lang_String* str)
 {
-	char buf0[MAXNUMLEN];
+	char *buf0;
+	double val;
 
-	/* stringJava2CBuf would silently promote 0 to an empty string */
+	/* stringJava2C would silently promote 0 to an empty string */
 	if (str == 0) {
 		SignalError("java.lang.NullPointerException", "");
 	}
-	stringJava2CBuf(str, buf0, sizeof(buf0));
+	buf0 = stringJava2C(str);
 
-	return valueOfCharArray(buf0);
+	val = valueOfCharArray(buf0);
+	gc_free(buf0);
+	return val;
 }
 
 /*




More information about the kaffe mailing list