speed up float params, exploiting alphabetic sorting

This commit is contained in:
Enno Rehling 2014-06-25 07:25:54 -07:00
parent 07d10d9ab0
commit af77a1d8e5

View file

@ -1870,12 +1870,8 @@ void set_basepath(const char *path)
float get_param_flt(const struct param *p, const char *key, float def) float get_param_flt(const struct param *p, const char *key, float def)
{ {
while (p != NULL) { const char *str = get_param(p, key);
if (strcmp(p->name, key) == 0) return str ? (float)atof(str) : def;
return (float)atof(p->data);
p = p->next;
}
return def;
} }
void set_param(struct param **p, const char *key, const char *data) void set_param(struct param **p, const char *key, const char *data)