From af77a1d8e5a8450dfab91f2196edd6f8a3c4fd7a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 25 Jun 2014 07:25:54 -0700 Subject: [PATCH] speed up float params, exploiting alphabetic sorting --- src/kernel/config.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/kernel/config.c b/src/kernel/config.c index 93fe0a9da..d697411d3 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1870,12 +1870,8 @@ void set_basepath(const char *path) float get_param_flt(const struct param *p, const char *key, float def) { - while (p != NULL) { - if (strcmp(p->name, key) == 0) - return (float)atof(p->data); - p = p->next; - } - return def; + const char *str = get_param(p, key); + return str ? (float)atof(str) : def; } void set_param(struct param **p, const char *key, const char *data)