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

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


PatchSet 5675 
Date: 2004/12/20 02:12:50
Author: doogie
Branch: HEAD
Tag: (none) 
Log:
Sparse NULL-constant fixes.

Members: 
	ChangeLog:1.3220->1.3221 
	kaffe/kaffevm/locks.c:1.53->1.54 
	kaffe/kaffevm/lookup.c:1.41->1.42 
	kaffe/kaffevm/object.c:1.30->1.31 
	kaffe/kaffevm/readClass.c:1.22->1.23 
	kaffe/kaffevm/reflect.c:1.1->1.2 
	kaffe/kaffevm/soft.c:1.71->1.72 
	kaffe/kaffevm/stackTrace.c:1.42->1.43 
	kaffe/kaffevm/string.c:1.37->1.38 
	kaffe/kaffevm/stringParsing.c:1.9->1.10 
	kaffe/kaffevm/support.c:1.79->1.80 
	kaffe/kaffevm/thread.c:1.85->1.86 
	kaffe/kaffevm/utf8const.c:1.43->1.44 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3220 kaffe/ChangeLog:1.3221
--- kaffe/ChangeLog:1.3220	Mon Dec 20 01:39:19 2004
+++ kaffe/ChangeLog	Mon Dec 20 02:12:50 2004
@@ -1,5 +1,15 @@
 2004-12-19  Adam Heath  <doogie at brainfood.com>
 
+	* kaffe/kaffevm/locks.c, kaffe/kaffevm/lookup.c,
+	  kaffe/kaffevm/object.c, kaffe/kaffevm/readClass.c,
+	  kaffe/kaffevm/reflect.c, kaffe/kaffevm/soft.c,
+	  kaffe/kaffevm/stackTrace.c, kaffe/kaffevm/string.c,
+	  kaffe/kaffevm/stringParsing.c, kaffe/kaffevm/support.c,
+	  kaffe/kaffevm/thread.c, kaffe/kaffevm/utf8const.c:
+	  Sparse NULL-constant fixes.
+
+2004-12-19  Adam Heath  <doogie at brainfood.com>
+
 	* kaffe/kaffevm/kaffe-gc/gc-incremental.c,
 	  kaffe/kaffevm/kaffe-gc/gc-incremental.h,
 	  kaffe/kaffevm/kaffe-gc/gc-mem.c:
Index: kaffe/kaffe/kaffevm/locks.c
diff -u kaffe/kaffe/kaffevm/locks.c:1.53 kaffe/kaffe/kaffevm/locks.c:1.54
--- kaffe/kaffe/kaffevm/locks.c:1.53	Sun Dec 19 06:25:08 2004
+++ kaffe/kaffe/kaffevm/locks.c	Mon Dec 20 02:12:53 2004
@@ -129,8 +129,8 @@
 				(lk != heavyLock) ? "new" : "special");
 );
 			lk->holder = (void*)old;
-			lk->mux = 0;
-			lk->cv = 0;
+			lk->mux = NULL;
+			lk->cv = NULL;
 		}
 		return (lk);
 	}
@@ -240,17 +240,17 @@
 	/* Final unlock - if someone is waiting for it now would be a good
 	 * time to tell them.
 	 */
