summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
diff options
context:
space:
mode:
Diffstat (limited to 'options/m_option.c')
-rw-r--r--options/m_option.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 2b34c4e918..49d78a06d2 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -522,6 +522,16 @@ const struct m_option_type m_option_type_intpair = {
.copy = copy_opt,
};
+const char *m_opt_choice_str(const struct m_opt_choice_alternatives *choices,
+ int value)
+{
+ for (const struct m_opt_choice_alternatives *c = choices; c->name; c++) {
+ if (c->value == value)
+ return c->name;
+ }
+ return NULL;
+}
+
static int clamp_choice(const m_option_t *opt, void *val)
{
int v = *(int *)val;