confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Confuse-devel] [PATCH 3/4] tests: ISO C90 forbids mixed declarations an


From: Carlo Marcelo Arenas Belon
Subject: [Confuse-devel] [PATCH 3/4] tests: ISO C90 forbids mixed declarations and code
Date: Sun, 4 Jan 2009 00:09:33 -0800

move declarations to the begin of each block where they are being used

Signed-off-by: Carlo Marcelo Arenas Belon <address@hidden>
---
 tests/list_plus_syntax.c   |    9 +++++----
 tests/quote_before_print.c |    6 ++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/list_plus_syntax.c b/tests/list_plus_syntax.c
index 76f62f7..53f48e7 100644
--- a/tests/list_plus_syntax.c
+++ b/tests/list_plus_syntax.c
@@ -8,13 +8,14 @@ int main(void)
         CFG_END()
     };
 
+    int rc;
     cfg_t *cfg = cfg_init(opts, CFGF_NONE);
     fail_unless(cfg);
 
-    int rc = cfg_parse_buf(cfg,
-            " stringproperty = {\"this\"}\n"
-            " stringproperty += {\"that\"}\n"
-            " stringproperty += {\"other\"}\n");
+    rc = cfg_parse_buf(cfg,
+        " stringproperty = {\"this\"}\n"
+        " stringproperty += {\"that\"}\n"
+        " stringproperty += {\"other\"}\n");
 
     fail_unless(rc == CFG_SUCCESS);
 
diff --git a/tests/quote_before_print.c b/tests/quote_before_print.c
index 15b02b9..e7e1df7 100644
--- a/tests/quote_before_print.c
+++ b/tests/quote_before_print.c
@@ -16,6 +16,8 @@ cfg_opt_t opts[] =
 int
 main(void)
 {
+       FILE *fp;
+       char *param;
        cfg_t *cfg = cfg_init(opts, CFGF_NONE);
        fail_unless(cfg);
 
@@ -25,7 +27,7 @@ main(void)
 
        /* print the config to a temporary file
         */
-       FILE *fp = tmpfile();
+       fp = tmpfile();
        fail_unless(fp);
        cfg_print(cfg, fp);
        cfg_free(cfg);
@@ -38,7 +40,7 @@ main(void)
        fail_unless(cfg_parse_fp(cfg, fp) == CFG_SUCCESS);
        fail_unless(fclose(fp) == 0);
 
-       char *param = cfg_getstr(cfg, "parameter");
+       param = cfg_getstr(cfg, "parameter");
        fail_unless(param);
 
        fail_unless(strcmp(param, "text \" with quotes and \\") == 0);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]