From 26e3e413579b9c1a15d88750a71f7cb1996b1486 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Fri, 23 Dec 2016 16:38:07 +0100 Subject: [PATCH] core: Remove make_string. * mes.c (MAKE_STRING): New macro. (make_string): Remove. Update callers. * string.c: Update callers. --- mes.c | 8 +------- string.c | 12 ++++++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/mes.c b/mes.c index 808a64e7..7e5ba3a5 100644 --- a/mes.c +++ b/mes.c @@ -184,6 +184,7 @@ SCM r3 = 0; // param 3 #define MAKE_CHAR(n) make_cell (tmp_num_ (CHAR), 0, tmp_num2_ (n)) #define MAKE_NUMBER(n) make_cell (tmp_num_ (NUMBER), 0, tmp_num2_ (n)) #define MAKE_REF(n) make_cell (tmp_num_ (REF), n, 0); +#define MAKE_STRING(x) make_cell (tmp_num_ (STRING), x, 0); SCM display_ (FILE* f, SCM x); SCM vm_call (function0_t f, SCM p1, SCM p2, SCM a); @@ -693,13 +694,6 @@ tmp_num2_ (int x) return tmp_num2; } -SCM -make_string (SCM x) -{ - g_cells[tmp_num].value = STRING; - return make_cell (tmp_num, x, 0); -} - SCM cstring_to_list (char const* s) { diff --git a/string.c b/string.c index f3eb2b17..1bc16298 100644 --- a/string.c +++ b/string.c @@ -21,7 +21,7 @@ SCM string (SCM x) ///((arity . n)) { - return make_string (x); + return MAKE_STRING (x); } SCM @@ -35,13 +35,13 @@ string_append (SCM x) ///((arity . n)) p = append2 (p, STRING (s)); x = cdr (x); } - return make_string (p); + return MAKE_STRING (p); } SCM list_to_string (SCM x) { - return make_string (x); + return MAKE_STRING (x); } SCM @@ -81,7 +81,7 @@ substring (SCM x) ///((arity . n)) p = append2 (p, cons (MAKE_CHAR (VALUE (car (s))), cell_nil)); s = cdr (s); } - return make_string (p); + return MAKE_STRING (p); } SCM @@ -94,7 +94,7 @@ number_to_string (SCM x) p = cons (MAKE_CHAR (n % 10 + '0'), p); n = n / 10; } while (n); - return make_string (p); + return MAKE_STRING (p); } SCM @@ -108,7 +108,7 @@ SCM symbol_to_string (SCM x) { assert (TYPE (x) == SYMBOL); - return make_string (STRING (x)); + return MAKE_STRING (STRING (x)); } SCM