diff options
author | wm4 <wm4@nowhere> | 2015-11-06 21:12:20 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-11-06 21:12:20 +0100 |
commit | 9693e0f57ac75bd5c5d8313dd933989dd3e64d31 (patch) | |
tree | d60148c9d7906da869157f8d9b5aa49042af5543 /options/m_property.c | |
parent | 647b360a0aa0a3f8cce75812f9d7eac5a78b7a06 (diff) | |
download | mpv-9693e0f57ac75bd5c5d8313dd933989dd3e64d31.tar.bz2 mpv-9693e0f57ac75bd5c5d8313dd933989dd3e64d31.tar.xz |
Remove some VLAs
They are evil and should be eradicated. Some of these were pretty dumb
anyway.
There are probably some more around in platform specific code or other
code not enabled by default on Linux.
Diffstat (limited to 'options/m_property.c')
-rw-r--r-- | options/m_property.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/options/m_property.c b/options/m_property.c index 9af3c91081..9318d5b7d2 100644 --- a/options/m_property.c +++ b/options/m_property.c @@ -49,14 +49,12 @@ static struct m_property *m_property_list_find(const struct m_property *list, static int do_action(const struct m_property *prop_list, const char *name, int action, void *arg, void *ctx) { - const char *sep; struct m_property *prop; struct m_property_action_arg ka; - if ((sep = strchr(name, '/')) && sep[1]) { - int len = sep - name; - char base[len + 1]; - memcpy(base, name, len); - base[len] = 0; + const char *sep = strchr(name, '/'); + if (sep && sep[1]) { + char base[128]; + snprintf(base, sizeof(base), "%.*s", (int)(sep - name), name); prop = m_property_list_find(prop_list, base); ka = (struct m_property_action_arg) { .key = sep + 1, |