gpgscm: Recover cells from the list of recently allocated cells.
authorJustus Winter <justus@g10code.com>
Thu, 10 Nov 2016 13:47:00 +0000 (14:47 +0100)
committerJustus Winter <justus@g10code.com>
Thu, 10 Nov 2016 13:57:07 +0000 (14:57 +0100)
* tests/gpgscm/scheme.c (ok_to_freely_gc): Recover cells.

Signed-off-by: Justus Winter <justus@g10code.com>
tests/gpgscm/scheme.c

index 105d2a1..146b9e6 100644 (file)
@@ -805,6 +805,17 @@ static void push_recent_alloc(scheme *sc, pointer recent, pointer extra)
   car(sc->sink) = holder;
 }
 
+static INLINE void ok_to_freely_gc(scheme *sc)
+{
+  pointer a = car(sc->sink), next;
+  car(sc->sink) = sc->NIL;
+  while (a != sc->NIL)
+    {
+      next = cdr(a);
+      free_cell(sc, a);
+      a = next;
+    }
+}
 
 static pointer get_cell(scheme *sc, pointer a, pointer b)
 {
@@ -832,12 +843,6 @@ static pointer get_vector_object(scheme *sc, int len, pointer init)
   return cells;
 }
 
-static INLINE void ok_to_freely_gc(scheme *sc)
-{
-  car(sc->sink) = sc->NIL;
-}
-
-
 #if defined TSGRIND
 static void check_cell_alloced(pointer p, int expect_alloced)
 {