Skip to content

Commit be9136a

Browse files
committed
common OPTIMIZE minor optimizations
1 parent 5911880 commit be9136a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/common.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,7 @@ ly_getutf8(const char **input, uint32_t *utf8_char, size_t *bytes_read)
176176
uint32_t c, aux;
177177
size_t len;
178178

179-
if (bytes_read) {
180-
(*bytes_read) = 0;
181-
}
182-
183179
c = (*input)[0];
184-
LY_CHECK_RET(!c, LY_EINVAL);
185180

186181
if (!(c & 0x80)) {
187182
/* one byte character */
@@ -238,6 +233,9 @@ ly_getutf8(const char **input, uint32_t *utf8_char, size_t *bytes_read)
238233
return LY_EINVAL;
239234
}
240235
} else {
236+
if (bytes_read) {
237+
(*bytes_read) = 0;
238+
}
241239
return LY_EINVAL;
242240
}
243241

0 commit comments

Comments
 (0)