summaryrefslogtreecommitdiff
path: root/libguile/array-map.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-09-09 19:27:42 +0200
committerLudovic Courtès <ludo@gnu.org>2009-09-09 19:27:42 +0200
commitd66b74dce74c2824726746e82a8a413463cb80fd (patch)
tree617dda3f2db2c40219620723fea05e2e8361b6fc /libguile/array-map.c
parentf07c349eb38d6c7b160b8980fc4007fb502e3433 (diff)
downloadguile-d66b74dce74c2824726746e82a8a413463cb80fd.tar.gz
Avoid unneeded `scm_dynwind_free ()'.
* libguile/array-map.c (indices_gc_hint): New variable. (scm_ramapc, scm_array_index_map_x): Avoid `scm_dynwind_free ()' using `scm_gc_malloc_pointerless ()'.
Diffstat (limited to 'libguile/array-map.c')
-rw-r--r--libguile/array-map.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libguile/array-map.c b/libguile/array-map.c
index fb9ceea37..eaac54a1f 100644
--- a/libguile/array-map.c
+++ b/libguile/array-map.c
@@ -37,7 +37,6 @@
#include "libguile/vectors.h"
#include "libguile/bitvectors.h"
#include "libguile/srfi-4.h"
-#include "libguile/dynwind.h"
#include "libguile/generalized-arrays.h"
#include "libguile/generalized-vectors.h"
@@ -78,6 +77,9 @@ static ra_iproc ra_asubrs[] =
{0, 0, 0}
};
+/* The WHAT argument for `scm_gc_malloc ()' et al. */
+static const char indices_gc_hint[] = "array-indices";
+
#define GVREF scm_c_generalized_vector_ref
#define GVSET scm_c_generalized_vector_set_x
@@ -311,10 +313,8 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what)
plvra = SCM_CDRLOC (*plvra);
}
- scm_dynwind_begin (0);
-
- vinds = scm_malloc (sizeof(long) * SCM_I_ARRAY_NDIM (ra0));
- scm_dynwind_free (vinds);
+ vinds = scm_gc_malloc_pointerless (sizeof(long) * SCM_I_ARRAY_NDIM (ra0),
+ indices_gc_hint);
for (k = 0; k <= kmax; k++)
vinds[k] = SCM_I_ARRAY_DIMS (ra0)[k].lbnd;
@@ -343,7 +343,6 @@ scm_ramapc (int (*cproc)(), SCM data, SCM ra0, SCM lra, const char *what)
}
while (k >= 0);
- scm_dynwind_end ();
return 1;
}
}
@@ -1015,10 +1014,8 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
if (kmax < 0)
return scm_array_set_x (ra, scm_call_0 (proc), SCM_EOL);
- scm_dynwind_begin (0);
-
- vinds = scm_malloc (sizeof(long) * SCM_I_ARRAY_NDIM (ra));
- scm_dynwind_free (vinds);
+ vinds = scm_gc_malloc_pointerless (sizeof(long) * SCM_I_ARRAY_NDIM (ra),
+ indices_gc_hint);
for (k = 0; k <= kmax; k++)
vinds[k] = SCM_I_ARRAY_DIMS (ra)[k].lbnd;
@@ -1050,7 +1047,6 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
}
while (k >= 0);
- scm_dynwind_end ();
return SCM_UNSPECIFIED;
}
else if (scm_is_generalized_vector (ra))