[kaffe] CVS kaffe (doogie): Sparse NULL-constant fixes.

Kaffe CVS cvs-commits at kaffe.org
Sun Dec 19 20:01:51 PST 2004


PatchSet 5679 
Date: 2004/12/20 03:40:05
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Sparse NULL-constant fixes.

Members: 
	kaffe/kaffevm/jit/seq.c:1.4->1.5 
	libraries/clib/io/File.c:1.24->1.25 
	libraries/clib/management/Debug.c:1.7->1.8 
	libraries/clib/math/BigInteger.c:1.24->1.25 
	libraries/clib/native/AccessController.c:1.2->1.3 
	libraries/clib/native/Arrays.c:1.6->1.7 
	libraries/clib/native/ByteToCharIconv.c:1.10->1.11 
	libraries/clib/native/CharToByteIconv.c:1.8->1.9 
	libraries/clib/native/Class.c:1.75->1.76 
	libraries/clib/native/Method.c:1.38->1.39 
	libraries/clib/native/PrimordialClassLoader.c:1.3->1.4 
	libraries/clib/native/Runtime.c:1.28->1.29 
	libraries/clib/native/System.c:1.61->1.62 
	libraries/clib/native/ThreadStack.c:1.4->1.5 
	libraries/clib/native/Throwable.c:1.10->1.11 
	libraries/clib/native/ZipFile.c:1.23->1.24 
	libraries/clib/net/InetAddressImpl.c:1.27->1.28 
	libraries/clib/net/NetworkInterface.c:1.11->1.12 
	libraries/clib/net/PlainDatagramSocketImpl.c:1.49->1.50 
	libraries/clib/net/PlainSocketImpl.c:1.50->1.51 
	libraries/clib/nio/java_nio_VMDirectByteBuffer.c:1.2->1.3 
	libraries/clib/zip/Deflater.c:1.15->1.16 
	libraries/clib/zip/Inflater.c:1.14->1.15 
	ChangeLog:1.3225->1.3226 
	ChangeLog:1.3224->1.3225 
	libltdl/ltdl.c:1.38->1.39 

Index: kaffe/kaffe/kaffevm/jit/seq.c
diff -u kaffe/kaffe/kaffevm/jit/seq.c:1.4 kaffe/kaffe/kaffevm/jit/seq.c:1.5
--- kaffe/kaffe/kaffevm/jit/seq.c:1.4	Tue Jul  6 17:16:21 2004
+++ kaffe/kaffe/kaffevm/jit/seq.c	Mon Dec 20 03:40:05 2004
@@ -47,7 +47,7 @@
 			ALLOCSEQNR * sizeof(sequence));
 
 		/* Attach to current chain */
