mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* Cleaned up memory error signalling.
This commit is contained in:
parent
9b166f1273
commit
2500356c67
9 changed files with 29 additions and 17 deletions
|
@ -1,3 +1,16 @@
|
|||
2000-06-29 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* __scm.h (SCM_NALLOC): Removed.
|
||||
|
||||
* error.c (scm_wta): Removed sick dispatch code for memory
|
||||
errors. (More sick dispatches still to be removed.)
|
||||
|
||||
* numbers.c (scm_mkbig, scm_adjbig), ports.c (scm_make_port_type),
|
||||
random.c (scm_i_copy_rstate, scm_c_make_rstate), smob.c
|
||||
(scm_make_smob_type), srcprop.c (scm_make_srcprops), vectors.c
|
||||
(scm_vector_set_length_x): Now using scm_memory_error to signal
|
||||
memory errors.
|
||||
|
||||
2000-06-29 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* __scm.h: Removed some commented code and fixed some comments.
|
||||
|
|
|
@ -555,7 +555,6 @@ extern SCM scm_apply_generic (SCM gf, SCM args);
|
|||
*/
|
||||
#define SCM_WNA 8
|
||||
#define SCM_OUTOFRANGE 10
|
||||
#define SCM_NALLOC 11
|
||||
|
||||
#endif /* SCM_MAGIC_SNARFER */
|
||||
|
||||
|
|
|
@ -318,8 +318,6 @@ scm_wta (SCM arg, const char *pos, const char *s_subr)
|
|||
scm_wrong_num_args (arg);
|
||||
case SCM_OUTOFRANGE:
|
||||
scm_out_of_range (s_subr, arg);
|
||||
case SCM_NALLOC:
|
||||
scm_memory_error (s_subr);
|
||||
default:
|
||||
/* this shouldn't happen. */
|
||||
scm_misc_error (s_subr, "Unknown error", SCM_EOL);
|
||||
|
|
|
@ -1319,7 +1319,7 @@ scm_mkbig (scm_sizet nlen, int sign)
|
|||
/* Cast to long int to avoid signed/unsigned comparison warnings. */
|
||||
if ((( ((long int) nlen) << SCM_BIGSIZEFIELD) >> SCM_BIGSIZEFIELD)
|
||||
!= (long int) nlen)
|
||||
scm_wta (SCM_MAKINUM (nlen), (char *) SCM_NALLOC, s_bignum);
|
||||
scm_memory_error (s_bignum);
|
||||
|
||||
SCM_NEWCELL (v);
|
||||
SCM_DEFER_INTS;
|
||||
|
@ -1356,7 +1356,7 @@ scm_adjbig (SCM b, scm_sizet nlen)
|
|||
{
|
||||
scm_sizet nsiz = nlen;
|
||||
if (((nsiz << SCM_BIGSIZEFIELD) >> SCM_BIGSIZEFIELD) != nlen)
|
||||
scm_wta (scm_ulong2num (nsiz), (char *) SCM_NALLOC, s_adjbig);
|
||||
scm_memory_error (s_adjbig);
|
||||
|
||||
SCM_DEFER_INTS;
|
||||
{
|
||||
|
|
|
@ -151,8 +151,10 @@ scm_make_port_type (char *name,
|
|||
}
|
||||
SCM_ALLOW_INTS;
|
||||
if (!tmp)
|
||||
ptoberr:scm_wta (SCM_MAKINUM ((long) scm_numptob),
|
||||
(char *) SCM_NALLOC, "scm_make_port_type");
|
||||
{
|
||||
ptoberr:
|
||||
scm_memory_error ("scm_make_port_type");
|
||||
}
|
||||
/* Make a class object if Goops is present */
|
||||
if (scm_port_class)
|
||||
scm_make_port_classes (scm_numptob - 1, SCM_PTOBNAME (scm_numptob - 1));
|
||||
|
|
|
@ -171,8 +171,7 @@ scm_i_copy_rstate (scm_i_rstate *state)
|
|||
{
|
||||
scm_rstate *new_state = malloc (scm_the_rng.rstate_size);
|
||||
if (new_state == 0)
|
||||
scm_wta (SCM_MAKINUM (scm_the_rng.rstate_size),
|
||||
(char *) SCM_NALLOC, "rstate");
|
||||
scm_memory_error ("rstate");
|
||||
return memcpy (new_state, state, scm_the_rng.rstate_size);
|
||||
}
|
||||
|
||||
|
@ -186,9 +185,7 @@ scm_c_make_rstate (char *seed, int n)
|
|||
{
|
||||
scm_rstate *state = malloc (scm_the_rng.rstate_size);
|
||||
if (state == 0)
|
||||
scm_wta (SCM_MAKINUM (scm_the_rng.rstate_size),
|
||||
(char *) SCM_NALLOC,
|
||||
"rstate");
|
||||
scm_memory_error ("rstate");
|
||||
state->reserved0 = 0;
|
||||
scm_the_rng.init_rstate (state, seed, n);
|
||||
return state;
|
||||
|
|
|
@ -144,9 +144,11 @@ scm_make_smob_type (char *name, scm_sizet size)
|
|||
scm_numsmob++;
|
||||
}
|
||||
SCM_ALLOW_INTS;
|
||||
if (!tmp)
|
||||
smoberr:scm_wta (SCM_MAKINUM ((long) scm_numsmob),
|
||||
(char *) SCM_NALLOC, "scm_make_smob_type");
|
||||
if (!tmp)
|
||||
{
|
||||
smoberr:
|
||||
scm_memory_error ("scm_make_smob_type");
|
||||
}
|
||||
/* Make a class object if Goops is present. */
|
||||
if (scm_smob_class)
|
||||
scm_smob_class[scm_numsmob - 1]
|
||||
|
|
|
@ -132,7 +132,8 @@ scm_make_srcprops (int line, int col, SCM filename, SCM copy, SCM plist)
|
|||
scm_sizet n = sizeof (scm_srcprops_chunk)
|
||||
+ sizeof (scm_srcprops) * (SRCPROPS_CHUNKSIZE - 1);
|
||||
SCM_SYSCALL (mem = (scm_srcprops_chunk *) malloc (n));
|
||||
SCM_ASSERT (mem, SCM_UNDEFINED, SCM_NALLOC, "srcprops");
|
||||
if (mem == NULL)
|
||||
scm_memory_error ("srcprops");
|
||||
scm_mallocated += n;
|
||||
mem->next = srcprops_chunklist;
|
||||
srcprops_chunklist = mem;
|
||||
|
|
|
@ -103,7 +103,7 @@ scm_vector_set_length_x (SCM vect, SCM len)
|
|||
l = 1L;
|
||||
siz = l * sz;
|
||||
if (siz != l * sz)
|
||||
scm_wta (SCM_MAKINUM (l * sz), (char *) SCM_NALLOC, s_vector_set_length_x);
|
||||
scm_memory_error (s_vector_set_length_x);
|
||||
SCM_REDEFER_INTS;
|
||||
SCM_SETCHARS (vect,
|
||||
((char *)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue