[Commit] nickle ChangeLog, 1.105, 1.106 stack.c, 1.9, 1.10 stack.h, 1.6, 1.7

Keith Packard commit at keithp.com
Wed Dec 1 20:17:42 PST 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv32251

Modified Files:
	ChangeLog stack.c stack.h 
Log Message:
2004-12-01  Keith Packard  <keithp at keithp.com>

	* stack.c: (StackCopy):
	Must reference new stack object before allocating chunks
	lest the collector run and eat our stack.
	Zero out previous pointer to make sure the stack
	is valid in case the collector is called.
	* stack.h:
	Declare panic when debugging stack problems.


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- ChangeLog	30 Nov 2004 19:51:16 -0000	1.105
+++ ChangeLog	2 Dec 2004 04:17:39 -0000	1.106
@@ -1,3 +1,13 @@
+2004-12-01  Keith Packard  <keithp at keithp.com>
+
+	* stack.c: (StackCopy):
+	Must reference new stack object before allocating chunks
+	lest the collector run and eat our stack.
+	Zero out previous pointer to make sure the stack
+	is valid in case the collector is called.
+	* stack.h:
+	Declare panic when debugging stack problems.
+
 2004-11-30  Keith Packard  <keithp at keithp.com>
 
 	* float.c: (FloatHash):

Index: stack.c
===================================================================
RCS file: /local/src/CVS/nickle/stack.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- stack.c	9 Jul 2004 18:48:35 -0000	1.9
+++ stack.c	2 Dec 2004 04:17:39 -0000	1.10
@@ -168,12 +168,12 @@
 StackObject *
 StackCopy (StackObject *stack)
 {
-    ENTER ();
     StackObject	*new;
     StackChunk	*chunk, *nchunk, **prev;
 
     STACK_ASSERT (stack);
     new = StackCreate ();
+    REFERENCE (new);
     chunk = stack->current;
     nchunk = new->current;
     prev = &new->current;
@@ -197,11 +197,12 @@
 	 */
 	*prev = nchunk;
 	prev = &nchunk->previous;
+	*prev = 0;
 	chunk = chunk->previous;
 	nchunk = 0;
     }
     STACK_ASSERT (new);
-    RETURN (new);
+    return new;
 }
 
 static void

Index: stack.h
===================================================================
RCS file: /local/src/CVS/nickle/stack.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- stack.h	9 Jul 2004 18:48:35 -0000	1.6
+++ stack.h	2 Dec 2004 04:17:39 -0000	1.7
@@ -61,6 +61,9 @@
 			 (STACK_MIN(s) <= STACK_TOP(s) && \
 			  STACK_TOP(s) <= STACK_MAX(s)))
 
+void
+panic (char *, ...);
+
 #define STACK_ASSERT(s)	if (!STACK_VALID(s)) panic ("invalid stack\n");
 #else
 #define STACK_ASSERT(s)




More information about the Commit mailing list