-		if (lastSeq == 0) {
+		if (lastSeq == NULL) {
 			firstSeq = ret;
 		}
 		else {
@@ -59,7 +59,7 @@
 		for (i = 0; i < ALLOCSEQNR-1; i++) {
 			ret[i].next = &ret[i+1];
 		}
-		ret[ALLOCSEQNR-1].next = 0;
+		ret[ALLOCSEQNR-1].next = NULL;
 	}
 	currSeq = ret->next;
 	return (ret);
Index: kaffe/libraries/clib/io/File.c
diff -u kaffe/libraries/clib/io/File.c:1.24 kaffe/libraries/clib/io/File.c:1.25
--- kaffe/libraries/clib/io/File.c:1.24	Fri May 28 13:40:12 2004
+++ kaffe/libraries/clib/io/File.c	Mon Dec 20 03:40:01 2004
@@ -220,13 +220,13 @@
   /* XXX make part of jsyscall interface !? */
   dir = opendir(path);
   if (dir == 0) {
-    return (0);
+    return (NULL);
   }
   
-  dirlist = 0;
+  dirlist = NULL;
   count = 0;
   /* XXX make part of jsyscall interface !? */
-  while ((entry = readdir(dir)) != 0) {
+  while ((entry = readdir(dir)) != NULL) {
     /* We skip '.' and '..' */
     if (strcmp(".", entry->d_name) == 0 ||
 	strcmp("..", entry->d_name) == 0) {
@@ -253,10 +253,10 @@
   closedir(dir);
   
   array = (HArrayOfObject*)AllocObjectArray(count,
-					    "Ljava/lang/String;", 0);
+					    "Ljava/lang/String;", NULL);
   /* XXX: This assert is a noop.  If AllocObjectArray throws an
      exception, we leak. */
-  assert(array != 0);
+  assert(array != NULL);
   for (i = 0; i < count; i++) {
     mentry = dirlist;
     dirlist = mentry->next;
Index: kaffe/libraries/clib/management/Debug.c
diff -u kaffe/libraries/clib/management/Debug.c:1.7 kaffe/libraries/clib/management/Debug.c:1.8
--- kaffe/libraries/clib/management/Debug.c:1.7	Sat Dec 11 04:01:02 2004
+++ kaffe/libraries/clib/management/Debug.c	Mon Dec 20 03:40:02 2004
@@ -9,7 +9,7 @@
 Java_kaffe_management_Debug_enable
 	(JNIEnv *env, jclass thisClass UNUSED, jobject list)
 {
-	const char *real_list = (*env)->GetStringUTFChars(env, list, 0);
+	const char *real_list = (*env)->GetStringUTFChars(env, list, NULL);
 	/* do we always have alloca? */
 	char *copy = alloca(strlen(real_list) + 1);
 
@@ -48,7 +48,7 @@
 	static char *curStats;	/* kaffe expects this string to be
 				 * around at exit.
 				 */
-	const char *real_list = (*env)->GetStringUTFChars(env, list, 0);
+	const char *real_list = (*env)->GetStringUTFChars(env, list, NULL);
 
 	if (curStats) jfree(curStats);
 	curStats = jmalloc(strlen(real_list) + 1);
Index: kaffe/libraries/clib/math/BigInteger.c
diff -u kaffe/libraries/clib/math/BigInteger.c:1.24 kaffe/libraries/clib/math/BigInteger.c:1.25
--- kaffe/libraries/clib/math/BigInteger.c:1.24	Fri Dec 10 20:54:40 2004
+++ kaffe/libraries/clib/math/BigInteger.c	Mon Dec 20 03:40:03 2004
@@ -108,7 +108,7 @@
 	res = (*env)->GetObjectField(env, r, number);
 
 	len = (*env)->GetArrayLength(env, magnitude);
-	data = (*env)->GetByteArrayElements(env, magnitude, 0);
+	data = (*env)->GetByteArrayElements(env, magnitude, NULL);
 
 	/* clear mpz by setting it to zero; do not use mpz_clear here 
 	 * cause that would free its storage which is wrong.
@@ -144,7 +144,7 @@
 	int rc;
 
 	res = (*env)->GetObjectField(env, r, number);
-	str = (*env)->GetStringUTFChars(env, val, 0);
+	str = (*env)->GetStringUTFChars(env, val, NULL);
 
 	rc = mpz_set_str(res, (char*)str, (int)radix);
 
@@ -494,7 +494,7 @@
 
 	src = (mpz_srcptr)(*env)->GetObjectField(env, s, number);
 
-	res = mpz_get_str(0, (int)base, src);
+	res = mpz_get_str(NULL, (int)base, src);
 	str = (*env)->NewStringUTF(env, res);
 	bi_free(res, 0 /* is ignored */);
 
Index: kaffe/libraries/clib/native/AccessController.c
diff -u kaffe/libraries/clib/native/AccessController.c:1.2 kaffe/libraries/clib/native/AccessController.c:1.3
--- kaffe/libraries/clib/native/AccessController.c:1.2	Sat Nov  6 00:44:43 2004
+++ kaffe/libraries/clib/native/AccessController.c	Mon Dec 20 03:40:03 2004
@@ -53,7 +53,7 @@
   HArrayOfObject *meths;
   HArrayOfArray *array;
 
-  info = (stackTraceInfo *) buildStackTrace(0);
+  info = (stackTraceInfo *) buildStackTrace(NULL);
   if (info == NULL)
     {
       postOutOfMemory (&einfo);
@@ -67,9 +67,9 @@
 	cnt++;
     }
 
-  array = (HArrayOfArray *) AllocObjectArray (2, "[Ljava/lang/Object;", 0);
-  classes = (HArrayOfObject *) AllocObjectArray (cnt, "Ljava/lang/Class;", 0);
-  meths = (HArrayOfObject *) AllocObjectArray (cnt, "Ljava/lang/String;", 0);
+  array = (HArrayOfArray *) AllocObjectArray (2, "[Ljava/lang/Object;", NULL);
+  classes = (HArrayOfObject *) AllocObjectArray (cnt, "Ljava/lang/Class;", NULL);
+  meths = (HArrayOfObject *) AllocObjectArray (cnt, "Ljava/lang/String;", NULL);
 
   cnt = 0;
   for (i = 0; info[i].meth != ENDOFSTACK; i++)
Index: kaffe/libraries/clib/native/Arrays.c
diff -u kaffe/libraries/clib/native/Arrays.c:1.6 kaffe/libraries/clib/native/Arrays.c:1.7
--- kaffe/libraries/clib/native/Arrays.c:1.6	Fri Dec 10 00:37:24 2004
+++ kaffe/libraries/clib/native/Arrays.c	Mon Dec 20 03:40:03 2004
@@ -159,7 +159,7 @@
 
 	do_execute_java_method(&rtn, o1->cmp, "compare",
 		"(Ljava/lang/Object;Ljava/lang/Object;)I",
-		0, false, o1->obj, o2->obj);
+		NULL, false, o1->obj, o2->obj);
 	return rtn.i;
 }
 
Index: kaffe/libraries/clib/native/ByteToCharIconv.c
diff -u kaffe/libraries/clib/native/ByteToCharIconv.c:1.10 kaffe/libraries/clib/native/ByteToCharIconv.c:1.11
--- kaffe/libraries/clib/native/ByteToCharIconv.c:1.10	Sun Apr 18 13:57:29 2004
+++ kaffe/libraries/clib/native/ByteToCharIconv.c	Mon Dec 20 03:40:03 2004
@@ -44,7 +44,7 @@
     const jbyte* str;
     iconv_t cd;
 
-    str = (*env)->GetStringUTFChars(env, enc, 0);
+    str = (*env)->GetStringUTFChars(env, enc, NULL);
 #ifdef WORDS_BIGENDIAN
     cd = iconv_open ("UCS-2BE", (char *)str);
 #else
Index: kaffe/libraries/clib/native/CharToByteIconv.c
diff -u kaffe/libraries/clib/native/CharToByteIconv.c:1.8 kaffe/libraries/clib/native/CharToByteIconv.c:1.9
--- kaffe/libraries/clib/native/CharToByteIconv.c:1.8	Sun Apr 18 13:57:29 2004
+++ kaffe/libraries/clib/native/CharToByteIconv.c	Mon Dec 20 03:40:03 2004
@@ -42,7 +42,7 @@
     const jbyte* str;
     iconv_t cd;
 
-    str = (*env)->GetStringUTFChars(env, enc, 0);
+    str = (*env)->GetStringUTFChars(env, enc, NULL);
 #ifdef WORDS_BIGENDIAN
     cd = iconv_open ((char *)str, "UCS-2BE");
 #else
Index: kaffe/libraries/clib/native/Class.c
diff -u kaffe/libraries/clib/native/Class.c:1.75 kaffe/libraries/clib/native/Class.c:1.76
--- kaffe/libraries/clib/native/Class.c:1.75	Sun Dec  5 22:43:29 2004
+++ kaffe/libraries/clib/native/Class.c	Mon Dec 20 03:40:03 2004
@@ -170,7 +170,7 @@
 	}
 #endif
 
-	obj = (HArrayOfObject*)AllocObjectArray(nr, "Ljava/lang/Class;", 0);
+	obj = (HArrayOfObject*)AllocObjectArray(nr, "Ljava/lang/Class;", NULL);
 	ifaces = (struct Hjava_lang_Class**)unhand_array(obj)->body;
 	for (i = 0; i < nr; i++) {
 		ifaces[i] = this->interfaces[i];
@@ -389,21 +389,21 @@
 	int i;
 
 	count = 0;
-	count += countMethods(0, this, declared);
+	count += countMethods(NULL, this, declared);
 	if (!declared) {
 		for (i = 0; i < this->total_interface_len; i++) {
-			count += countMethods(0, this->interfaces[i], declared);
+			count += countMethods(NULL, this->interfaces[i], declared);
 		}
 	}
 
 	array = (HArrayOfObject*)
-	    AllocObjectArray(count, "Ljava/lang/reflect/Method;", 0);
+	    AllocObjectArray(count, "Ljava/lang/reflect/Method;", NULL);
 	ptr = (Hjava_lang_reflect_Method**)&unhand_array(array)->body[0];
 
-	addMethods(0, this, declared, &ptr);
+	addMethods(NULL, this, declared, &ptr);
 	if (!declared) {
 		for (i = 0; i < this->total_interface_len; i++) {
-			addMethods(0, this->interfaces[i], declared, &ptr);
+			addMethods(NULL, this->interfaces[i], declared, &ptr);
 		}
 	}
 
@@ -438,7 +438,7 @@
 		}
 	}
 	array = (HArrayOfObject*)
