From f8176fef4f5e81b96aee75cb3a20193fb9580fc4 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 2 Nov 2020 15:55:55 -0500 Subject: [PATCH] Add plain stringFromSlice() Doesn't try to ignore quote marks. objFromSlice() utilizes it, but should have the same behavior as before. --- src/object.c | 7 ++++++- src/object.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/object.c b/src/object.c index 4a2ecab..5a00b9b 100644 --- a/src/object.c +++ b/src/object.c @@ -668,7 +668,12 @@ inline Object boolObject(int b) // Skips first and last chars! Assumed to be '"' inline Object objFromSlice(const char *string, int len) { - Object o = symFromSlice(&string[1], len - 1); + return stringFromSlice(&string[1], len - 1); +} + +inline Object stringFromSlice(const char *string, int len) +{ + Object o = symFromSlice(string, len); o.type = TYPE_STRING; return o; } diff --git a/src/object.h b/src/object.h index 68bbe55..0841a57 100644 --- a/src/object.h +++ b/src/object.h @@ -124,6 +124,7 @@ Object newObject(Type type); Object listObject(); Object startList(const Object start); Object objFromSlice(const char *string, int len); +Object stringFromSlice(const char *string, int len); Object symFromSlice(const char *string, int len); Object boolObject(int b); Object numberObject(int num);