From 2d345c59d637ec12fbc39d97e1999c335dffcdd2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 10 Jan 2018 01:20:58 +0100 Subject: input: make command argument list a dynamic array Replace the static array with dynamic memory allocation. This also requires some code to honor mp_cmd.nargs more strictly. Generally allocates more stuff. Fixes #5375 (although we could also just raise the static limit). --- input/input.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'input/input.h') diff --git a/input/input.h b/input/input.h index f00eb9b0e2..16b203a5e7 100644 --- a/input/input.h +++ b/input/input.h @@ -56,6 +56,9 @@ enum mp_input_section_flags { struct input_ctx; struct mp_log; +// Arbitrary upper bound for sanity. +#define MP_CMD_MAX_ARGS 100 + struct mp_cmd_arg { const struct m_option *type; union { @@ -71,7 +74,7 @@ struct mp_cmd_arg { typedef struct mp_cmd { int id; char *name; - struct mp_cmd_arg args[MP_CMD_MAX_ARGS]; + struct mp_cmd_arg *args; int nargs; int flags; // mp_cmd_flags bitfield bstr original; -- cgit v1.2.3