-	    AllocObjectArray(count, "Ljava/lang/reflect/Method;", 0);
+	    AllocObjectArray(count, "Ljava/lang/reflect/Method;", NULL);
 	ptr = (Hjava_lang_reflect_Method**)&unhand_array(array)->body[0];
 	for (clas = this; clas != NULL; clas = clas->superclass) {
 
@@ -471,7 +471,7 @@
 		}
 	}
 	array = (HArrayOfObject*)
-	   AllocObjectArray(count, "Ljava/lang/reflect/Constructor;", 0);
+	   AllocObjectArray(count, "Ljava/lang/reflect/Constructor;", NULL);
 	ptr = (Hjava_lang_reflect_Constructor**)&unhand_array(array)->body[0];
 	clas = this;
 	mth = CLASS_METHODS(clas);
@@ -560,7 +560,7 @@
 		count = countPublicFields(clazz);
 	}
 	array = (HArrayOfObject*)
-	    AllocObjectArray(count, "Ljava/lang/reflect/Field;", 0);
+	    AllocObjectArray(count, "Ljava/lang/reflect/Field;", NULL);
 	ptr = (Hjava_lang_reflect_Field**)&unhand_array(array)->body[0];
 	makePublicFields(clazz, declared, &ptr);
 
@@ -647,7 +647,7 @@
 				return (KaffeVM_makeReflectMethod(clas, i));
 		}
 	}
