summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-10 10:31:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-10 10:31:43 -0700
commit37c1f2233e74ff7ba7e9a0f3122988c8068eb2ca (patch)
tree86789f4605c1c15e5dc91f3308e7ab10de708066
parent6465dc5646363ab3c3f5c025b01bb4cbdc5f560e (diff)
downloadtxr-37c1f2233e74ff7ba7e9a0f3122988c8068eb2ca.tar.gz
txr-37c1f2233e74ff7ba7e9a0f3122988c8068eb2ca.tar.bz2
txr-37c1f2233e74ff7ba7e9a0f3122988c8068eb2ca.zip
ffi: bugfix: string semantics on typedef-d chars.
The problem is that if we have a typedef like (typedef x char) then (array 256 x) will not do string conversion in the manner of (array 256 char). This is because the raw syntax is checked for the symbol char, rather than inspecting the type object. * ffi.c (ffi_type_compile): When checking whether the array element is a char, bchar or wchar, look at the syntax in the compiled type object, not the raw syntax. The compiled type object is the original type pulled from behind the typedef alias and has the symbol char, bchar or wchar as its syntax.
-rw-r--r--ffi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ffi.c b/ffi.c
index 3871cd7d..2fa7495c 100644
--- a/ffi.c
+++ b/ffi.c
@@ -3068,11 +3068,11 @@ val ffi_type_compile(val syntax)
self, syntax, nao);
}
- if (eltype_syntax == char_s)
+ if (etft->syntax == char_s)
tft->char_conv = 1;
- else if (eltype_syntax == wchar_s)
+ else if (etft->syntax == wchar_s)
tft->wchar_conv = 1;
- else if (eltype_syntax == bchar_s)
+ else if (etft->syntax == bchar_s)
tft->bchar_conv = 1;
return type;
}