Skip to content

Commit 773cb61

Browse files
committed
main.c: suppress warn that optarg hides global optarg
1 parent 5ed1615 commit 773cb61

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,21 +352,21 @@ struct coder_opts
352352
char* val;
353353
};
354354
static bool
355-
assign_coder_opt(struct coder_opts* encoder_opts, struct coder_opts* decoder_opts, char* optarg)
355+
assign_coder_opt(struct coder_opts* encoder_opts, struct coder_opts* decoder_opts, char* optval)
356356
{
357-
char* opt = optarg;
358-
char* delim = strchr(optarg, '=');
357+
char* opt = optval;
358+
char* delim = strchr(optval, '=');
359359
if ( delim == NULL ) {
360-
fprintf(stderr, "No value for %s!\n", optarg);
360+
fprintf(stderr, "No value for %s!\n", optval);
361361
return false;
362362
}
363-
if ( strncmp(optarg, "enc_", 4) != 0 && strncmp(optarg, "dec_", 4) != 0 ) {
364-
fprintf(stderr, "Option should start with either enc_ or dec_, given %s!\n", optarg);
363+
if ( strncmp(optval, "enc_", 4) != 0 && strncmp(optval, "dec_", 4) != 0 ) {
364+
fprintf(stderr, "Option should start with either enc_ or dec_, given %s!\n", optval);
365365
return false;
366366
}
367367
*delim = '\0';
368368
char *val = delim + 1;
369-
struct coder_opts* opts = strncmp(optarg, "enc_", 4) == 0 ? encoder_opts : decoder_opts;
369+
struct coder_opts* opts = strncmp(optval, "enc_", 4) == 0 ? encoder_opts : decoder_opts;
370370
for ( int i = 0; i < CODER_OPTS_COUNT; ++i ) {
371371
if ( opts[i].opt == NULL ) {
372372
opts[i].opt = opt;

0 commit comments

Comments
 (0)