summaryrefslogtreecommitdiffstats
path: root/ffi.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-27 06:37:19 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-27 06:37:19 -0700
commit73874bab389305e76b8fa3726f4494a613735f5a (patch)
treeb59130141f16930fa0c93849594d44227fb3955f /ffi.c
parent7e915426a84cc4dd87743d0c1aa19e462895cc94 (diff)
downloadtxr-73874bab389305e76b8fa3726f4494a613735f5a.tar.gz
txr-73874bab389305e76b8fa3726f4494a613735f5a.tar.bz2
txr-73874bab389305e76b8fa3726f4494a613735f5a.zip
ffi: bugfix: diagnostic problems in enum put.
* ffi.c (ffi_enum_put, ffi_enum_rput): Fix function name appearing in quotes in error diagnostic. Fix nonexistent member being wrongly reported as nil.
Diffstat (limited to 'ffi.c')
-rw-r--r--ffi.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ffi.c b/ffi.c
index a555168b..89602f55 100644
--- a/ffi.c
+++ b/ffi.c
@@ -2619,10 +2619,11 @@ static void ffi_carray_put(struct txr_ffi_type *tft, val carray, mem_t *dst,
static void ffi_enum_put(struct txr_ffi_type *tft, val n, mem_t *dst, val self)
{
if (symbolp(n)) {
- n = gethash(tft->num_sym, n);
- if (!n)
- uw_throwf(error_s, lit("~s: ~s has no member ~s"), self,
+ val n_num = gethash(tft->num_sym, n);
+ if (!n_num)
+ uw_throwf(error_s, lit("~a: ~s has no member ~s"), self,
tft->syntax, n, nao);
+ n = n_num;
}
ffi_int_put(tft, n, dst, self);
}
@@ -2639,10 +2640,11 @@ static val ffi_enum_get(struct txr_ffi_type *tft, mem_t *src, val self)
static void ffi_enum_rput(struct txr_ffi_type *tft, val n, mem_t *dst, val self)
{
if (symbolp(n)) {
- n = gethash(tft->num_sym, n);
- if (!n)
- uw_throwf(error_s, lit("~s: ~s has no member ~s"), self,
+ val n_num = gethash(tft->num_sym, n);
+ if (!n_num)
+ uw_throwf(error_s, lit("~a: ~s has no member ~s"), self,
tft->syntax, n, nao);
+ n = n_num;
}
ffi_int_rput(tft, n, dst, self);
}