remove C99 features and use beautiful C89/BSD code
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 5 Apr 2010 17:48:08 +0000 (17:48 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 5 Apr 2010 17:48:08 +0000 (17:48 +0000)
makes vc++ and win32 gcc/g++ happy

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@47766 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore/Ecore_Getopt.h
src/lib/ecore/ecore_getopt.c

index a36c7a0..831e005 100644 (file)
@@ -162,7 +162,7 @@ extern "C" {
      const char *license; /**< if exists, --license will work */
      const char *description; /**< long description, possible multiline */
      unsigned char strict : 1; /**< fail on errors */
-     const Ecore_Getopt_Desc descs[]; /* NULL terminated. */
+     const Ecore_Getopt_Desc *descs; /* NULL terminated. */
   };
 
 #define ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, arg_requirement, default_value) \
index 09e47dd..8a6f672 100644 (file)
@@ -6,6 +6,23 @@
 # include <config.h>
 #endif
 
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#elif defined __GNUC__
+# define alloca __builtin_alloca
+#elif defined _AIX
+# define alloca __alloca
+#elif defined _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+#else
+# include <stddef.h>
+# ifdef  __cplusplus
+extern "C"
+# endif
+void *alloca (size_t);
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
@@ -670,9 +687,10 @@ _ecore_getopt_parse_find_short(const Ecore_Getopt *parser, char name)
 static int
 _ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser, int argc, char **argv)
 {
-   char *nonargs[argc];
+   char *nonargs;
    int src, dst, used, base;
 
+   nonargs = alloca(sizeof(char) * argc);
    src = 1;
    dst = 1;
    used = 0;