mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2025-02-02 15:07:45 -05:00
Variable scope reduction
This commit is contained in:
parent
8dc044fee9
commit
75b6962a33
@ -94,7 +94,6 @@ _set_program_name(const char *argv0)
|
|||||||
int
|
int
|
||||||
cmdline_parse(int argc, char *argv[], int *ret_p)
|
cmdline_parse(int argc, char *argv[], int *ret_p)
|
||||||
{
|
{
|
||||||
int ch;
|
|
||||||
const char *playlistFile = NULL;
|
const char *playlistFile = NULL;
|
||||||
unsigned int verbosity = 0;
|
unsigned int verbosity = 0;
|
||||||
const char *err_str;
|
const char *err_str;
|
||||||
@ -103,6 +102,8 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
|
|||||||
|
|
||||||
optind = 1;
|
optind = 1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
int ch;
|
||||||
|
|
||||||
ch = getopt(argc, argv, OPTSTRING);
|
ch = getopt(argc, argv, OPTSTRING);
|
||||||
if (0 > ch)
|
if (0 > ch)
|
||||||
break;
|
break;
|
||||||
@ -155,7 +156,6 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
|
|||||||
|
|
||||||
if (playlistFile) {
|
if (playlistFile) {
|
||||||
playlist_t pl;
|
playlist_t pl;
|
||||||
const char *entry;
|
|
||||||
|
|
||||||
if (0 > playlist_init()) {
|
if (0 > playlist_init()) {
|
||||||
*ret_p = 1;
|
*ret_p = 1;
|
||||||
@ -169,6 +169,8 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
|
|||||||
if (pl == NULL) {
|
if (pl == NULL) {
|
||||||
*ret_p = 1;
|
*ret_p = 1;
|
||||||
} else {
|
} else {
|
||||||
|
const char *entry;
|
||||||
|
|
||||||
playlist_shuffle(pl);
|
playlist_shuffle(pl);
|
||||||
while (NULL != (entry = playlist_get_next(pl)))
|
while (NULL != (entry = playlist_get_next(pl)))
|
||||||
printf("%s\n", entry);
|
printf("%s\n", entry);
|
||||||
|
@ -277,7 +277,6 @@ playlist_program(const char *filename)
|
|||||||
void
|
void
|
||||||
playlist_free(struct playlist **pl_p)
|
playlist_free(struct playlist **pl_p)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
struct playlist *pl;
|
struct playlist *pl;
|
||||||
|
|
||||||
if (pl_p == NULL || (pl = *pl_p) == NULL)
|
if (pl_p == NULL || (pl = *pl_p) == NULL)
|
||||||
@ -290,6 +289,8 @@ playlist_free(struct playlist **pl_p)
|
|||||||
|
|
||||||
if (pl->list != NULL) {
|
if (pl->list != NULL) {
|
||||||
if (pl->size > 0) {
|
if (pl->size > 0) {
|
||||||
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < pl->size / sizeof(char *); i++) {
|
for (i = 0; i < pl->size / sizeof(char *); i++) {
|
||||||
if (pl->list[i] != NULL) {
|
if (pl->list[i] != NULL) {
|
||||||
xfree(pl->list[i]);
|
xfree(pl->list[i]);
|
||||||
@ -403,13 +404,15 @@ playlist_reread(struct playlist **plist)
|
|||||||
void
|
void
|
||||||
playlist_shuffle(struct playlist *pl)
|
playlist_shuffle(struct playlist *pl)
|
||||||
{
|
{
|
||||||
size_t d, i, range;
|
size_t d, i;
|
||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
if (pl->program || pl->num < 2)
|
if (pl->program || pl->num < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < pl->num; i++) {
|
for (i = 0; i < pl->num; i++) {
|
||||||
|
size_t range;
|
||||||
|
|
||||||
range = pl->num - i;
|
range = pl->num - i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user