Skip to content

Commit

Permalink
m_config_core: remove mp_read_option_raw
Browse files Browse the repository at this point in the history
With the previous series of commits, all usage of this bad function has
been eliminated in mpv so we can just nuke it for good.
  • Loading branch information
Dudemanguy committed Sep 22, 2023
1 parent db12a2f commit cc1a43f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 39 deletions.
32 changes: 0 additions & 32 deletions options/m_config_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,38 +850,6 @@ void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
return cache->opts;
}

void mp_read_option_raw(struct mpv_global *global, const char *name,
const struct m_option_type *type, void *dst)
{
struct m_config_shadow *shadow = global->config;

int32_t optid = -1;
while (m_config_shadow_get_next_opt(shadow, &optid)) {
char buf[M_CONFIG_MAX_OPT_NAME_LEN];
const char *opt_name =
m_config_shadow_get_opt_name(shadow, optid, buf, sizeof(buf));

if (strcmp(name, opt_name) == 0) {
const struct m_option *opt = m_config_shadow_get_opt(shadow, optid);

int group_index, opt_index;
get_opt_from_id(shadow, optid, &group_index, &opt_index);

struct m_group_data *gdata = m_config_gdata(shadow->data, group_index);
assert(gdata);

assert(opt->offset >= 0);
assert(opt->type == type);

memset(dst, 0, opt->type->size);
m_option_copy(opt, dst, gdata->udata + opt->offset);
return;
}
}

MP_ASSERT_UNREACHABLE(); // not found
}

static const struct m_config_group *find_group(struct mpv_global *global,
const struct m_option *cfg)
{
Expand Down
7 changes: 0 additions & 7 deletions options/m_config_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ bool m_config_cache_write_opt(struct m_config_cache *cache, void *ptr);
void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
const struct m_sub_options *group);

// Read a single global option in a thread-safe way. For multiple options,
// use m_config_cache. The option must exist and match the provided type (the
// type is used as a sanity check only). Performs semi-expensive lookup.
// Warning: new code must not use this.
void mp_read_option_raw(struct mpv_global *global, const char *name,
const struct m_option_type *type, void *dst);

// Allocate a priv struct that is backed by global options (like AOs and VOs,
// anything that uses m_obj_list.use_global_options == true).
// The result contains a snapshot of the current option values of desc->options.
Expand Down

0 comments on commit cc1a43f

Please sign in to comment.