Skip to content

Commit 570268d

Browse files
committed
use UNEXPECTED
1 parent 364a698 commit 570268d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/bcmath/libbcmath/src/str2num.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,21 +130,21 @@ bool bc_str2num(bc_num *num, const char *str, const char *end, size_t scale, boo
130130
const char *decimal_point = (*ptr == '.') ? ptr : NULL;
131131

132132
/* If a non-digit and non-decimal-point indicator is in the string, i.e. an invalid character */
133-
if (!decimal_point && *ptr != '\0') {
133+
if (UNEXPECTED(!decimal_point && *ptr != '\0')) {
134134
goto fail;
135135
}
136136

137137
/* search and validate fractional end if exists */
138138
if (decimal_point) {
139139
/* search */
140140
fractional_ptr = fractional_end = decimal_point + 1;
141-
if (*fractional_ptr == '\0') {
141+
if (UNEXPECTED(*fractional_ptr == '\0')) {
142142
goto after_fractional;
143143
}
144144

145145
/* validate */
146146
fractional_end = bc_count_digits(fractional_ptr, end);
147-
if (*fractional_end != '\0') {
147+
if (UNEXPECTED(*fractional_end != '\0')) {
148148
/* invalid num */
149149
goto fail;
150150
}

0 commit comments

Comments
 (0)