History

fftools/cmdutils: Use av_strstart() instead of strncmp()

This also avoids hardcoding lengths.

Andreas Rheinhardt committed 5 years ago

Commit c66bb561 parent 4b3906b1 file · +2 −4Browse files

Unified · Split

fftools/cmdutils.c+2−4
@@ -903,20 +903,18 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) · 902 unmodified lines
903903 if (!i && !cmd) {
904904 flags = 0; /* missing relative prefix, build absolute value */
905905 }
906− if (!strncmp(token, "repeat", 6)) {
906+ if (av_strstart(token, "repeat", &arg)) {
907907 if (cmd == '-') {
908908 flags |= AV_LOG_SKIP_REPEATED;
909909 } else {
910910 flags &= ~AV_LOG_SKIP_REPEATED;
911911 }
912− arg = token + 6;
913− } else if (!strncmp(token, "level", 5)) {
912+ } else if (av_strstart(token, "level", &arg)) {
914913 if (cmd == '-') {
915914 flags &= ~AV_LOG_PRINT_LEVEL;
916915 } else {
917916 flags |= AV_LOG_PRINT_LEVEL;
918917 }
919− arg = token + 5;
920918 } else {
921919 break;
922920 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t