Skip to content

Commit e136feb

Browse files
Don't cast an actual string literal to uint8_t*
This removes an ugly cast from the source and an unnecessary 1-byte variable from the .rodata section. Signed-off-by: Thiago Macieira <[email protected]>
1 parent 3e23929 commit e136feb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cborparser.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,10 @@ static CborError iterate_string_chunks(const CborValue *value, char *buffer, siz
977977
}
978978

979979
/* is there enough room for the ending NUL byte? */
980-
if (*result && *buflen > total)
981-
*result = !!func(buffer + total, (const uint8_t *)"", 1);
980+
if (*result && *buflen > total) {
981+
uint8_t nul[] = { 0 };
982+
*result = !!func(buffer + total, nul, 1);
983+
}
982984
*buflen = total;
983985

984986
if (next) {

0 commit comments

Comments
 (0)