remove nested functions
authorCyril Roelandt <tipecaml@gmail.com>
Wed, 25 Jan 2012 04:07:39 +0000 (05:07 +0100)
committerAntoine Jacquet <royale@zerezo.com>
Wed, 25 Jan 2012 04:07:39 +0000 (05:07 +0100)
irssistats uses nested functions (cf. irssistats.c:1566). It seems to me that nested functions are not part of the C standard (they are a GCC extension), which makes irssistats impossible to compile with compilers that do not support this feature. For example, clang fails to compile it.

irssistats.c

index ea31cee..2ac92a7 100644 (file)
@@ -1561,19 +1561,19 @@ void gen_xhtml(char *xhtmlfile)
   fclose(fic);
 }
 
   fclose(fic);
 }
 
-void parse_config(char *configfile)
+void expand(char *path)
 {
 {
-  void expand(char *path)
+  char temp[MAXLINELENGTH];
+  if (*path=='~')
   {
   {
-    char temp[MAXLINELENGTH];
-    if (*path=='~')
-    {
-      snprintf(temp,MAXLINELENGTH-1,"%s%s",getenv("HOME"),path+1);
-      temp[MAXLINELENGTH-1]='\0';
-      strcpy(path,temp);
-    }
+    snprintf(temp,MAXLINELENGTH-1,"%s%s",getenv("HOME"),path+1);
+    temp[MAXLINELENGTH-1]='\0';
+    strcpy(path,temp);
   }
   }
-  
+}
+
+void parse_config(char *configfile)
+{
   FILE *fic;
   char line[MAXLINELENGTH];
   char keyword[MAXLINELENGTH];
   FILE *fic;
   char line[MAXLINELENGTH];
   char keyword[MAXLINELENGTH];