[kaffe] CVS kaffe (robilad): Small warning fix on powerpc-linux

Kaffe CVS cvs-commits at kaffe.org
Sun Feb 6 07:02:28 PST 2005


PatchSet 5480 
Date: 2005/02/06 14:57:46
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Small warning fix on powerpc-linux

2005-02-06  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/kaffevm/jni/jni-base.c (KaffeJNI_ParseUserProperty):
        Factored out of KaffeJNI_ParseArgs to fix compiler warning,
        and simplify code a bit. Added comments.

Members: 
	ChangeLog:1.3526->1.3527 
	kaffe/kaffevm/jni/jni-base.c:1.13->1.14 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3526 kaffe/ChangeLog:1.3527
--- kaffe/ChangeLog:1.3526	Sun Feb  6 13:51:27 2005
+++ kaffe/ChangeLog	Sun Feb  6 14:57:46 2005
@@ -1,5 +1,11 @@
 2005-02-06  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/jni/jni-base.c (KaffeJNI_ParseUserProperty):
+	Factored out of KaffeJNI_ParseArgs to fix compiler warning,
+	and simplify code a bit. Added comments.
+
+2005-02-06  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/intrp/machine.c
 	(getEngine): ANSI-fied prototype.
 
Index: kaffe/kaffe/kaffevm/jni/jni-base.c
diff -u kaffe/kaffe/kaffevm/jni/jni-base.c:1.13 kaffe/kaffe/kaffevm/jni/jni-base.c:1.14
--- kaffe/kaffe/kaffevm/jni/jni-base.c:1.13	Sun Jan 30 18:21:41 2005
+++ kaffe/kaffe/kaffevm/jni/jni-base.c	Sun Feb  6 14:57:50 2005
@@ -5,7 +5,7 @@
  * Copyright (c) 1996, 1997, 2004
  *	Transvirtual Technologies, Inc.  All rights reserved.
  *
- * Copyright (c) 2004
+ * Copyright (c) 2004, 2005
  *      The Kaffe.org's developers. See ChangeLog for details.
  *
  * See the file "license.terms" for information on usage and redistribution 
@@ -100,6 +100,54 @@
 	return (sz);
 }
 
+/**
+ * Parse a property set by the user. 
+ * Users can set properties with the -D switch. 
+ * 
+ * This function modifies the global variable userProperties.
+ *
+ * @param opt the option string to parse
+ */ 
+static 
+void
+KaffeJNI_ParseUserProperty(char * opt)
+{
+  userProperty *prop; 
+  unsigned int sz;
+  char *internalOpt;
+
+  /* Allocate a new property. */
+  prop = (userProperty *)malloc(sizeof(userProperty)); 
+  assert (prop != NULL);
+
+  /* Skip '-D' in the option string. */
+  internalOpt = strdup(&opt[2]);
+
+  /* Insert new property at head of the user properties list. */
+  prop->next = userProperties;
+  userProperties = prop;
+
+  /* Search for '=' to find out whether the property is
+   * assigned a value.
+   */
+  for (sz = 0; internalOpt[sz] != 0; sz++)
+    {
+      if (internalOpt[sz] == '=')
+	{
+	  /* Split the property string into property 
+	   * name and value.
+	   */
+	  internalOpt[sz] = '\0';
+	  sz++;
+	  break;
+	}
+    }
+
+  /* Initialize new property with name and value. */
+  prop->key = internalOpt;
+  prop->value = &internalOpt[sz];
+}
+
 static jint
 KaffeJNI_ParseArgs(KaffeVM_Arguments *args, JavaVMOption *options, jint nOptions)
 {
@@ -138,26 +186,7 @@
 	args->verifyMode = 0;
       else if (!strncmp(opt, "-D", 2))
 	{
-	  userProperty *prop = (userProperty *)malloc(sizeof(userProperty)); 
-	  int sz;
-	  char *internalOpt = strdup(&opt[2]);
-
-	  assert (prop != 0);
-
-	  prop->next = userProperties;
-	  userProperties = prop;
-
-	  for (sz = 0; internalOpt[sz] != 0; sz++)
-	    {
-	      if (internalOpt[sz] == '=')
-		{
-		  internalOpt[sz] = 0;
-		  sz++;
-		  break;
-		}
-	    }
-	  prop->key = internalOpt;
-	  prop->value = &internalOpt[sz];
+	  KaffeJNI_ParseUserProperty(opt);
 	}
       else if (!strncmp(opt, "-Xbootclasspath:", 16))
         {




More information about the kaffe mailing list