* Zero length vectors do not allocate dummy memory any more.
Use scm_string_hash instead.
+** Deprecated function: scm_vector_set_length_x
+
+Instead, create a fresh vector of the desired size and copy the contents.
+
** scm_gensym has changed prototype
scm_gensym now only takes one argument.
SCM_ALRM_SIGNAL, SCM_GC_SIGNAL, SCM_TICK_SIGNAL, SCM_SIG_ORD,
SCM_ORD_SIG, SCM_NUM_SIGS, SCM_SLOPPY_STRINGP, SCM_VALIDATE_STRINGORSUBSTR,
SCM_FREEP, SCM_NFREEP
+- remove scm_vector_set_length_x
- remove function scm_call_catching_errors
(replaced by catch functions from throw.[ch])
- remove support for "#&" reader syntax in (ice-9 optargs).
+2000-10-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * gc.c (scm_igc): Remove references to scm_vector_set_length_x.
+
+ (scm_gc_sweep): SCM_CONTREGS is never NULL.
+
+ * gc.c (scm_gc_sweep), vectors.c (scm_make_vector): Don't
+ allocate/free memory for zero length vectors.
+
+ * vectors.[ch] (scm_vector_set_length_x): Deprecated.
+
2000-10-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
* alist.c (scm_assq_ref): Add a suggestion about how to deal with
#ifndef USE_THREADS
- /* Protect from the C stack. This must be the first marking
- * done because it provides information about what objects
- * are "in-use" by the C code. "in-use" objects are those
- * for which the information about length and base address must
- * remain usable. This requirement is stricter than a liveness
- * requirement -- in particular, it constrains the implementation
- * of scm_vector_set_length_x.
- */
+ /* Mark objects on the C stack. */
SCM_FLUSH_REGISTER_WINDOWS;
/* This assumes that all registers are saved into the jmp_buf */
setjmp (scm_save_regs_gc_mark);
#endif /* USE_THREADS */
- /* FIXME: insert a phase to un-protect string-data preserved
- * in scm_vector_set_length_x.
- */
-
j = SCM_NUM_PROTECTS;
while (j--)
scm_gc_mark (scm_sys_protects[j]);
scm_must_free (SCM_VECTOR_BASE (scmptr) - 2);
break;
case scm_tc7_vector:
- m += (SCM_VECTOR_LENGTH (scmptr) * sizeof (SCM));
- scm_must_free (SCM_VECTOR_BASE (scmptr));
- break;
+ {
+ unsigned long int length = SCM_VECTOR_LENGTH (scmptr);
+ if (length > 0)
+ {
+ m += length * sizeof (scm_bits_t);
+ scm_must_free (SCM_VECTOR_BASE (scmptr));
+ }
+ break;
+ }
#ifdef CCLO
case scm_tc7_cclo:
m += (SCM_CCLO_LENGTH (scmptr) * sizeof (SCM));
case scm_tc7_contin:
m += SCM_CONTINUATION_LENGTH (scmptr) * sizeof (SCM_STACKITEM)
+ sizeof (scm_contregs);
- if (SCM_CONTREGS (scmptr))
- {
- scm_must_free (SCM_CONTREGS (scmptr));
- break;
- }
- else
- {
- continue;
- }
+ scm_must_free (SCM_CONTREGS (scmptr));
+ break;
case scm_tcs_subrs:
/* the various "subrs" (primitives) are never freed */
continue;
#include "libguile/unif.h"
\f
+#if (SCM_DEBUG_DEPRECATED == 0)
+
+/* The function scm_vector_set_length_x will disappear in the next release of
+ * guile.
+ */
+
/*
* This complicates things too much if allowed on any array.
* C code can safely call it on arrays known to be used in a single
return vect;
}
+#endif /* (SCM_DEBUG_DEPRECATED == 0) */
+
SCM_DEFINE (scm_vector_p, "vector?", 1, 0, 0,
(SCM obj),
"Returns @t{#t} if @var{obj} is a vector, otherwise returns @t{#f}. (r5rs)")
#define FUNC_NAME s_scm_make_vector
{
SCM v;
- register long i;
- register long j;
- register SCM *velts;
+ unsigned long int i;
+ scm_bits_t *velts;
- SCM_VALIDATE_INUM_MIN (1,k,0);
- if (SCM_UNBNDP(fill))
+ SCM_VALIDATE_INUM_MIN (1, k, 0);
+ if (SCM_UNBNDP (fill))
fill = SCM_UNSPECIFIED;
- i = SCM_INUM(k);
- SCM_NEWCELL(v);
+
+ i = SCM_INUM (k);
+ SCM_NEWCELL (v);
+
+ velts = (i != 0)
+ ? scm_must_malloc (i * sizeof (scm_bits_t), FUNC_NAME)
+ : NULL;
+
SCM_DEFER_INTS;
- SCM_SETCHARS(v, scm_must_malloc(i?(long)(i*sizeof(SCM)):1L, FUNC_NAME));
- velts = SCM_VELTS(v);
- for (j = 0; j < i; ++j)
- velts[j] = fill;
- SCM_SETLENGTH(v, i, scm_tc7_vector);
+ {
+ unsigned long int j;
+
+ for (j = 0; j != i; ++j)
+ velts[j] = SCM_UNPACK (fill);
+
+ SCM_SETCHARS (v, velts);
+ SCM_SETLENGTH (v, i, scm_tc7_vector);
+ }
SCM_ALLOW_INTS;
+
return v;
}
#undef FUNC_NAME
scm_init_vectors ()
{
#include "libguile/vectors.x"
- /*
- scm_make_subr (s_resizuve, scm_tc7_subr_2, scm_vector_set_length_x); */
}
\f
-extern SCM scm_vector_set_length_x (SCM vect, SCM len);
extern SCM scm_vector_p (SCM x);
extern SCM scm_vector_length (SCM v);
extern SCM scm_vector (SCM l);
#if (SCM_DEBUG_DEPRECATED == 0)
#define SCM_NVECTORP(x) (!SCM_VECTORP (x))
+extern SCM scm_vector_set_length_x (SCM vect, SCM len);
#endif /* SCM_DEBUG_DEPRECATED == 0 */