summaryrefslogtreecommitdiffstats
path: root/input/input.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-10 01:20:58 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-10 20:36:27 -0800
commit2d345c59d637ec12fbc39d97e1999c335dffcdd2 (patch)
treeec8281b2e0ccec14739827e28153f73b22fd26ed /input/input.h
parente3bee23fe4e0dc15ea2564b684572572f2393a15 (diff)
downloadmpv-2d345c59d637ec12fbc39d97e1999c335dffcdd2.tar.bz2
mpv-2d345c59d637ec12fbc39d97e1999c335dffcdd2.tar.xz
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).
Diffstat (limited to 'input/input.h')
-rw-r--r--input/input.h5
1 files changed, 4 insertions, 1 deletions
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;