summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-10-25 17:53:40 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-10-25 17:53:40 -0700
commit0563523eb3cdc046d98013c8f6f7b374f7bb4adb (patch)
tree78ab7ba4ef23dacfd0373d026b1941b355d842b8
parent76aca0cdeb648421ebbbfc3c7e14c2d0d1878348 (diff)
downloadtxr-0563523eb3cdc046d98013c8f6f7b374f7bb4adb.tar.gz
txr-0563523eb3cdc046d98013c8f6f7b374f7bb4adb.tar.bz2
txr-0563523eb3cdc046d98013c8f6f7b374f7bb4adb.zip
* hash.c (hash_begin): Use coerce macro instead of raw C cast.
Use cobj_handle so hash argument is validated. * parser.l (YY_INPUT): Use convert macro instead of raw C cast.
-rw-r--r--ChangeLog7
-rw-r--r--hash.c5
-rw-r--r--parser.l2
3 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e326e3de..87235d7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-10-25 Kaz Kylheku <kaz@kylheku.com>
+
+ * hash.c (hash_begin): Use coerce macro instead of raw C cast.
+ Use cobj_handle so hash argument is validated.
+
+ * parser.l (YY_INPUT): Use convert macro instead of raw C cast.
+
2014-10-24 Kaz Kylheku <kaz@kylheku.com>
GNU Flex's libfl library provides nothing. Let us not refer to it. It
diff --git a/hash.c b/hash.c
index 364c5180..8a4c554b 100644
--- a/hash.c
+++ b/hash.c
@@ -666,10 +666,9 @@ static struct cobj_ops hash_iter_ops = {
val hash_begin(val hash)
{
val hi_obj;
- struct hash_iter *hi;
- struct hash *h = (struct hash *) hash->co.handle;
+ struct hash *h = coerce(struct hash *, cobj_handle(hash, hash_s));
+ struct hash_iter *hi = coerce(struct hash_iter *, chk_malloc(sizeof *hi));
- hi = coerce(struct hash_iter *, chk_malloc(sizeof *hi));
hi->next = 0;
hi->hash = nil;
hi->chain = -1;
diff --git a/parser.l b/parser.l
index e538b22c..6d47078b 100644
--- a/parser.l
+++ b/parser.l
@@ -56,7 +56,7 @@
val c = get_byte(yyextra->stream); \
int n = 0; \
if (c) \
- buf[n++] = (char) c_num(c); \
+ buf[n++] = convert(char, c_num(c)); \
result = n; \
} while (0)