From: bdemsky Date: Wed, 25 Oct 2006 00:47:04 +0000 (+0000) Subject: Check if pointers are null X-Git-Tag: preEdgeChange~807 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f9243d11334b3272f797321e8ea2e2a542bbfa53;p=IRC.git Check if pointers are null --- diff --git a/Robust/src/Runtime/checkpoint.c b/Robust/src/Runtime/checkpoint.c index 3a35a471..b7efc1de 100644 --- a/Robust/src/Runtime/checkpoint.c +++ b/Robust/src/Runtime/checkpoint.c @@ -37,7 +37,9 @@ void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * f int i; for(i=0;i___length___)+sizeof(int)))[i]; - if (RuntimeHashcontainskey(forward, (int) objptr)) + if (objptr==NULL) { + ((void **)(((char *)& ao->___length___)+sizeof(int)))[i]=NULL; + } else if (RuntimeHashcontainskey(forward, (int) objptr)) RuntimeHashget(forward,(int) objptr,(int *) &((void **)(((char *)& ao->___length___)+sizeof(int)))[i]); else { void * copy=createcopy(objptr); @@ -53,7 +55,9 @@ void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * f for(i=1;i<=size;i++) { int offset=pointer[i]; void * objptr=*((void **)(((int)ptr)+offset)); - if (RuntimeHashcontainskey(forward, (int) objptr)) + if (objptr==NULL) { + *((void **) (((int)cpy)+offset))=NULL; + } else if (RuntimeHashcontainskey(forward, (int) objptr)) RuntimeHashget(forward, (int) objptr, (int *) &(((char *)cpy)[offset])); else { void * copy=createcopy(objptr); @@ -131,7 +135,10 @@ void restorecheckpoint(int numparams, void ** original, void ** checkpoint, stru for(i=0;i___length___)+sizeof(int)))[i]; - RuntimeHashget(reverse, (int) objptr, (int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); + if (objptr==NULL) + ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=NULL; + else + RuntimeHashget(reverse, (int) objptr, (int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); } } else { int numptr=pointer[0]; @@ -144,7 +151,10 @@ void restorecheckpoint(int numparams, void ** original, void ** checkpoint, stru for(i=1;i<=numptr;i++) { int offset=pointer[i]; void * objptr=*((void **)(((int)ptr)+offset)); - RuntimeHashget(reverse, (int) objptr, (int *) &(((char *)cpy)[offset])); + if (objptr==NULL) + *((void **) (((int)cpy)+offset))=NULL; + else + RuntimeHashget(reverse, (int) objptr, (int *) &(((char *)cpy)[offset])); } if (hasflags[type]) { (((void **)cpy)[2])=flagptr;