-	return (0);
+	return (NULL);
 }
 
 /** 
@@ -745,12 +745,12 @@
 		for (i = 0; i < clazz->total_interface_len; i++) {
 			Hjava_lang_reflect_Field *f;
 			f = checkForField(clazz->interfaces[i], name, declared);
-			if (f != 0) {
+			if (f != NULL) {
 				return (f);
 			}
 		}
 	}
-	return (0);
+	return (NULL);
 }
 
 /* Lookup a field in a class.
@@ -804,14 +804,14 @@
 	}
 
 	array = (HArrayOfObject*)
-		AllocObjectArray(count, "Ljava/lang/Class;", 0);
+		AllocObjectArray(count, "Ljava/lang/Class;", NULL);
 	if (count == 0) {
 		return array;
 	}
 	ptr = (Hjava_lang_Class**)&unhand_array(array)->body[0];
 
 	for (i = clazz->nr_inner_classes, ic = clazz->inner_classes; i-- > 0; ic++) {
-		if (ic->inner_class == 0 || ic->outer_class == 0) {
+		if (ic->inner_class == NULL || ic->outer_class == NULL) {
 			continue;
 		}
 #if 0
Index: kaffe/libraries/clib/native/Method.c
diff -u kaffe/libraries/clib/native/Method.c:1.38 kaffe/libraries/clib/native/Method.c:1.39
--- kaffe/libraries/clib/native/Method.c:1.38	Fri May 21 15:19:24 2004
+++ kaffe/libraries/clib/native/Method.c	Mon Dec 20 03:40:03 2004
@@ -275,7 +275,7 @@
 
 		(*env)->ExceptionClear(env);
 		e = (struct Hjava_lang_Throwable *)execute_java_constructor(
-			"java.lang.reflect.InvocationTargetException", 0, 0,
+			"java.lang.reflect.InvocationTargetException", NULL, NULL,
 			"(Ljava/lang/Throwable;)V", targetexc);
 		throwException(e);
 		assert(!"Not here");
@@ -310,5 +310,5 @@
 		return (ret.l);
 	}
 
-	return (0);
+	return (NULL);
 }
Index: kaffe/libraries/clib/native/PrimordialClassLoader.c
diff -u kaffe/libraries/clib/native/PrimordialClassLoader.c:1.3 kaffe/libraries/clib/native/PrimordialClassLoader.c:1.4
--- kaffe/libraries/clib/native/PrimordialClassLoader.c:1.3	Fri May 21 15:19:24 2004
+++ kaffe/libraries/clib/native/PrimordialClassLoader.c	Mon Dec 20 03:40:03 2004
@@ -34,7 +34,7 @@
 struct Hjava_lang_Class*
 kaffe_lang_PrimordialClassLoader_findClass0(Hkaffe_lang_PrimordialClassLoader* this UNUSED, Hjava_lang_String* jStr)
 {
-	Hjava_lang_Class *clazz = 0;
+	Hjava_lang_Class *clazz = NULL;
 	errorInfo info;
 	int error = 0;
         Utf8Const *c;
@@ -47,11 +47,11 @@
 	{
 		if( c->data[0] == '[' )
 		{
-			clazz = loadArray(c, 0, &info);
+			clazz = loadArray(c, NULL, &info);
 		}
 		else
 		{
-			clazz = loadClass(c, 0, &info);
+			clazz = loadClass(c, NULL, &info);
 		}
 		if( clazz )
 		{
Index: kaffe/libraries/clib/native/Runtime.c
diff -u kaffe/libraries/clib/native/Runtime.c:1.28 kaffe/libraries/clib/native/Runtime.c:1.29
--- kaffe/libraries/clib/native/Runtime.c:1.28	Fri Dec 17 03:38:50 2004
+++ kaffe/libraries/clib/native/Runtime.c	Mon Dec 20 03:40:03 2004
@@ -43,7 +43,7 @@
 		HArrayOfObject* argv, HArrayOfObject* arge, Hjava_io_File* dir)
 {
 	return (struct Hjava_lang_Process*)execute_java_constructor(
-	    "kaffe.lang.UNIXProcess", 0, 0,
+	    "kaffe.lang.UNIXProcess", NULL, NULL,
 	    "([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)V",
 	    argv, arge, dir);
 }
Index: kaffe/libraries/clib/native/System.c
diff -u kaffe/libraries/clib/native/System.c:1.61 kaffe/libraries/clib/native/System.c:1.62
--- kaffe/libraries/clib/native/System.c:1.61	Wed Dec  8 07:22:12 2004
+++ kaffe/libraries/clib/native/System.c	Mon Dec 20 03:40:03 2004
@@ -149,7 +149,7 @@
 	} else {
 		dprintf("%s\n", cname);
 	}
-	printStackTrace(t, 0, 1);
+	printStackTrace(t, NULL, 1);
 }
 
 void
Index: kaffe/libraries/clib/native/ThreadStack.c
diff -u kaffe/libraries/clib/native/ThreadStack.c:1.4 kaffe/libraries/clib/native/ThreadStack.c:1.5
--- kaffe/libraries/clib/native/ThreadStack.c:1.4	Fri May 21 15:19:24 2004
+++ kaffe/libraries/clib/native/ThreadStack.c	Mon Dec 20 03:40:03 2004
@@ -33,7 +33,7 @@
 	int i;
 	HArrayOfObject* array;
 
-	info = (stackTraceInfo*)buildStackTrace(0);
+	info = (stackTraceInfo*)buildStackTrace(NULL);
 	if (info == NULL) {
 		postOutOfMemory(&einfo);
 		throwError(&einfo);
@@ -41,16 +41,16 @@
 
 	cnt = 0;
 	for (i = 0; info[i].meth != ENDOFSTACK; i++) {
-		if (info[i].meth != 0 && info[i].meth->class != 0) {
+		if (info[i].meth != NULL && info[i].meth->class != NULL) {
 			cnt++;
 		}
 	}
 
-	array = (HArrayOfObject*)AllocObjectArray(cnt, "Ljava/lang/Class;", 0);
+	array = (HArrayOfObject*)AllocObjectArray(cnt, "Ljava/lang/Class;", NULL);
 
 	cnt = 0;
 	for (i = 0; info[i].meth != ENDOFSTACK; i++) {
-		if (info[i].meth != 0 && info[i].meth->class != 0) {
+		if (info[i].meth != NULL && info[i].meth->class != NULL) {
 			unhand_array(array)->body[cnt] = (Hjava_lang_Object*)info[i].meth->class;
 			cnt++;
 		}
Index: kaffe/libraries/clib/native/Throwable.c
diff -u kaffe/libraries/clib/native/Throwable.c:1.10 kaffe/libraries/clib/native/Throwable.c:1.11
--- kaffe/libraries/clib/native/Throwable.c:1.10	Mon May 24 17:24:41 2004
+++ kaffe/libraries/clib/native/Throwable.c	Mon Dec 20 03:40:03 2004
@@ -28,7 +28,7 @@
 void
 java_lang_VMThrowable_fillInStackTrace(struct Hjava_lang_VMThrowable* o)
 {
-	unhand(o)->backtrace = buildStackTrace(0);
+	unhand(o)->backtrace = buildStackTrace(NULL);
 	assert(unhand(o)->backtrace != NULL);
 }
 
Index: kaffe/libraries/clib/native/ZipFile.c
diff -u kaffe/libraries/clib/native/ZipFile.c:1.23 kaffe/libraries/clib/native/ZipFile.c:1.24
--- kaffe/libraries/clib/native/ZipFile.c:1.23	Sat Dec 11 20:49:40 2004
+++ kaffe/libraries/clib/native/ZipFile.c	Mon Dec 20 03:40:03 2004
@@ -59,8 +59,8 @@
 	str = checkPtr(stringJava2C(zname));
 	entry = lookupJarFile((jarFile*)zip, str);
 	gc_free(str);
-	if (entry == 0) {
-		return (0);
+	if (entry == NULL) {
+		return (NULL);
 	}
 	zentry = makeZipEntry(entry);
 	return (zentry);
@@ -71,7 +71,7 @@
 {
 	jarEntry entry;
 	HArrayOfByte* array;
-	uint8* buf = 0;
+	uint8* buf = NULL;
 	jlong size;
 
 	size = unhand(zentry)->size;
@@ -81,7 +81,7 @@
         }
 	if( size > 0 )
 	{
-		entry.fileName = '\0';
+		entry.fileName = NULL;
 		entry.uncompressedSize = size;
 		entry.compressionMethod = unhand(zentry)->method;
 		entry.compressedSize = unhand(zentry)->csize;
@@ -89,7 +89,7 @@
 		
 		buf = getDataJarFile((jarFile*)zip, &entry);
 		if (buf == 0) {
-			return (0);
+			return (NULL);
 		}
 	}
 	array = (HArrayOfByte*)AllocArray((jsize)size, TYPE_Byte);
@@ -113,7 +113,7 @@
 
 	zfile = (jarFile*)zip;
 	vec = (Hjava_util_Vector*)execute_java_constructor("java.util.Vector",
-	    0, 0, "(I)V", zfile->count);
+	    NULL, NULL, "(I)V", zfile->count);
 	elems = unhand_array(unhand(vec)->elementData)->body;
 	for (j = 0; j < zfile->tableSize; j++) {
 		entry = zfile->table[j];
@@ -136,14 +136,14 @@
 	Hjava_util_zip_ZipEntry* zentry;
 
 	zentry = (Hjava_util_zip_ZipEntry*)
-	    execute_java_constructor("java.util.zip.ZipEntry", 0, 0, "()V");
+	    execute_java_constructor("java.util.zip.ZipEntry", NULL, NULL, "()V");
 	unhand(zentry)->name =
 	    checkPtr(stringC2Java(entry->fileName));
 	unhand(zentry)->crc = 0;
 	unhand(zentry)->size = entry->uncompressedSize;
 	unhand(zentry)->method = entry->compressionMethod;
-	unhand(zentry)->extra = 0;
-	unhand(zentry)->comment = 0;
+	unhand(zentry)->extra = NULL;
+	unhand(zentry)->comment = NULL;
 	unhand(zentry)->flag = 0;
 	unhand(zentry)->version = 0;
 	unhand(zentry)->csize = entry->compressedSize;
Index: kaffe/libraries/clib/net/InetAddressImpl.c
diff -u kaffe/libraries/clib/net/InetAddressImpl.c:1.27 kaffe/libraries/clib/net/InetAddressImpl.c:1.28
--- kaffe/libraries/clib/net/InetAddressImpl.c:1.27	Thu Dec 16 06:13:55 2004
+++ kaffe/libraries/clib/net/InetAddressImpl.c	Mon Dec 20 03:40:03 2004
@@ -74,7 +74,7 @@
 HArrayOfByte*
 java_net_InetAddress_lookupInaddrAny(void)
 {
-  HArrayOfByte* addr = 0;
+  HArrayOfByte* addr = NULL;
   errorInfo einfo;
 
   addr = (HArrayOfByte *)newArrayChecked(TYPE_CLASS(TYPE_Byte),
@@ -102,7 +102,7 @@
   static char hostname[HOSTNMSZ] = "localhost";
   static iStaticLock	hostLock;
 	
-  struct Hjava_lang_String *retval = 0;
+  struct Hjava_lang_String *retval = NULL;
   int iLockRoot;
 	
   lockStaticMutex(&hostLock);
@@ -129,8 +129,8 @@
 #if defined(HAVE_GETADDRINFO)
   int i = 0, retryCount = 5, rc;
   jsize count = 0;
-  struct addrinfo hints, *ai = 0, *curr;
-  HArrayOfArray *retval = 0;
+  struct addrinfo hints, *ai = NULL, *curr;
+  HArrayOfArray *retval = NULL;
   int iLockRoot;
   errorInfo einfo;
   char *name;
@@ -180,7 +180,7 @@
 	  struct sockaddr_in6 *in6;
 #endif
 	  struct sockaddr_in *in4;
-	  HArrayOfByte *addr = 0;
+	  HArrayOfByte *addr = NULL;
 			
 	  switch( curr->ai_family )
 	    {
@@ -199,7 +199,7 @@
 		}
 	      else
 		{
-		  retval = 0;
+		  retval = NULL;
 		}
 	      break;
 #if defined(PF_INET6)
@@ -218,7 +218,7 @@
 		}
 	      else
 		{
-		  retval = 0;
+		  retval = NULL;
 		}
 	      break;
 #endif
@@ -360,7 +360,7 @@
 		HArrayOfByte *addr)
 {
 #if defined(HAVE_GETADDRINFO)
-  struct Hjava_lang_String *retval = 0;
+  struct Hjava_lang_String *retval = NULL;
 #if defined(AF_INET6)
   struct sockaddr_in6 sa_buf;
   struct sockaddr_in6 *sain6 = &sa_buf;
Index: kaffe/libraries/clib/net/NetworkInterface.c
diff -u kaffe/libraries/clib/net/NetworkInterface.c:1.11 kaffe/libraries/clib/net/NetworkInterface.c:1.12
--- kaffe/libraries/clib/net/NetworkInterface.c:1.11	Sat Dec 11 07:00:52 2004
+++ kaffe/libraries/clib/net/NetworkInterface.c	Mon Dec 20 03:40:04 2004
@@ -116,7 +116,7 @@
     }
   if (address_string) {
     do_execute_java_class_method
-      (&jv, "java/net/InetAddress", 0, "getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;",
+      (&jv, "java/net/InetAddress", NULL, "getByName", "(Ljava/lang/String;)Ljava/net/InetAddress;",
        address_string);
     retval = (struct Hjava_net_InetAddress *)jv.l;
   }
@@ -131,7 +131,7 @@
   struct ifaddrs* ifa; 
 
   vector =
-    (struct Hjava_util_Vector*)execute_java_constructor("java/util/Vector", 0, 0, "()V");
+    (struct Hjava_util_Vector*)execute_java_constructor("java/util/Vector", NULL, NULL, "()V");
   
   ifa = addrs = detectInterfaces();
   while (ifa != NULL)
@@ -149,11 +149,11 @@
 	     vector,
 	     "add",
 	     "(Ljava/lang/Object;)Z",
-	     0,
+	     NULL,
 	     0,
 	     execute_java_constructor("java/net/NetworkInterface",
-				      0,
-				      0,
+				      NULL,
+				      NULL,
 				      "(Ljava/lang/String;Ljava/net/InetAddress;)V",
 				      iface_name,
 				      addr));
Index: kaffe/libraries/clib/net/PlainDatagramSocketImpl.c
diff -u kaffe/libraries/clib/net/PlainDatagramSocketImpl.c:1.49 kaffe/libraries/clib/net/PlainDatagramSocketImpl.c:1.50
--- kaffe/libraries/clib/net/PlainDatagramSocketImpl.c:1.49	Sun Dec 19 06:25:12 2004
+++ kaffe/libraries/clib/net/PlainDatagramSocketImpl.c	Mon Dec 20 03:40:04 2004
@@ -290,7 +290,7 @@
 	int alen = sizeof(saddr);
 
 	rc = KRECVFROM(unhand(obj)->native_fd,
-		0, 0, MSG_PEEK, (struct sockaddr*)&saddr,
+		NULL, 0, MSG_PEEK, (struct sockaddr*)&saddr,
 		&alen, NOTIMEOUT /* timeout */, &r);
 	if (rc) {
 		SignalError("java.net.SocketException", SYS_ERROR(rc));
@@ -350,7 +350,7 @@
 		  
 			except = (struct Hjava_io_InterruptedIOException *)
 			  execute_java_constructor(
-						   "java.net.SocketTimeoutException", 0, 0,
+						   "java.net.SocketTimeoutException", NULL, NULL,
 						   "(Ljava/lang/String;)V",
 						   checkPtr(stringC2Java("Read timed out")));
 			except->bytesTransferred = offset-unhand(pkt)->offset;
@@ -376,7 +376,7 @@
 		memcpy(unhand_byte_array(array_address), &addr.addr4.sin_addr, sizeof(addr.addr4.sin_addr));
 		
 		unhand(pkt)->address = (struct Hjava_net_InetAddress*)
-			execute_java_constructor("java/net/Inet4Address", 0, 0, "([BLjava/lang/String;)V",
+			execute_java_constructor("java/net/Inet4Address", NULL, NULL, "([BLjava/lang/String;)V",
 						 array_address, NULL);
 
 #if defined(HAVE_STRUCT_SOCKADDR_IN6)
@@ -385,7 +385,7 @@
 		memcpy(unhand_byte_array(array_address), &addr.addr6.sin6_addr, sizeof(addr.addr6.sin6_addr));
 		
 		unhand(pkt)->address = (struct Hjava_net_InetAddress*)
-			execute_java_constructor("java/net/Inet6Address", 0, 0, "([BLjava/lang/String;)V",
+			execute_java_constructor("java/net/Inet6Address", NULL, NULL, "([BLjava/lang/String;)V",
 						 array_address, NULL);
 #endif /* defined(HAVE_STRUCT_SOCKADDR_IN6) */
 		
@@ -396,7 +396,7 @@
 	/* zero out hostname to overwrite old name which does not match
 	 * the new address from which the packet came.
 	 */
-	unhand(unhand(pkt)->address)->hostName = 0;
+	unhand(unhand(pkt)->address)->hostName = NULL;
 
 DBG(NATIVENET,
 	dprintf("  datagram_receive(%p, %p) -> from %s:%d; brecv=%ld\n",
Index: kaffe/libraries/clib/net/PlainSocketImpl.c
diff -u kaffe/libraries/clib/net/PlainSocketImpl.c:1.50 kaffe/libraries/clib/net/PlainSocketImpl.c:1.51
--- kaffe/libraries/clib/net/PlainSocketImpl.c:1.50	Sun Dec 19 06:25:12 2004
+++ kaffe/libraries/clib/net/PlainSocketImpl.c	Mon Dec 20 03:40:04 2004
@@ -469,7 +469,7 @@
 
 	/* and use that byte array to create an appropriate Inet*Address instance */
 	do_execute_java_class_method (&jv, "java.net.InetAddress",
-							      0, 
+							      NULL, 
 							      "getByAddress",
 							      "([B)Ljava/net/InetAddress;",
 							      remote_addr);
@@ -704,7 +704,7 @@
 
 			 except = (struct Hjava_io_InterruptedIOException *)
 			   execute_java_constructor(
-						    "java.net.SocketTimeoutException", 0, 0,
+						    "java.net.SocketTimeoutException", NULL, NULL,
 						    "(Ljava/lang/String;)V",
 						    checkPtr(stringC2Java("Read was interrupted")));
 			 except->bytesTransferred = r;
Index: kaffe/libraries/clib/nio/java_nio_VMDirectByteBuffer.c
diff -u kaffe/libraries/clib/nio/java_nio_VMDirectByteBuffer.c:1.2 kaffe/libraries/clib/nio/java_nio_VMDirectByteBuffer.c:1.3
--- kaffe/libraries/clib/nio/java_nio_VMDirectByteBuffer.c:1.2	Sat Dec 11 07:00:53 2004
+++ kaffe/libraries/clib/nio/java_nio_VMDirectByteBuffer.c	Mon Dec 20 03:40:04 2004
@@ -134,7 +134,7 @@
     {
       JCL_ThrowException (env, "java/lang/OutOfMemoryError",
                           "unable to allocate memory for direct byte buffer");
-      return 0;
+      return NULL;
     }
 
   return NIOGetRawData (env, buffer);
Index: kaffe/libraries/clib/zip/Deflater.c
diff -u kaffe/libraries/clib/zip/Deflater.c:1.15 kaffe/libraries/clib/zip/Deflater.c:1.16
--- kaffe/libraries/clib/zip/Deflater.c:1.15	Wed Sep  1 21:53:50 2004
+++ kaffe/libraries/clib/zip/Deflater.c	Mon Dec 20 03:40:04 2004
@@ -120,7 +120,7 @@
 	z_stream* dstream;
 
 	dstream = GET_STREAM(this);
-	GET_STREAM(this) = 0;
+	GET_STREAM(this) = NULL;
 
 	deflateEnd(dstream);
 	KFREE(dstream);
@@ -150,10 +150,10 @@
 		postOutOfMemory(&info);
 		throwError(&info);
 	}
-	dstream->next_in = 0;
+	dstream->next_in = NULL;
 	dstream->zalloc = kaffe_zalloc;
 	dstream->zfree = kaffe_zfree;
-	dstream->opaque = 0;
+	dstream->opaque = NULL;
 
 	r = deflateInit2(dstream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, (val ? -WSIZEBITS : WSIZEBITS), 9, Z_DEFAULT_STRATEGY);
 
Index: kaffe/libraries/clib/zip/Inflater.c
diff -u kaffe/libraries/clib/zip/Inflater.c:1.14 kaffe/libraries/clib/zip/Inflater.c:1.15
--- kaffe/libraries/clib/zip/Inflater.c:1.14	Wed Sep  1 21:53:51 2004
+++ kaffe/libraries/clib/zip/Inflater.c	Mon Dec 20 03:40:04 2004
@@ -150,10 +150,10 @@
 		postOutOfMemory(&info);
 		throwError(&info);
 	}
-	dstream->next_out = 0;
+	dstream->next_out = NULL;
 	dstream->zalloc = kaffe_zalloc;
 	dstream->zfree = kaffe_zfree;
-	dstream->opaque = 0;
+	dstream->opaque = NULL;
 
 	r = inflateInit2(dstream, val ? -WSIZEBITS : WSIZEBITS);
 
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3225 kaffe/ChangeLog:1.3226
--- kaffe/ChangeLog:1.3225	Mon Dec 20 03:40:45 2004
+++ kaffe/ChangeLog	Mon Dec 20 03:42:04 2004
@@ -1,5 +1,10 @@
 2004-12-19  Adam Heath  <doogie at brainfood.com>
 
+	* libltdl/ltdl.c:
+	  Sparse NULL-constant fixes.
+
+2004-12-19  Adam Heath  <doogie at brainfood.com>
+
 	* kaffe/kaffevm/jit/seq.c, libraries/clib/io/File.c,
 	  libraries/clib/management/Debug.c,
 	  libraries/clib/math/BigInteger.c,
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3224 kaffe/ChangeLog:1.3225
--- kaffe/ChangeLog:1.3224	Mon Dec 20 02:45:10 2004
+++ kaffe/ChangeLog	Mon Dec 20 03:40:45 2004
@@ -1,5 +1,28 @@
 2004-12-19  Adam Heath  <doogie at brainfood.com>
 
+	* kaffe/kaffevm/jit/seq.c, libraries/clib/io/File.c,
+	  libraries/clib/management/Debug.c,
+	  libraries/clib/math/BigInteger.c,
+	  libraries/clib/native/AccessController.c,
+	  libraries/clib/native/Arrays.c,
+	  libraries/clib/native/ByteToCharIconv.c,
+	  libraries/clib/native/CharToByteIconv.c,
+	  libraries/clib/native/Class.c, libraries/clib/native/Method.c,
+	  libraries/clib/native/PrimordialClassLoader.c,
+	  libraries/clib/native/Runtime.c, libraries/clib/native/System.c,
+	  libraries/clib/native/ThreadStack.c,
+	  libraries/clib/native/Throwable.c,
+	  libraries/clib/native/ZipFile.c,
+	  libraries/clib/net/InetAddressImpl.c,
+	  libraries/clib/net/NetworkInterface.c,
+	  libraries/clib/net/PlainDatagramSocketImpl.c,
+	  libraries/clib/net/PlainSocketImpl.c,
+	  libraries/clib/nio/java_nio_VMDirectByteBuffer.c,
+	  libraries/clib/zip/Deflater.c, libraries/clib/zip/Inflater.c:
+	  Sparse NULL-constant fixes.
+
+2004-12-19  Adam Heath  <doogie at brainfood.com>
+
 	* libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c,
 	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,
 	  libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
Index: kaffe/libltdl/ltdl.c
diff -u kaffe/libltdl/ltdl.c:1.38 kaffe/libltdl/ltdl.c:1.39
--- kaffe/libltdl/ltdl.c:1.38	Mon Sep 20 23:19:09 2004
+++ kaffe/libltdl/ltdl.c	Mon Dec 20 03:42:11 2004
@@ -249,7 +249,7 @@
 #endif
 
 #define LT_DLMEM_REASSIGN(p, q)			LT_STMT_START {	\
-	if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = 0; }	\
+	if ((p) != (q)) { if (p) lt_dlfree (p); (p) = (q); (q) = NULL; }	\
 						} LT_STMT_END
 
 
@@ -265,7 +265,7 @@
 strdup(str)
      const char *str;
 {
-  char *tmp = 0;
+  char *tmp = NULL;
 
   if (str)
     {
@@ -820,7 +820,7 @@
     lt_dlerror_table
 #undef LT_ERROR
 
-    0
+    NULL
   };
 
 /* This structure is used for the list of registered loaders. */
@@ -897,11 +897,11 @@
 
 /* The mutex functions stored here are global, and are necessarily the
    same for all threads that wish to share access to libltdl.  */
-static	lt_dlmutex_lock	    *lt_dlmutex_lock_func     = 0;
-static	lt_dlmutex_unlock   *lt_dlmutex_unlock_func   = 0;
-static	lt_dlmutex_seterror *lt_dlmutex_seterror_func = 0;
-static	lt_dlmutex_geterror *lt_dlmutex_geterror_func = 0;
-static	const char	    *lt_dllast_error	      = 0;
+static	lt_dlmutex_lock	    *lt_dlmutex_lock_func     = NULL;
+static	lt_dlmutex_unlock   *lt_dlmutex_unlock_func   = NULL;
+static	lt_dlmutex_seterror *lt_dlmutex_seterror_func = NULL;
+static	lt_dlmutex_geterror *lt_dlmutex_geterror_func = NULL;
+static	const char	    *lt_dllast_error	      = NULL;
 
 
 /* Either set or reset the mutex functions.  Either all the arguments must
@@ -950,7 +950,7 @@
 /* --- ERROR HANDLING --- */
 
 
-static	const char    **user_error_strings	= 0;
+static	const char    **user_error_strings	= NULL;
 static	int		errorcount		= LT_ERROR_MAX;
 
 int
@@ -959,7 +959,7 @@
 {
   int		errindex = 0;
   int		result	 = -1;
-  const char  **temp     = (const char **) 0;
+  const char  **temp     = NULL;
 
   assert (diagnostic);
 
@@ -1151,9 +1151,9 @@
 #  ifdef NEED_USCORE
     "_",
 #  else
-    0,
+    NULL,
 #  endif
-    sys_dl_open, sys_dl_close, sys_dl_sym, 0, 0 };
+    sys_dl_open, sys_dl_close, sys_dl_sym, NULL, NULL };
 
 
 #endif /* HAVE_LIBDL */
@@ -1940,8 +1940,8 @@
   const lt_dlsymlist	       *syms;
 } lt_dlsymlists_t;
 
