forked from github/server
speed up float params, exploiting alphabetic sorting
This commit is contained in:
parent
07d10d9ab0
commit
af77a1d8e5
1 changed files with 2 additions and 6 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue