mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* Deprecated scm_vector_set_length_x.
* Zero length vectors do not allocate dummy memory any more.
This commit is contained in:
parent
c7ec8671f8
commit
1b9be268c8
6 changed files with 59 additions and 39 deletions
4
NEWS
4
NEWS
|
@ -159,6 +159,10 @@ Use scm_catch or scm_lazy_catch from throw.[ch] instead.
|
|||
|
||||
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.
|
||||
|
|
1
RELEASE
1
RELEASE
|
@ -47,6 +47,7 @@ In release 1.6:
|
|||
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).
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
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
|
||||
|
|
|
@ -1025,14 +1025,7 @@ scm_igc (const char *what)
|
|||
|
||||
#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);
|
||||
|
@ -1057,10 +1050,6 @@ scm_igc (const char *what)
|
|||
|
||||
#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]);
|
||||
|
@ -1615,9 +1604,15 @@ scm_gc_sweep ()
|
|||
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));
|
||||
|
@ -1656,15 +1651,8 @@ scm_gc_sweep ()
|
|||
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;
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
#include "libguile/unif.h"
|
||||
|
||||
|
||||
#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
|
||||
|
@ -129,6 +135,8 @@ scm_vector_set_length_x (SCM vect, SCM len)
|
|||
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)")
|
||||
|
@ -263,22 +271,32 @@ SCM_DEFINE (scm_make_vector, "make-vector", 1, 1, 0,
|
|||
#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
|
||||
|
@ -390,8 +408,6 @@ void
|
|||
scm_init_vectors ()
|
||||
{
|
||||
#include "libguile/vectors.x"
|
||||
/*
|
||||
scm_make_subr (s_resizuve, scm_tc7_subr_2, scm_vector_set_length_x); */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
|
||||
|
||||
|
||||
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);
|
||||
|
@ -92,6 +91,7 @@ extern void scm_init_vectors (void);
|
|||
#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 */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue