From 7a2672d836084c4740cb993b0d22a735d6cb6bb3 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Mon, 4 Sep 2000 01:20:12 +0200
Subject: [PATCH] Added gc_touch_all_strings, which is used when running gc in
 debug mode.

Rev: src/stralloc.c:1.99
Rev: src/stralloc.h:1.56
---
 src/stralloc.c | 17 ++++++++++++++++-
 src/stralloc.h |  3 ++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/stralloc.c b/src/stralloc.c
index 120d16069c..f9511d706a 100644
--- a/src/stralloc.c
+++ b/src/stralloc.c
@@ -25,7 +25,7 @@
 #define HUGE HUGE_VAL
 #endif /*!HUGE*/
 
-RCSID("$Id: stralloc.c,v 1.98 2000/08/15 11:41:28 grubba Exp $");
+RCSID("$Id: stralloc.c,v 1.99 2000/09/03 23:20:12 mast Exp $");
 
 #define BEGIN_HASH_SIZE 997
 #define MAX_AVG_LINK_LENGTH 3
@@ -1589,6 +1589,21 @@ void count_memory_in_strings(INT32 *num, INT32 *size)
   size[0]=size_;
 }
 
+#ifdef PIKE_DEBUG
+unsigned gc_touch_all_strings(void)
+{
+  unsigned INT32 e;
+  unsigned n = 0;
+  if (!base_table) return 0;
+  for(e=0;e<htable_size;e++)
+  {
+    struct pike_string *p;
+    for(p=base_table[e];p;p=p->next) debug_gc_touch(p), n++;
+  }
+  return n;
+}
+#endif
+
 void gc_mark_all_strings(void)
 {
   unsigned INT32 e;
diff --git a/src/stralloc.h b/src/stralloc.h
index 18d21fe56b..aa571b0920 100644
--- a/src/stralloc.h
+++ b/src/stralloc.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: stralloc.h,v 1.55 2000/08/15 11:41:45 grubba Exp $
+ * $Id: stralloc.h,v 1.56 2000/09/03 23:20:12 mast Exp $
  */
 #ifndef STRALLOC_H
 #define STRALLOC_H
@@ -228,6 +228,7 @@ PMOD_EXPORT struct pike_string *string_replace(struct pike_string *str,
 void init_shared_string_table(void);
 void cleanup_shared_string_table(void);
 void count_memory_in_strings(INT32 *num, INT32 *size);
+unsigned gc_touch_all_strings(void);
 void gc_mark_all_strings(void);
 PMOD_EXPORT void init_string_builder(struct string_builder *s, int mag);
 PMOD_EXPORT void *string_builder_allocate(struct string_builder *s,
-- 
GitLab