summaryrefslogtreecommitdiffstats
path: root/rope.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitc7d035ae1a729232579a0fe41ed5affa131d3623 (patch)
treefb387f7c2a8e01cf603d4c75fbbaa68f711df986 /rope.c
parentdeda2c0fd8689349fea2a900199a76ff7ecb319e (diff)
downloadscm-c7d035ae1a729232579a0fe41ed5affa131d3623.tar.gz
scm-c7d035ae1a729232579a0fe41ed5affa131d3623.zip
Import Upstream version 5d9upstream/5d9
Diffstat (limited to 'rope.c')
-rw-r--r--rope.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/rope.c b/rope.c
index af62c41..b4ca0d4 100644
--- a/rope.c
+++ b/rope.c
@@ -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);
}