guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-core/libguile gc.h gc.c


From: Marius Vollmer
Subject: guile/guile-core/libguile gc.h gc.c
Date: Sun, 20 May 2001 12:27:22 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/05/20 12:27:22

Modified files:
        guile-core/libguile: gc.h gc.c 

Log message:
        * gc.h, gc.c (scm_must_strdup, scm_must_strndup): New.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/gc.h.diff?cvsroot=OldCVS&tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/gc.c.diff?cvsroot=OldCVS&tr1=1.198&tr2=1.199&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/gc.c
diff -u guile/guile-core/libguile/gc.c:1.198 
guile/guile-core/libguile/gc.c:1.199
--- guile/guile-core/libguile/gc.c:1.198        Sat May 19 17:35:43 2001
+++ guile/guile-core/libguile/gc.c      Sun May 20 12:27:22 2001
@@ -1985,6 +1985,20 @@
   scm_memory_error (what);
 }
 
+char *
+scm_must_strndup (const char *str, unsigned long length)
+{
+  char * dst = scm_must_malloc (length + 1, "scm_must_strndup");
+  memcpy (dst, str, length);
+  dst[length] = 0;
+  return dst;
+}
+
+char *
+scm_must_strdup (const char *str)
+{
+  return scm_must_strndup (str, strlen (str));
+}
 
 void
 scm_must_free (void *obj)
Index: guile/guile-core/libguile/gc.h
diff -u guile/guile-core/libguile/gc.h:1.73 guile/guile-core/libguile/gc.h:1.74
--- guile/guile-core/libguile/gc.h:1.73 Tue May 15 02:45:10 2001
+++ guile/guile-core/libguile/gc.h      Sun May 20 12:27:22 2001
@@ -370,6 +370,8 @@
 extern void * scm_must_realloc (void *where,
                                scm_sizet olen, scm_sizet len,
                                const char *what);
+extern char *scm_must_strdup (const char *str);
+extern char *scm_must_strndup (const char *str, unsigned long n);
 extern void scm_done_malloc (long size);
 extern void scm_done_free (long size);
 extern void scm_must_free (void *obj);



reply via email to

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