Skip to content

Commit

Permalink
options: drop unnecessary casts
Browse files Browse the repository at this point in the history
the reason for these casts are unknown but they were presumably to
silence warnings 9 years ago. but it doesn't seem to be necessary
nowadays, so just drop the casts and also drop the `const` from the
compound literal type.

some small technical notes:

1. while string literals aren't `const` in C, writing to them is
   undefined (do not ask me why). and so compilers will typically put
   string literals into read only section anyways, regardless of
   weather `const` was used in the source or not. so this shouldn't make
   any difference codegen wise.
2. making the array of pointers `const` on the other hand might affect
   codegen, eg: `(char *const []){...}`. however, that'd trigger a lot
   of discarded qualifier warnings.
  • Loading branch information
N-R-K authored and sfan5 committed Jun 30, 2023
1 parent 39957c2 commit 0bfafd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ static const struct MPOpts mp_default_opts = {
[STREAM_VIDEO] = -2,
[STREAM_SUB] = -2, }, },
.stream_lang = {
[STREAM_SUB] = (char**)(const char*[]) {"auto", NULL},
[STREAM_SUB] = (char *[]){ "auto", NULL },
},
.stream_auto_sel = true,
.subs_with_matching_audio = false,
Expand All @@ -1057,7 +1057,7 @@ static const struct MPOpts mp_default_opts = {

.mf_fps = 1.0,

.display_tags = (char **)(const char*[]){
.display_tags = (char *[]){
"Artist", "Album", "Album_Artist", "Comment", "Composer",
"Date", "Description", "Genre", "Performer", "Rating",
"Series", "Title", "Track", "icy-title", "service_name",
Expand All @@ -1067,7 +1067,7 @@ static const struct MPOpts mp_default_opts = {

.cuda_device = -1,

.watch_later_options = (char **)(const char*[]){
.watch_later_options = (char *[]){
"start",
"osd-level",
"speed",
Expand Down

0 comments on commit 0bfafd2

Please sign in to comment.