-static	const lt_dlsymlist     *default_preloaded_symbols	= 0;
-static	lt_dlsymlists_t	       *preloaded_symbols		= 0;
+static	const lt_dlsymlist     *default_preloaded_symbols	= NULL;
+static	lt_dlsymlists_t	       *preloaded_symbols		= NULL;
 
 static int
 presym_init (loader_data)
@@ -1951,7 +1951,7 @@
 
   LT_DLMUTEX_LOCK ();
 
-  preloaded_symbols = 0;
+  preloaded_symbols = NULL;
   if (default_preloaded_symbols)
     {
       errors = lt_dlpreload (default_preloaded_symbols);
@@ -1977,7 +1977,7 @@
       lists = lists->next;
       LT_DLFREE (tmp);
     }
-  preloaded_symbols = 0;
+  preloaded_symbols = NULL;
 
   LT_DLMUTEX_UNLOCK ();
 
@@ -2086,7 +2086,7 @@
      lt_module module;
 {
   /* Just to silence gcc -Wall */
-  module = 0;
+  module = NULL;
   return 0;
 }
 
@@ -2111,11 +2111,11 @@
 
   LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND));
 
-  return 0;
+  return NULL;
 }
 
 static struct lt_user_dlloader presym = {
-  0, presym_open, presym_close, presym_sym, presym_exit, 0
+  NULL, presym_open, presym_close, presym_sym, presym_exit, NULL
 };
 
 
