]> gitweb.michael.orlitzky.com - iconv-quirks.git/commitdiff
main.c: just say "no" in the suffix test result
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 5 Jul 2026 18:13:35 +0000 (14:13 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 5 Jul 2026 18:13:35 +0000 (14:13 -0400)
main.c

diff --git a/main.c b/main.c
index dc4750036431876db322765d238a818610661564..238ddd12f6ce5fa6537ad93b677e552a926fca3e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,6 +1,7 @@
 #include <errno.h>
 #include <iconv.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 /* The various invalid sequences can be inferred from the table of
@@ -97,15 +98,17 @@ int _my_iconv_close(iconv_t* cd) {
  */
 int test_iconv_open_supports_suffix(const char* suffix) {
   const char* fromcode = "ASCII";
-  char tocode[64] = "ASCII";
+  char* tocode = malloc(strlen(fromcode) + strlen(suffix) + 1);
+  strcat(tocode, fromcode);
   strcat(tocode, suffix);
 
   printf("iconv_open() supports %s suffix...", suffix);
   iconv_t cd = iconv_open(tocode, fromcode);
+  free(tocode);
   if (cd == (iconv_t)(-1)) {
     switch (errno) {
       case EINVAL:
-       printf("OK (EINVAL, not supported)\n");
+       printf("no\n");
        return UNSUPPORTED;
       default:
        printf("FAIL (errno=%d, unexpected error)\n", errno);