mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-27 23:55:57 -05:00
Avoid useless double attempt at converting string to integer
Fixup dmap_add_field() and one of its callers to avoid making two useless attempts at converting a string to an integer in some cases.
This commit is contained in:
parent
ba251b16ae
commit
87abc3f432
@ -524,11 +524,9 @@ dmap_add_field(struct evbuffer *evbuf, struct dmap_field_map *dfm, char *strval,
|
||||
int val;
|
||||
int ret;
|
||||
|
||||
val = 0;
|
||||
val = intval;
|
||||
|
||||
if (intval != 0)
|
||||
val = intval;
|
||||
else if (strval)
|
||||
if ((dfm->type != DMAP_TYPE_STRING) && (val == 0) && strval)
|
||||
{
|
||||
ret = safe_atoi(strval, &val);
|
||||
if (ret < 0)
|
||||
@ -1300,7 +1298,7 @@ daap_reply_songlist_generic(struct evhttp_request *req, struct evbuffer *evbuf,
|
||||
}
|
||||
}
|
||||
|
||||
if (*strval)
|
||||
if (*strval && (dfm->type != DMAP_TYPE_STRING))
|
||||
{
|
||||
ret = safe_atoi(*strval, &val);
|
||||
if (ret < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user