@@ -2189,9 +2189,9 @@
 						 size_t *pargz_len));
 static	int	file_not_found	      LT_PARAMS((void));
 
-static	char	       *user_search_path= 0;
-static	lt_dlloader    *loaders		= 0;
-static	lt_dlhandle	handles 	= 0;
+static	char	       *user_search_path= NULL;
+static	lt_dlloader    *loaders		= NULL;
+static	lt_dlhandle	handles 	= NULL;
 static	int		initialized 	= 0;
 
 /* Initialize libltdl. */
@@ -2205,20 +2205,20 @@
   /* Initialize only at first call. */
   if (++initialized == 1)
     {
-      handles = 0;
-      user_search_path = 0; /* empty search path */
+      handles = NULL;
+      user_search_path = NULL; /* empty search path */
 
 #if HAVE_LIBDL
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dl, "dlopen");
+      errors += lt_dlloader_add (lt_dlloader_next (NULL), &sys_dl, "dlopen");
 #endif
 #if HAVE_SHL_LOAD
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_shl, "dlopen");
+      errors += lt_dlloader_add (lt_dlloader_next (NULL), &sys_shl, "dlopen");
 #endif
 #ifdef __WINDOWS__
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_wll, "dlopen");
+      errors += lt_dlloader_add (lt_dlloader_next (NULL), &sys_wll, "dlopen");
 #endif
 #ifdef __BEOS__
