k-takata/Onigmo

Missing const qualifier on syntax parameter of onig_new_without_alloc.

peterhuene opened this issue · 2 comments

The current (6.1.1) prototype for onig_new_without_alloc function is:

int onig_new_without_alloc(OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo);

Note that the syntax argument is missing a const qualifier.

As a result, in C++, we're unable to directly use the ONIG_SYNTAX_... macros as an argument because they ultimately use declarations of ONIG_EXTERN const OnigSyntaxType OnigSyntax...; and the const-qualifier cannot be cast away without a const_cast in C++.

Thanks!

Thank you for the report.