Remove large stack requirement from gentranslit.
diff --git a/ChangeLog b/ChangeLog
index 4a5b62c..1a243c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-10-01 Ben Noordhuis <info@bnoordhuis.nl> (tiny change)
+ Bruno Haible <bruno@clisp.org>
+
+ Remove large stack requirement from gentranslit.
+ * lib/gentranslit.c (main): Heap-allocate large arrays.
+ * Makefile.devel (lib/translit.h): Remove 'ulimit -s unlimited' command.
+
2015-12-10 Ben Noordhuis <info@bnoordhuis.nl> (tiny change)
Remove unused array from gentranslit.
diff --git a/Makefile.devel b/Makefile.devel
index d41dd7c..b67fdb7 100644
--- a/Makefile.devel
+++ b/Makefile.devel
@@ -189,7 +189,7 @@
lib/translit.h : lib/translit.def lib/gentranslit.c
$(CC) $(CFLAGS) lib/gentranslit.c -o gentranslit
- ulimit -s unlimited; ./gentranslit < lib/translit.def > lib/translit.h
+ ./gentranslit < lib/translit.def > lib/translit.h
$(RM) gentranslit
diff --git a/lib/gentranslit.c b/lib/gentranslit.c
index 6ebd925..845e1d6 100644
--- a/lib/gentranslit.c
+++ b/lib/gentranslit.c
@@ -27,13 +27,20 @@
int main (int argc, char *argv[])
{
- unsigned int data[0x100000];
- int uni2index[0x110000];
+ unsigned int *data;
+ int *uni2index;
int index;
if (argc != 1)
exit(1);
+ data = malloc(0x100000 * sizeof(*data));
+ uni2index = malloc(0x110000 * sizeof(*uni2index));
+ if (data == NULL || uni2index == NULL) {
+ fprintf(stderr, "out of memory\n");
+ exit(1);
+ }
+
printf("/*\n");
printf(" * Copyright (C) 1999-2003 Free Software Foundation, Inc.\n");
printf(" * This file is part of the GNU LIBICONV Library.\n");