summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-01-18 13:01:16 +0100
committerLudovic Courtès <ludo@gnu.org>2009-01-18 13:01:16 +0100
commit33ed7a1644eda55a8dc479acf26418631cb937f9 (patch)
tree091ebf05aecfe34e8d298974e3c4db814bd8e9ef
parent6bf4c3f9c1ae495a1bf401788806151f40510ec5 (diff)
downloadguile-33ed7a1644eda55a8dc479acf26418631cb937f9.tar.gz
Use `scm_gc_malloc ()' when allocating the allocated fluid vector.
* libguile/fluids.c (next_fluid_num): Use `scm_gc_malloc ()'. Don't explicitly free the previously allocated array.
-rw-r--r--libguile/fluids.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/libguile/fluids.c b/libguile/fluids.c
index 27aa98d8a..02eff9f20 100644
--- a/libguile/fluids.c
+++ b/libguile/fluids.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,2000,2001, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,2000,2001, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -152,9 +152,9 @@ next_fluid_num ()
/* FIXME: Since we use `scm_malloc ()', ALLOCATED_FLUIDS is scanned by
the GC; therefore, all fluids remain reachable for the entire
program lifetime. Hopefully this is not a problem in practice. */
- char *prev_allocated_fluids;
char *new_allocated_fluids =
- scm_malloc (allocated_fluids_len + FLUID_GROW);
+ scm_gc_malloc (allocated_fluids_len + FLUID_GROW,
+ "allocated fluids");
/* Copy over old values and initialize rest. GC can not run
during these two operations since there is no safe point in
@@ -164,16 +164,11 @@ next_fluid_num ()
memset (new_allocated_fluids + allocated_fluids_len, 0, FLUID_GROW);
n = allocated_fluids_len;
- prev_allocated_fluids = allocated_fluids;
-
/* Update the vector of allocated fluids. Dynamic states will
eventually be lazily grown to accomodate the new value of
ALLOCATED_FLUIDS_LEN in `fluid-ref' and `fluid-set!'. */
allocated_fluids = new_allocated_fluids;
allocated_fluids_len += FLUID_GROW;
-
- if (prev_allocated_fluids != NULL)
- free (prev_allocated_fluids);
}
allocated_fluids_num += 1;