diff options
Diffstat (limited to 'rope.c')
-rw-r--r-- | rope.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -85,7 +85,7 @@ unsigned char num2uchar(num, pos, s_caller) char *pos, *s_caller; { unsigned long res = INUM(num); - ASSERT(INUMP(num) && (255L >= res), num, pos, s_caller); + ASRTER(INUMP(num) && (255L >= res), num, pos, s_caller); return (unsigned char) res; } unsigned short num2ushort(num, pos, s_caller) @@ -93,7 +93,7 @@ unsigned short num2ushort(num, pos, s_caller) char *pos, *s_caller; { unsigned long res = INUM(num); - ASSERT(INUMP(num) && (65535L >= res), num, pos, s_caller); + ASRTER(INUMP(num) && (65535L >= res), num, pos, s_caller); return (unsigned short) res; } unsigned long num2ulong(num, pos, s_caller) @@ -223,7 +223,7 @@ char **makargvfrmstrs(args, s_name) int argc = ilength(args); argv = (char **)must_malloc((1L+argc)*sizeof(char *), s_vector); for(argc = 0; NNULLP(args); args=CDR(args), ++argc) { - ASSERT(NIMP(CAR(args)) && STRINGP(CAR(args)), CAR(args), ARG2, s_name); + ASRTER(NIMP(CAR(args)) && STRINGP(CAR(args)), CAR(args), ARG2, s_name); { sizet len = 1 + LENGTH(CAR(args)); char *dst = (char *)must_malloc((long)len, s_string); @@ -300,13 +300,13 @@ unsigned long scm_addr(args, s_name) } else { if NIMP(args) { - ASSERT(CONSP(args) && INUMP(CAR(args)), args, ARG2, s_name); + ASRTER(CONSP(args) && INUMP(CAR(args)), args, ARG2, s_name); pos = INUM(CAR(args)); ASRTGO(NULLP(CDR(args)), wna); } else if NULLP(args) pos = 0; else { - ASSERT(INUMP(args), args, ARG2, s_name); + ASRTER(INUMP(args), args, ARG2, s_name); pos = INUM(args); } ASRTGO(pos >= 0 && pos < LENGTH(v), outrng); @@ -418,8 +418,11 @@ SCM scm_gc_protect(obj) SCM obj; { long len; - ASSERT(NIMP(scm_uprotects), MAKINUM(20), NALLOC, "protects"); + ASRTER(NIMP(scm_uprotects), MAKINUM(20), NALLOC, "protects"); if IMP(obj) return obj; + for (len = LENGTH(scm_uprotects);len--;) { + if (obj==VELTS(scm_uprotects)[len]) return obj; + } len = LENGTH(scm_uprotects); if (scm_protidx >= len) resizuve(scm_uprotects, MAKINUM(len + (len>>2))); VELTS(scm_uprotects)[scm_protidx++] = obj; @@ -428,5 +431,6 @@ SCM scm_gc_protect(obj) void init_rope() { + scm_protidx = 0; scm_uprotects = make_vector(MAKINUM(20), UNDEFINED); } |