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
1 changed files with 2 additions and 6 deletions

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)
{
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)