1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Variable scope reduction

This commit is contained in:
Moritz Grimm 2017-07-07 16:34:18 +02:00
parent 8dc044fee9
commit 75b6962a33
2 changed files with 9 additions and 4 deletions

View File

@ -94,7 +94,6 @@ _set_program_name(const char *argv0)
int
cmdline_parse(int argc, char *argv[], int *ret_p)
{
int ch;
const char *playlistFile = NULL;
unsigned int verbosity = 0;
const char *err_str;
@ -103,6 +102,8 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
optind = 1;
for (;;) {
int ch;
ch = getopt(argc, argv, OPTSTRING);
if (0 > ch)
break;
@ -155,7 +156,6 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
if (playlistFile) {
playlist_t pl;
const char *entry;
if (0 > playlist_init()) {
*ret_p = 1;
@ -169,6 +169,8 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
if (pl == NULL) {
*ret_p = 1;
} else {
const char *entry;
playlist_shuffle(pl);
while (NULL != (entry = playlist_get_next(pl)))
printf("%s\n", entry);

View File

@ -277,7 +277,6 @@ playlist_program(const char *filename)
void
playlist_free(struct playlist **pl_p)
{
size_t i;
struct playlist *pl;
if (pl_p == NULL || (pl = *pl_p) == NULL)
@ -290,6 +289,8 @@ playlist_free(struct playlist **pl_p)
if (pl->list != NULL) {
if (pl->size > 0) {
size_t i;
for (i = 0; i < pl->size / sizeof(char *); i++) {
if (pl->list[i] != NULL) {
xfree(pl->list[i]);
@ -403,13 +404,15 @@ playlist_reread(struct playlist **plist)
void
playlist_shuffle(struct playlist *pl)
{
size_t d, i, range;
size_t d, i;
char *temp;
if (pl->program || pl->num < 2)
return;
for (i = 0; i < pl->num; i++) {
size_t range;
range = pl->num - i;
/*