diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-09-24 09:41:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-09-24 09:41:54 -0700 |
commit | 658eb97af000aa0598e3544c2c7ea2cdd60b5b06 (patch) | |
tree | 81fe02dc5086c6e7f7ab6740ea5b035f19a992a1 /lib.c | |
parent | 8805225d527a576a072879a9dc21ba9a445c2f1a (diff) | |
download | txr-658eb97af000aa0598e3544c2c7ea2cdd60b5b06.tar.gz txr-658eb97af000aa0598e3544c2c7ea2cdd60b5b06.tar.bz2 txr-658eb97af000aa0598e3544c2c7ea2cdd60b5b06.zip |
Numeric constants become real constants.
Vector code cleanup.
* lib.h (zero, one, two, negone, maxint, minint): Extern declarations
removed, macros introduced for these identifiers.
* lib.c (zero, one, two, negone, maxint, minint): File scope
definitions removed.
(vector): Use vec_alloc and vec_fill enums instead of constants.
(obj_init): Remove references to removed definitions.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -66,7 +66,6 @@ val query_error_s, file_error_s, process_error_s; val nothrow_k, args_k; -val zero, one, two, negone, maxint, minint; val null_string; val nil_string; val null_list; @@ -1427,13 +1426,14 @@ val vector(val alloc) cnum alloc_plus = c_num(alloc) + 2; val vec = make_obj(); val *v = (val *) chk_malloc(alloc_plus * sizeof *v); - vec->v.type = VEC; - vec->v.vec = v + 2; #ifdef HAVE_VALGRIND vec->v.vec_true_start = v; #endif - v[0] = alloc; - v[1] = zero; + v += 2; + vec->v.type = VEC; + vec->v.vec = v; + v[vec_alloc] = alloc; + v[vec_fill] = zero; return vec; } @@ -1915,9 +1915,7 @@ static void obj_init(void) */ protect(&packages, &system_package, &keyword_package, - &user_package, &zero, &one, - &two, &negone, &maxint, &minint, - &null_string, &nil_string, + &user_package, &null_string, &nil_string, &null_list, &equal_f, &identity_f, &prog_string, (val *) 0); @@ -1926,13 +1924,6 @@ static void obj_init(void) null_string = lit(""); null_list = cons(nil, nil); - zero = num(0); - one = num(1); - two = num(2); - negone = num(-1); - maxint = num(NUM_MAX); - minint = num(NUM_MIN); - system_package = make_package(lit("sys")); keyword_package = make_package(lit("keyword")); user_package = make_package(lit("usr")); |