Skip to content

Commit

Permalink
vxp: bring back fallback to trunc(strtod()) for VEX_INT
Browse files Browse the repository at this point in the history
It seems I wrongly assumed strtoll(".", ...) would return 0, so
bring back the fallack to float parsing similar to what we had
before 05e10ee.

Should fix regression on FreeBSD from 0dfa3b8

Also clean up now unneeded include (thank you, Flexelint).

Fixes #4088

I promise, if this is still wrong, I will install FreeBSD ;)
  • Loading branch information
nigoroll committed Jun 5, 2024
1 parent 218f3aa commit 0ca8d17
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/libvarnishapi/vsl_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "miniobj.h"

#include "vbm.h"
#include "vnum.h"
#include "vqueue.h"
#include "vre.h"
#include "vsb.h"
Expand Down Expand Up @@ -211,18 +210,19 @@ vslq_test_rec(const struct vex *vex, const struct VSLC_ptr *rec)
case VEX_INT:
lhs_int = strtoll(b, &q, 0);
AN(q);
if (q != e && *q != '.')
return (0);
if (q != e && (*q == '.' || *q == 'e')) {
lhs_float = strtod(b, &q);
lhs_int = trunc(lhs_float);
lhs_float = 0.;
}
break;
case VEX_FLOAT:
lhs_float = strtod(b, &q);
if (q != e)
return (0);
break;
default:
WRONG("Wrong RHS type");
}
if (errno != 0)
if (q != e || errno != 0)
return (0);
break;
default:
Expand Down

0 comments on commit 0ca8d17

Please sign in to comment.