From 9693e0f57ac75bd5c5d8313dd933989dd3e64d31 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 6 Nov 2015 21:12:20 +0100 Subject: 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. --- options/m_property.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'options/m_property.c') 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, -- cgit v1.2.3