* Small change - pre-define a couple variables.

This commit is contained in:
Justin Maggard 2009-04-30 06:47:06 +00:00
parent 7315d001a5
commit e509e8fe68

View File

@ -224,6 +224,9 @@ init(int argc, char * * argv)
const char * presurl = 0; const char * presurl = 0;
const char * optionsfile = "/etc/minidlna.conf"; const char * optionsfile = "/etc/minidlna.conf";
char * mac_str = calloc(1, 64); char * mac_str = calloc(1, 64);
char * string, * word;
enum media_types type;
char * path;
/* first check if "-f" option is used */ /* first check if "-f" option is used */
for(i=2; i<argc; i++) for(i=2; i<argc; i++)
@ -315,8 +318,7 @@ init(int argc, char * * argv)
friendly_name[FRIENDLYNAME_MAX_LEN-1] = '\0'; friendly_name[FRIENDLYNAME_MAX_LEN-1] = '\0';
break; break;
case UPNPMEDIADIR: case UPNPMEDIADIR:
usleep(1); type = ALL_MEDIA;
enum media_types type = ALL_MEDIA;
char * myval = NULL; char * myval = NULL;
switch( ary_options[i].value[0] ) switch( ary_options[i].value[0] )
{ {
@ -334,8 +336,7 @@ init(int argc, char * * argv)
type = IMAGES_ONLY; type = IMAGES_ONLY;
myval = index(ary_options[i].value, '/'); myval = index(ary_options[i].value, '/');
case '/': case '/':
usleep(1); path = realpath(myval ? myval:ary_options[i].value, NULL);
char * path = realpath(myval ? myval:ary_options[i].value, NULL);
if( access(path, F_OK) != 0 ) if( access(path, F_OK) != 0 )
{ {
fprintf(stderr, "Media directory not accessible! [%s]\n", fprintf(stderr, "Media directory not accessible! [%s]\n",
@ -365,8 +366,6 @@ init(int argc, char * * argv)
} }
break; break;
case UPNPALBUMART_NAMES: case UPNPALBUMART_NAMES:
usleep(1);
char *string, *word;
for( string = ary_options[i].value; (word = strtok(string, "/")); string = NULL ) { for( string = ary_options[i].value; (word = strtok(string, "/")); string = NULL ) {
struct album_art_name_s * this_name = calloc(1, sizeof(struct album_art_name_s)); struct album_art_name_s * this_name = calloc(1, sizeof(struct album_art_name_s));
this_name->name = strdup(word); this_name->name = strdup(word);