-	if (lk->mux != 0) {
+	if (lk->mux != NULL) {
 		tid = lk->mux;
 		lk->mux = KTHREAD(get_data)(tid)->nextlk;
-		KTHREAD(get_data)(tid)->nextlk = 0;
-		lk->holder = 0;
+		KTHREAD(get_data)(tid)->nextlk = NULL;
+		lk->holder = NULL;
 		putHeavyLock(lkp, lk);
 		KSEM(put)(&KTHREAD(get_data)(tid)->sem);
 	}
 	/* If someone's waiting to be signaled keep the heavy in place */
-	else if (lk->cv != 0) {
-		lk->holder = 0;
+	else if (lk->cv != NULL) {
+		lk->holder = NULL;
 		putHeavyLock(lkp, lk);
 	}
 	else {
@@ -462,13 +462,13 @@
 void
 lockObject(Hjava_lang_Object* obj)
 {
-	locks_internal_lockMutex(&obj->lock, &obj, 0);
+	locks_internal_lockMutex(&obj->lock, &obj, NULL);
 }
 
 void
 unlockObject(Hjava_lang_Object* obj)
 {
-	locks_internal_unlockMutex(&obj->lock, &obj, 0);
+	locks_internal_unlockMutex(&obj->lock, &obj, NULL);
 }
 
 void
@@ -484,7 +484,7 @@
 		jvmpiPostEvent(&ev);
 	}
 #endif
-	slowLockMutex(&obj->lock, where, 0);
+	slowLockMutex(&obj->lock, where, NULL);
 #if defined(ENABLE_JVMPI)
 	if( JVMPI_EVENT_ISENABLED(JVMPI_EVENT_MONITOR_CONTENDED_ENTERED) )
 	{
@@ -510,7 +510,7 @@
 		jvmpiPostEvent(&ev);
 	}
 #endif
-	slowUnlockMutex(&obj->lock, where, 0);
+	slowUnlockMutex(&obj->lock, where, NULL);
 }
 
 void
Index: kaffe/kaffe/kaffevm/lookup.c
diff -u kaffe/kaffe/kaffevm/lookup.c:1.41 kaffe/kaffe/kaffevm/lookup.c:1.42
--- kaffe/kaffe/kaffevm/lookup.c:1.41	Sun Dec 19 06:25:08 2004
+++ kaffe/kaffe/kaffevm/lookup.c	Mon Dec 20 02:12:53 2004
@@ -51,11 +51,11 @@
 	Method* mptr;
 	int i;
 
-	call->class = 0;
-	call->method = 0;
-	call->signature = 0;
-	call->name = 0;
-	call->cname = 0;
+	call->class = NULL;
+	call->method = NULL;
+	call->signature = NULL;
+	call->name = NULL;
+	call->cname = NULL;
 
 	pool = CLASS_CONSTANTS(this);
 	if (pool->tags[idx] != CONSTANT_Methodref &&
@@ -93,7 +93,7 @@
 
 		call->class = class;
 		call->cname = class->name;
-		call->method = 0;
+		call->method = NULL;
 		/* Find method - we don't use findMethod(...) yet since this
 		 * will initialise our class (and we don't want to do that).
 		 */
@@ -103,7 +103,7 @@
 			 * contains all methods of all implemented interfaces, we
 			 * don't need to search superinterfaces here.
 			 */
-			for (; class != 0; class = class->superclass) {
+			for (; class != NULL; class = class->superclass) {
 				mptr = findMethodLocal(class, name, sig);
 				if (mptr != NULL) {
 					call->method = mptr;
@@ -120,7 +120,7 @@
 			if (mptr == NULL) {
 				for (i = class->total_interface_len - 1; i >= 0; i--) {
 					mptr = findMethodLocal(class->interfaces[i], name, sig);
-					if (mptr != 0) {
+					if (mptr != NULL) {
 						break;
 					}
 				}
@@ -251,8 +251,8 @@
 	Field* field;
 	Hjava_lang_Class* class;
 
-	ret->field = 0;
-	ret->class = 0;
+	ret->field = NULL;
+	ret->class = NULL;
 	
 	pool = CLASS_CONSTANTS(this);
 	if (pool->tags[idx] != CONSTANT_Fieldref) {
@@ -347,19 +347,19 @@
 	if (class->state < CSTATE_USABLE) {
 		success = processClass(class, CSTATE_COMPLETE, einfo);
 		if (!success)
-			return (0);
+			return (NULL);
 	}
 
 	/*
 	 * Lookup method - this could be alot more efficient but never mind.
 	 * Also there is no attempt to honour PUBLIC, PRIVATE, etc.
 	 */
-	for (; class != 0; class = class->superclass) {
+	for (; class != NULL; class = class->superclass) {
 		Method* mptr = findMethodLocal(class, name, signature);
 		if (mptr != NULL) {
 			return mptr;
 		}
 	}
 	postExceptionMessage(einfo, JAVA_LANG(NoSuchMethodError), "%s", name->data);
-	return (0);
+	return (NULL);
 }
Index: kaffe/kaffe/kaffevm/object.c
diff -u kaffe/kaffe/kaffevm/object.c:1.30 kaffe/kaffe/kaffevm/object.c:1.31
--- kaffe/kaffe/kaffevm/object.c:1.30	Sun Dec 19 06:25:08 2004
+++ kaffe/kaffe/kaffevm/object.c	Mon Dec 20 02:12:53 2004
@@ -43,7 +43,7 @@
 				     "(class: %s) "
 				     "Abstract class.",
 				     CLASS_CNAME(class));
-		return (0);
+		return (NULL);
 	}
 	obj = gc_malloc((size_t)(CLASS_FSIZE(class)), class->alloc_type);
 
@@ -102,14 +102,14 @@
 	Hjava_lang_Class* cls;
 
 	cls = gc_malloc(sizeof(Hjava_lang_Class), KGC_ALLOC_CLASSOBJECT);
-	if (cls == 0) {
+	if (cls == NULL) {
 		goto done;
 	}
 
 	/* Turn off class gc */
 	if (Kaffe_JavaVMArgs.enableClassGC == 0) {
 		if (!gc_add_ref(cls)) {
-			return 0;
+			return NULL;
 		}
 	}
 
@@ -129,8 +129,8 @@
 Hjava_lang_Object*
 newArrayChecked(Hjava_lang_Class* elclass, jsize count, errorInfo *info)
 {
-	Hjava_lang_Class* class = 0;
-	Hjava_lang_Object* obj = 0;
+	Hjava_lang_Class* class = NULL;
+	Hjava_lang_Object* obj = NULL;
 
 	if ((class = lookupArray(elclass, info)) != NULL) {
 		size_t total_count;
Index: kaffe/kaffe/kaffevm/readClass.c
diff -u kaffe/kaffe/kaffevm/readClass.c:1.22 kaffe/kaffe/kaffevm/readClass.c:1.23
--- kaffe/kaffe/kaffevm/readClass.c:1.22	Sat Jul 17 07:57:14 2004
+++ kaffe/kaffe/kaffevm/readClass.c	Mon Dec 20 02:12:53 2004
@@ -40,14 +40,14 @@
 	const char* className = NULL;
 
 	if (! checkBufSize(fp, 4+2+2, className, einfo))
-		return 0;
+		return NULL;
 
 	/* Read in class info */
 	readu4(&magic, fp);
 	if (magic != JAVAMAGIC) {
 		postExceptionMessage(einfo, JAVA_LANG(ClassFormatError), 
 				    "Bad magic number 0x%x", magic);
-		return 0;
+		return NULL;
 	}
 	readu2(&minor_version, fp);
 	readu2(&major_version, fp);
@@ -71,11 +71,11 @@
 	}
 
 	if (readConstantPool(classThis, fp, einfo) == false) {
-		return 0;
+		return NULL;
 	}
 
 	if (! checkBufSize(fp, 2+2+2, className, einfo))
-		return 0;
+		return NULL;
 
 	readu2(&access_flags, fp);
 	readu2(&this_class, fp);
@@ -84,7 +84,7 @@
 	if (! setupClass(classThis,
 			 this_class, super_class, access_flags,
 			 loader, einfo)) {
-		return (0);
+		return (NULL);
 	}
 
 	/* CLASS_CNAME(classThis) is now defined. */
@@ -93,7 +93,7 @@
 	    readFields(fp, classThis, einfo) == false ||
 	    readMethods(fp, classThis, einfo) == false ||
 	    readAttributes(fp, classThis, READATTR_CLASS, classThis, einfo) == false) {
-		return 0;
+		return NULL;
 	}
 
 	return (classThis);
@@ -127,7 +127,7 @@
 
 	interfaces = (Hjava_lang_Class**)
 		gc_malloc(sizeof(Hjava_lang_Class**) * interfaces_count, KGC_ALLOC_INTERFACE);
-	if (interfaces == 0) {
+	if (interfaces == NULL) {
 		postOutOfMemory(einfo);
 		return false;	
 	}				
Index: kaffe/kaffe/kaffevm/reflect.c
diff -u kaffe/kaffe/kaffevm/reflect.c:1.1 kaffe/kaffe/kaffevm/reflect.c:1.2
--- kaffe/kaffe/kaffevm/reflect.c:1.1	Mon Jul  5 16:40:39 2004
+++ kaffe/kaffe/kaffevm/reflect.c	Mon Dec 20 02:12:53 2004
@@ -43,11 +43,11 @@
 	Hjava_lang_Class* clazz;
 
 	array = (HArrayOfObject*)AllocObjectArray(METHOD_NARGS(meth),
-	    "Ljava/lang/Class;", 0);
+	    "Ljava/lang/Class;", NULL);
 	for (i = 0; i < METHOD_NARGS(meth); ++i) {
 		clazz = getClassFromSignaturePart(METHOD_ARG_TYPE(meth, i),
 					      meth->class->loader, &info);
-		if (clazz == 0) {
+		if (clazz == NULL) {
 			throwError(&info);
 		}
 		unhand_array(array)->body[i] = &clazz->head;
@@ -91,14 +91,14 @@
 		meth = meth->declared_exceptions_u.remote_exceptions;
 	}
 	nr = meth->ndeclared_exceptions;
-	array = (HArrayOfObject*)AllocObjectArray(nr, "Ljava/lang/Class;", 0);
+	array = (HArrayOfObject*)AllocObjectArray(nr, "Ljava/lang/Class;", NULL);
 	ptr = (Hjava_lang_Class**)&unhand_array(array)->body[0];
 	for (i = 0; i < nr; i++) {
 		errorInfo info;
 		Hjava_lang_Class* clazz;
 		clazz = getClass(meth->declared_exceptions[i], meth->class,
 				&info);
-		if (clazz == 0) {
+		if (clazz == NULL) {
 			throwError(&info);
 		}
 		*ptr++ = clazz;
@@ -114,7 +114,7 @@
 
 	mth = CLASS_METHODS(clazz) + slot;
 	meth = (Hjava_lang_reflect_Constructor*)
-	    AllocObject("java/lang/reflect/Constructor", 0);
+	    AllocObject("java/lang/reflect/Constructor", NULL);
 
 	unhand(meth)->clazz = clazz;
 	unhand(meth)->slot = slot;
@@ -132,7 +132,7 @@
 
 	mth = CLASS_METHODS(clazz) + slot;
 	meth = (Hjava_lang_reflect_Method*)
-	    AllocObject("java/lang/reflect/Method", 0);
+	    AllocObject("java/lang/reflect/Method", NULL);
 
 	unhand(meth)->clazz = clazz;
 	unhand(meth)->slot = slot;
@@ -153,11 +153,11 @@
 
 	fld = CLASS_FIELDS(clazz) + slot;
 	field = (Hjava_lang_reflect_Field*)
-	    AllocObject("java/lang/reflect/Field", 0);
+	    AllocObject("java/lang/reflect/Field", NULL);
 	unhand(field)->clazz = clazz;
 	unhand(field)->slot = slot;
 	unhand(field)->type = resolveFieldType(fld, clazz, &info);
-	if (unhand(field)->type == 0) {
+	if (unhand(field)->type == NULL) {
 		throwError(&info);
 	}
 	unhand(field)->name = checkPtr(utf8Const2Java(fld->name));
Index: kaffe/kaffe/kaffevm/soft.c
diff -u kaffe/kaffe/kaffevm/soft.c:1.71 kaffe/kaffe/kaffevm/soft.c:1.72
--- kaffe/kaffe/kaffevm/soft.c:1.71	Sun Dec 19 06:25:08 2004
+++ kaffe/kaffe/kaffevm/soft.c	Mon Dec 20 02:12:53 2004
@@ -56,7 +56,7 @@
 		goto bad;
 	}
 	obj = newObjectChecked(c, &info);
-	if (obj == 0) {
+	if (obj == NULL) {
 		goto bad;
 	}
 
@@ -67,7 +67,7 @@
 	return (obj);
 bad:
 	throwError(&info);
-	return (0);
+	return (NULL);
 }
 
 /*
@@ -84,7 +84,7 @@
 	}
 
 	obj = newArrayChecked(TYPE_CLASS(type), (jsize)size, &info);
-	if (obj == 0) {
+	if (obj == NULL) {
 		throwError(&info);
 	}
 
@@ -109,7 +109,7 @@
 	}
 
 	obj = newArrayChecked(elclass, (jsize)size, &info);
-	if (obj == 0) {
+	if (obj == NULL) {
 		throwError(&info);
 	}
 
@@ -387,7 +387,7 @@
 void*
 soft_checkcast(Hjava_lang_Class* c, Hjava_lang_Object* o)
 {
-	if (o != 0 && !instanceof(c, OBJECT_CLASS(o))) {
+	if (o != NULL && !instanceof(c, OBJECT_CLASS(o))) {
 		/*
 		 * Let's be a bit more informative as to why the class
 		 * cast exception happened.
@@ -424,7 +424,7 @@
 void
 soft_athrow(Hjava_lang_Object* o)
 {
-	if (o == 0) {
+	if (o == NULL) {
 		soft_nullpointer();
 	}
 	else {
@@ -583,7 +583,7 @@
 void
 soft_checkarraystore(Hjava_lang_Object* array, Hjava_lang_Object* obj)
 {
-	if (obj != 0 && soft_instanceof(CLASS_ELEMENT_TYPE(OBJECT_CLASS(array)), obj) == 0) {
+	if (obj != NULL && soft_instanceof(CLASS_ELEMENT_TYPE(OBJECT_CLASS(array)), obj) == 0) {
 		Hjava_lang_Throwable* asexc;
 		const char* f = "can't store `%s' in `%s'";
 		const char *otype = CLASS_CNAME(OBJECT_CLASS(obj));
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.42 kaffe/kaffe/kaffevm/stackTrace.c:1.43
--- kaffe/kaffe/kaffevm/stackTrace.c:1.42	Thu Dec 16 06:13:52 2004
+++ kaffe/kaffe/kaffevm/stackTrace.c	Mon Dec 20 02:12:53 2004
@@ -68,7 +68,7 @@
 	if (!info) {
 	    dprintf("buildStackTrace(%p): can't allocate stackTraceInfo\n",
 		    base);
-	    return 0;
+	    return NULL;
 	}
 
 	cnt = 0;
@@ -102,7 +102,7 @@
 	if (pc_base) {
 		return *(Method **)pc_base;
 	}
-	return 0;
+	return NULL;
 }
 
 #elif defined(INTERPRETER)
@@ -282,16 +282,16 @@
 			for (j = len;  --j >= 0; ) {
 				cptr[j] = (unsigned char)buf[j];
 			}
-			if (p != 0 || !nullOK) {
+			if (p != NULL || !nullOK) {
 				do_execute_java_method(p, "println",
-					"([C)V", 0, 0, str);
+					"([C)V", NULL, NULL, str);
 			} else {
 				dprintf("%s\n", buf);
 			}
 			KFREE(buf);
 		}
 	}
-	if (p != 0 || !nullOK) {
-		do_execute_java_method(NULL, p, "flush", "()V", 0, 0);
+	if (p != NULL || !nullOK) {
+		do_execute_java_method(NULL, p, "flush", "()V", NULL, 0);
 	}
 }
Index: kaffe/kaffe/kaffevm/string.c
diff -u kaffe/kaffe/kaffevm/string.c:1.37 kaffe/kaffe/kaffevm/string.c:1.38
--- kaffe/kaffe/kaffevm/string.c:1.37	Sat Dec 11 20:49:40 2004
+++ kaffe/kaffe/kaffevm/string.c	Mon Dec 20 02:12:53 2004
@@ -87,7 +87,7 @@
 	/* Get buffer */
 	if (len * sizeof(*ary) > sizeof(buf)) {
 		ary = gc_malloc(len * sizeof(*ary), KGC_ALLOC_FIXED);
-		if (!ary) return 0;
+		if (!ary) return NULL;
 	} else {
 		ary = buf;
 	}
@@ -121,7 +121,7 @@
 					     (jsize)len, &info);
 	if (!ary) {
 		discardErrorInfo(&info);
-		return 0;
+		return NULL;
 	}
 	
 	/* Convert C chars to Java chars */
@@ -166,7 +166,7 @@
 	/* Get buffer */
 	if (uniLen * sizeof(jchar) > sizeof(buf)) {
 		jc = gc_malloc(uniLen * sizeof(*jc), KGC_ALLOC_FIXED);
-		if (!jc) return 0;
+		if (!jc) return NULL;
 	} else {
 		jc = buf;
 	}
@@ -445,7 +445,7 @@
 		} else {
 			fakeAry = (HArrayOfChar*)buf;
 		}
-		if (!fakeAry) return 0;
+		if (!fakeAry) return NULL;
 		
 		memset(fakeAry, 0, sizeof(*fakeAry));
 		memcpy(unhand_array(fakeAry)->body, data, len * sizeof(*data));
@@ -475,14 +475,14 @@
 					     &info);
 	if (!ary) {
 		discardErrorInfo(&info);
-		return 0;
+		return NULL;
 	}
 	
 	memcpy(ARRAY_DATA(ary), data, len * sizeof(jchar));
 	string = (Hjava_lang_String*)newObjectChecked(getStringClass(), &info);
 	if (!string) {
 		discardErrorInfo(&info);
-		return 0;
+		return NULL;
 	}
 	unhand(string)->value = ary;
 	unhand(string)->count = len;
Index: kaffe/kaffe/kaffevm/stringParsing.c
diff -u kaffe/kaffe/kaffevm/stringParsing.c:1.9 kaffe/kaffe/kaffevm/stringParsing.c:1.10
--- kaffe/kaffe/kaffevm/stringParsing.c:1.9	Sat Jul 17 07:57:14 2004
+++ kaffe/kaffe/kaffevm/stringParsing.c	Mon Dec 20 02:12:53 2004
@@ -119,7 +119,7 @@
 	}
 	else
 	{
-		pe->position = 0;
+		pe->position = NULL;
 		pe->op = op;
 	}
 	return( retval );
@@ -130,7 +130,7 @@
 {
 	parseFrame *prev;
 
-	assert(ps != 0);
+	assert(ps != NULL);
 
 	prev = ps->top->prev;
 	if( ps->depth >= PREALLOC_FRAMES )
@@ -142,7 +142,7 @@
 static
 void cutFrames(parseStack *ps)
 {
-	assert(ps != 0);
+	assert(ps != NULL);
 	
 	while( ps->depth >= PREALLOC_FRAMES )
 	{
@@ -465,7 +465,7 @@
 			int op,
 			va_list args)
 {
-	char *str, *str_end, *str_ptr = 0, *term_ptr, *new_pos = 0;
+	char *str, *str_end, *str_ptr = NULL, *term_ptr, *new_pos = NULL;
 	int values_pos = 0, len, retval = 1;
 	stringScript *script_pos = script;
 	parseValue pv;
@@ -494,7 +494,7 @@
         VA_LIST_COPY (tmp_args, args);
 #endif
 
-	assert(subString != 0);
+	assert(subString != NULL);
 
 	str = subString->data;
 	str_end = subString->data + subString->len;
Index: kaffe/kaffe/kaffevm/support.c
diff -u kaffe/kaffe/kaffevm/support.c:1.79 kaffe/kaffe/kaffevm/support.c:1.80
--- kaffe/kaffe/kaffevm/support.c:1.79	Thu Dec 16 06:13:52 2004
+++ kaffe/kaffe/kaffevm/support.c	Mon Dec 20 02:12:53 2004
@@ -143,7 +143,7 @@
 {
 	Hjava_lang_Class* clazz;
 	errorInfo info;
-	Method* mb = 0;
+	Method* mb = NULL;
 	char *buf;
 
 	/* Convert "." to "/" and lookup class */
@@ -153,10 +153,10 @@
 	KFREE(buf);
 
 	/* Get method */
-	if (clazz != 0) {
+	if (clazz != NULL) {
 		mb = lookupClassMethod(clazz, method_name, signature, &info);
 	}
-	if (mb == 0) {
+	if (mb == NULL) {
 		throwError(&info);
 	}
 
@@ -166,7 +166,7 @@
 	}
 
 	/* Make the call */
-	callMethodV(mb, METHOD_NATIVECODE(mb), 0, argptr, retval);
+	callMethodV(mb, METHOD_NATIVECODE(mb), NULL, argptr, retval);
 }
 
 /**
@@ -660,13 +660,13 @@
 	name_utf8 = utf8ConstNew(name, -1);
 	if (!name_utf8) {
 		postOutOfMemory(einfo);
-		return 0;
+		return NULL;
 	}
 	sig_utf8 = utf8ConstNew(sig, -1);
 	if (!sig_utf8) {
 		utf8ConstRelease(name_utf8);
 		postOutOfMemory(einfo);
-		return 0;
+		return NULL;
 	}
 	meth = findMethod(cls, name_utf8, sig_utf8, einfo);
 	utf8ConstRelease(name_utf8);
@@ -687,7 +687,7 @@
 Method*
 lookupObjectMethod(Hjava_lang_Object* obj, const char* name, const char* sig, errorInfo *einfo)
 {
-	assert(obj != 0 && name != 0 && sig != 0);
+	assert(obj != NULL && name != NULL && sig != NULL);
 	return (lookupClassMethod(OBJECT_CLASS(obj), name, sig, einfo));
 }
 
@@ -705,10 +705,10 @@
 
 	if (str == NULL || *str == '\0') {
 		obj = (Hjava_lang_Throwable*)execute_java_constructor(cname,
-			0, 0, ERROR_SIGNATURE0);
+			NULL, NULL, ERROR_SIGNATURE0);
 	} else {
 		obj = (Hjava_lang_Throwable*)execute_java_constructor(cname,
-			0, 0, ERROR_SIGNATURE, checkPtr(stringC2Java(str)));
+			NULL, NULL, ERROR_SIGNATURE, checkPtr(stringC2Java(str)));
 	}
 	throwException(obj);
 }
@@ -784,7 +784,7 @@
 
 #if defined(HAVE_GETTIMEOFDAY)
 	struct timeval tm;
-	gettimeofday(&tm, 0);
+	gettimeofday(&tm, NULL);
 	tme = (((jlong)tm.tv_sec * (jlong)1000) + ((jlong)tm.tv_usec / (jlong)1000));
 #elif defined(HAVE_FTIME)
 	struct timeb tm;
@@ -904,13 +904,13 @@
 void 
 enterUnsafeRegion(void)
 {
-	KTHREAD(spinon)(0);
+	KTHREAD(spinon)(NULL);
 }
 
 void 
 leaveUnsafeRegion(void)
 {
-	KTHREAD(spinoff)(0);
+	KTHREAD(spinoff)(NULL);
 }
 
 /* XXX Ick */
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.85 kaffe/kaffe/kaffevm/thread.c:1.86
--- kaffe/kaffe/kaffevm/thread.c:1.85	Sun Dec 19 06:25:08 2004
+++ kaffe/kaffe/kaffevm/thread.c	Mon Dec 20 02:12:53 2004
@@ -84,7 +84,7 @@
 	jthread_t thread = KTHREAD(current)();
 	threadData *thread_data = KTHREAD(get_data)(thread);
 
-	thread_data->jniEnv = 0;
+	thread_data->jniEnv = NULL;
 
 	KSEM(destroy) (&thread_data->sem);
 }
@@ -131,7 +131,7 @@
 
 	if (nativeThread == NULL) {
 		postOutOfMemory(einfo);
-		return 0;
+		return NULL;
 	}
 	
 	return nativeThread;
@@ -258,7 +258,7 @@
         unhand(tid)->contextClassLoader = (struct Hjava_lang_ClassLoader *) retval.l;
 
 	/* Attach thread to threadGroup */
-	do_execute_java_method(NULL, unhand(tid)->group, "addThread", "(Ljava/lang/Thread;)V", 0, 0, tid);
+	do_execute_java_method(NULL, unhand(tid)->group, "addThread", "(Ljava/lang/Thread;)V", NULL, 0, tid);
 
 	DBG(VMTHREAD, dprintf("attachFakedThreadInstance(%s)=%p done\n", nm, tid); );
 }
@@ -320,12 +320,12 @@
   
   /* Keep daemon threads as root objects */
   vmtid = (Hjava_lang_Thread*)newObject(VMThreadClass);
-  assert(vmtid != 0);
+  assert(vmtid != NULL);
   
   name = stringC2Java(nm);
   if (!name) {
     postOutOfMemory(einfo);
-    return 0;
+    return NULL;
   }
   tid = (Hjava_lang_Thread *)
     execute_java_constructor(NULL, NULL,
@@ -353,7 +353,7 @@
   
   if (nativeTid == NULL) {
     postOutOfMemory(einfo);
-    return 0;
+    return NULL;
   }
 
   KTHREAD(get_data)(nativeTid)->exceptPtr = NULL;
@@ -695,7 +695,7 @@
 	stackSize = MAINSTACKSIZE;
 #endif
 	DBG(INIT, dprintf("Detected stackSize %lu\n", stackSize); );
-	KTHREAD(createfirst)(stackSize, (unsigned char)java_lang_Thread_NORM_PRIORITY, 0);
+	KTHREAD(createfirst)(stackSize, (unsigned char)java_lang_Thread_NORM_PRIORITY, NULL);
 
 	/*
 	 * initialize some things that are absolutely necessary:
Index: kaffe/kaffe/kaffevm/utf8const.c
diff -u kaffe/kaffe/kaffevm/utf8const.c:1.43 kaffe/kaffe/kaffevm/utf8const.c:1.44
--- kaffe/kaffe/kaffevm/utf8const.c:1.43	Sun Dec 19 06:25:08 2004
+++ kaffe/kaffe/kaffevm/utf8const.c	Mon Dec 20 02:12:53 2004
@@ -162,7 +162,7 @@
 	if (sizeof(Utf8Const) + len + 1 > sizeof(buf)) {
 		fake = gc_malloc(sizeof(Utf8Const) + len + 1, KGC_ALLOC_UTF8CONST);
 		if (!fake) {
-			return 0;
+			return NULL;
 		}
 	} else {
 		fake = (Utf8Const*)buf;
@@ -192,7 +192,7 @@
 	if ((char *) fake == buf) {
 		utf8 = gc_malloc(sizeof(Utf8Const) + len + 1, KGC_ALLOC_UTF8CONST);
 		if (!utf8) {
-			return 0;
+			return NULL;
 		}
 		memcpy((char *) utf8->data, s, len);
 		((char*)utf8->data)[len] = '\0';
@@ -390,8 +390,8 @@
 
 	/* Now fill it in */
 	buf = KMALLOC(size + 1);
-	if (buf == 0) {
-		return 0;
+	if (buf == NULL) {
+		return NULL;
 	}
 
 	utf8ConstEncodeTo(chars, clength, buf);




More information about the kaffe mailing list