KalleOlaviNiemitalo commented on code in PR #1798:
URL: https://github.com/apache/avro/pull/1798#discussion_r935514425
##########
lang/c/src/schema.c:
##########
@@ -67,15 +67,24 @@ static int is_avro_id(const char *name)
}
size_t mbslen = mbstowcs(NULL, name, 0);
- wchar_t wsName[mbslen + 1];
+#ifdef __STDC_NO_VLA__
+ // compiler does not support variable length arrays
+ wchar_t *wsName = calloc(mbslen + 1, sizeof(wchar_t));
+#else
+ wchar_t wsName[mbslen + 1];
+#endif
mbstowcs(wsName, name, mbslen + 1);
size_t i;
for (i = 0; i < mbslen; i++) {
if (!(u_isalpha(wsName[i])
- || wsName[i] == L'_' || (i && isdigit(wsName[i])))) {
+ || wsName[i] == L'_' || (i && u_isdigit(wsName[i])))) {
return 0;
Review Comment:
Might need to `free(wsName)` before this `return`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]