some more compiler attributes

make sure all textcode/scan_* routines work if dest or destlen is NULL
This commit is contained in:
leitner
2025-03-17 13:21:55 +00:00
parent 144912a41d
commit fb5dcdf7fe
6 changed files with 56 additions and 43 deletions

View File

@@ -63,11 +63,11 @@ size_t scan_jsonescape(const char *src,char *dest,size_t *destlen) {
++written;
}
done:
*destlen=written;
if (destlen) *destlen=written;
return i;
abort:
if (prev!=(unsigned int)-1) i-=6; // if we abort and there still was an open surrogate pair, cancel it
*destlen=written;
if (destlen) *destlen=written;
return i;
}