-      errors += lt_dlloader_add (lt_dlloader_next (0), &sys_bedl, "dlopen");
+      errors += lt_dlloader_add (lt_dlloader_next (NULL), &sys_bedl, "dlopen");
 #endif
 #if HAVE_DLD
       errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dld, "dld");
@@ -2227,7 +2227,7 @@
        errors += lt_dlloader_add (lt_dlloader_next (0), &sys_dyld, "dyld");
        errors += sys_dyld_init();
 #endif
-      errors += lt_dlloader_add (lt_dlloader_next (0), &presym, "dlpreload");
+      errors += lt_dlloader_add (lt_dlloader_next (NULL), &presym, "dlpreload");
 
       if (presym_init (presym.dlloader_data))
 	{
@@ -2345,7 +2345,7 @@
 
 	  LT_DLMEM_REASSIGN (loader, next);
 	}
-      loaders = 0;
+      loaders = NULL;
     }
 
  done:
@@ -2418,7 +2418,7 @@
     }
   else
     {
-      cur->info.filename = 0;
+      cur->info.filename = NULL;
     }
 
   while (loader)
@@ -2427,7 +2427,7 @@
 
       cur->module = loader->module_open (data, filename);
 
-      if (cur->module != 0)
+      if (cur->module != NULL)
 	{
 	  break;
 	}
@@ -2458,7 +2458,7 @@
      const char *dlname;
 {
   int      error	= 0;
-  char     *filename	= 0;
+  char     *filename	= NULL;
   size_t   filename_len	= 0;

*** Patch too long, truncated ***




More information about the kaffe mailing list