diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-07-28 00:30:25 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-07-28 00:30:25 -0700 |
commit | 9b94634edc4b5134ca0aa1fc2ad94d874f7ab43c (patch) | |
tree | 4a856d0b67796ef50f1de6ebabc5346f26647199 | |
parent | 9f09b8ebd30b70dbed746d4c274516b6bbad5071 (diff) | |
download | txr-9b94634edc4b5134ca0aa1fc2ad94d874f7ab43c.tar.gz txr-9b94634edc4b5134ca0aa1fc2ad94d874f7ab43c.tar.bz2 txr-9b94634edc4b5134ca0aa1fc2ad94d874f7ab43c.zip |
stringp: rewrite.
* lib.c (stringp): Examine tag and then type separately,
rather than using the canned type function. This leads to
slightly nicer code, shorter by a couple of instructions.
-rw-r--r-- | lib.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -5093,14 +5093,22 @@ val string_get_code(val str) val stringp(val str) { - switch (type(str)) { - case LIT: - case STR: - case LSTR: + if (str) switch (tag(str)) { + case TAG_LIT: return t; + case TAG_PTR: + switch (str->t.type) { + case STR: + case LSTR: + return t; + default: + break; + } + /* fallthrough */ default: - return nil; + break; } + return nil; } val lazy_stringp(val str) |