Remove some redundant code from shairplay CLI
authorJuho Vähä-Herttua <juhovh@iki.fi>
Sun, 14 Apr 2013 19:04:21 +0000 (22:04 +0300)
committerJuho Vähä-Herttua <juhovh@iki.fi>
Sun, 14 Apr 2013 19:05:06 +0000 (22:05 +0300)
src/shairplay.c

index bf269efbe76acbf65e421dc9cb4b6e0b350e3a69..9bb9537fd75bdafaee512b0fefa1705815356fbf 100644 (file)
@@ -226,7 +226,8 @@ parse_options(shairplay_options_t *opt, int argc, char *argv[])
        char *path = argv[0];
        char *arg;
 
-       strcpy(opt->apname, "Shairplay");
+       /* Set default values for apname and port */
+       strncpy(opt->apname, "Shairplay", sizeof(opt->apname)-1);
        opt->port = 5000;
 
        while ((arg = *++argv)) {
@@ -264,13 +265,6 @@ parse_options(shairplay_options_t *opt, int argc, char *argv[])
                }
        }
 
-       /* Set default values for apname and port */
-       if (!strlen(opt->apname)) {
-               strncpy(opt->apname, "Shairplay", sizeof(opt->apname)-1);
-       }
-       if (!opt->port) {
-               opt->port = 5000;
-       }
        return 0;
 }