diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-27 06:37:19 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-27 06:37:19 -0700 |
commit | 73874bab389305e76b8fa3726f4494a613735f5a (patch) | |
tree | b59130141f16930fa0c93849594d44227fb3955f /ffi.c | |
parent | 7e915426a84cc4dd87743d0c1aa19e462895cc94 (diff) | |
download | txr-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.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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); } |