gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] arend_1_32.3: bugfix in push_owl


From: Arend Bayer
Subject: [gnugo-devel] arend_1_32.3: bugfix in push_owl
Date: Thu, 11 Apr 2002 19:12:46 +0200 (CEST)

 - bugfix in push_owl
 
This is a fix to a bug introduced by arend_1_31.1. This can cause an
(unlikely) assertion failure if the owl stack is initialized with a smaller
owl_reading_depth than used later.

Arend

Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.80
diff -u -r1.80 owl.c
--- engine/owl.c        7 Apr 2002 16:57:16 -0000       1.80
+++ engine/owl.c        10 Apr 2002 23:23:58 -0000
@@ -4576,17 +4576,18 @@
 static void
 push_owl(struct local_owl_data **owl)
 {
-  /* Do we need to enlarge the stack. */
+  gg_assert(*owl == &owl_stack[owl_stack_pointer]);
+  /* Do we need to enlarge the stack? */
   if (owl_stack_pointer == owl_stack_size - 1) {
     if (0)
       gprintf("Have to enlarge owl stack!");
     owl_stack_size++;
     owl_stack = realloc(owl_stack, owl_stack_size * sizeof(*owl_stack));
     gg_assert(owl_stack != NULL);
+    *owl = &owl_stack[owl_stack_pointer];
   }
 
   /* Copy the owl data. */
-  gg_assert(*owl == &owl_stack[owl_stack_pointer]);
   owl_stack_pointer++;
   owl_stack[owl_stack_pointer] = **owl;
   *owl = &owl_stack[owl_stack_pointer];




reply via email to

[Prev in Thread] Current Thread [Next in Thread]