diff asxparser.c @ 36531:3cd07587a35d

asxparser: Declare variables in the blocks that need them.
author reimar
date Sun, 19 Jan 2014 11:13:04 +0000
parents 47edff322a99
children
line wrap: on
line diff
--- a/asxparser.c	Sun Jan 19 11:13:03 2014 +0000
+++ b/asxparser.c	Sun Jan 19 11:13:04 2014 +0000
@@ -98,13 +98,14 @@
 
 int
 asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs) {
-  char *ptr1, *ptr2, *ptr3;
+  char *ptr1;
   int n_attrib = 0;
   char **attribs = NULL;
-  char *attrib, *val;
 
   ptr1 = buffer;
   while(1) {
+    char *ptr2, *ptr3;
+    char *attrib, *val;
     for( ; strchr(SPACE,*ptr1) != NULL; ptr1++) { // Skip space
       if(*ptr1 == '\0') break;
     }
@@ -481,14 +482,14 @@
 
 static play_tree_t*
 asx_parse_entry(ASX_Parser_t* parser,char* buffer,char** _attribs) {
-  char *element,*body,**attribs;
-  int r,nref=0;
+  int nref=0;
   play_tree_t *ref;
 
   ref = play_tree_new();
 
   while(buffer && buffer[0] != '\0') {
-    r = asx_get_element(parser,&buffer,&element,&body,&attribs);
+    char *element,*body,**attribs;
+    int r = asx_get_element(parser,&buffer,&element,&body,&attribs);
     if(r < 0) {
       asx_warning_body_parse_error(parser,"ENTRY");
       return NULL;
@@ -516,10 +517,8 @@
 
 static play_tree_t*
 asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) {
-  char *element,*body,**attribs;
   play_tree_t *repeat, *list=NULL, *entry;
   char* count;
-  int r;
 
   repeat = play_tree_new();
 
@@ -535,7 +534,8 @@
   }
 
   while(buffer && buffer[0] != '\0') {
-    r = asx_get_element(parser,&buffer,&element,&body,&attribs);
+    char *element,*body,**attribs;
+    int r = asx_get_element(parser,&buffer,&element,&body,&attribs);
     if(r < 0) {
       asx_warning_body_parse_error(parser,"REPEAT");
       return NULL;