Skip to content

Commit

Permalink
m_option: rename struct member named "new"
Browse files Browse the repository at this point in the history
Cosmetic change to allow C++ code to include this header.

See github issue #195.
  • Loading branch information
wm4 committed Aug 19, 2013
1 parent 216e832 commit c5e66dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mpvcore/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static void add_negation_option(struct m_config *config,
.name = talloc_asprintf(no_opt, "no-%s", opt->name),
.type = CONF_TYPE_STORE,
.flags = opt->flags & (M_OPT_NOCFG | M_OPT_GLOBAL | M_OPT_PRE_PARSE),
.new = opt->new,
.is_new_option = opt->is_new_option,
.p = opt->p,
.offset = opt->offset,
.max = value,
Expand Down Expand Up @@ -381,7 +381,7 @@ static struct m_config_option *m_config_add_option(struct m_config *config,
void *optstruct = config->optstruct;
if (parent && (parent->opt->type->flags & M_OPT_TYPE_USE_SUBSTRUCT))
optstruct = substruct_read_ptr(parent->data);
co->data = arg->new ? (char *)optstruct + arg->offset : arg->p;
co->data = arg->is_new_option ? (char *)optstruct + arg->offset : arg->p;

if (parent) {
// Merge case: pretend it has no parent (note that we still must follow
Expand Down
6 changes: 3 additions & 3 deletions mpvcore/m_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ struct m_option {
*/
void *priv;

int new;
int is_new_option;

int offset;

Expand Down Expand Up @@ -505,12 +505,12 @@ int m_option_required_params(const m_option_t *opt);
#define OPTDEF_INT(i) .defval = (void *)&(const int){i}

#define OPT_GENERAL(ctype, optname, varname, flagv, ...) \
{.name = optname, .flags = flagv, .new = 1, \
{.name = optname, .flags = flagv, .is_new_option = 1, \
.offset = MP_CHECKED_OFFSETOF(OPT_BASE_STRUCT, varname, ctype), \
__VA_ARGS__}

#define OPT_GENERAL_NOTYPE(optname, varname, flagv, ...) \
{.name = optname, .flags = flagv, .new = 1, \
{.name = optname, .flags = flagv, .is_new_option = 1, \
.offset = offsetof(OPT_BASE_STRUCT, varname), \
__VA_ARGS__}

Expand Down

0 comments on commit c5e66dd

Please sign in to comment.