loop cleanup patch from ashridah

This commit is contained in:
Bill Currie 2004-02-07 07:00:25 +00:00
parent 6342a9bdd7
commit 85cd891d8c

View file

@ -275,7 +275,6 @@ I_OGGMus_Info (void)
plitem_t *currenttrack = NULL;
int count = 0, iter = 0, highesttrack = 0;
const char *trackstring;
char **mapoutput = NULL;
if (!tracklist) {
Sys_Printf ("\n" "No Tracklist\n" "------------\n");
@ -308,11 +307,6 @@ I_OGGMus_Info (void)
}
Sys_DPrintf ("Highest Track number = %i.\n", highesttrack);
/* allocate a null terminated array of char *'s */
mapoutput = calloc (highesttrack + 1, sizeof (char *));
if (!mapoutput)
Sys_Error ("couldn't allocate mapoutput array!\n");
/* loop until we've extracted 'numval' trackmaps, or hit the highest track
* number */
for (iter = 0, count = 0; (iter < ((plarray_t *) keylist->data)->numvals
@ -323,20 +317,10 @@ I_OGGMus_Info (void)
Sys_DPrintf ("Skipping trackstring: %s.\n", trackstring);
continue;
}
mapoutput[iter] = nva (" %s - %s", trackstring,
(char *) currenttrack->data);
if (!mapoutput[iter])
Sys_Error ("I_OGGMus: couldn't allocate mapstring!\n");
Sys_Printf (" %s - %s\n", trackstring, (char *) currenttrack->data);
iter++;
}
/* output the map, and delete the allocated strings */
for (iter = 0; (iter < ((plarray_t *) (keylist->data))->numvals); iter++) {
Sys_Printf ("%s\n", mapoutput[iter]);
free (mapoutput[iter]);
}
free (mapoutput);
PL_Free (keylist);
}