Skip to content

Commit 5ed4b72

Browse files
committed
unit_evaluate[_dbl]: set the endptr unconditionally
Even if no number is parsed, set the endptr. This is consistent with strtod (and family) behavior.
1 parent 3c6e5d5 commit 5ed4b72

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils/misc.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ unit_evaluate(const char *str, const char **endptr)
101101
double
102102
unit_evaluate_dbl(const char *str, bool case_sensitive, const char **endptr)
103103
{
104+
if (endptr != nullptr) {
105+
*endptr = str;
106+
}
107+
104108
char *endptr_tmp = nullptr;
105109
errno = 0;
106110
double ret = strtod(str, &endptr_tmp);

0 commit comments

Comments
 (0)