static int
exec(OnigEncoding enc, OnigOptionType options,
- char* apattern, char* apattern_end, char* astr, char* str_null_end)
+ char* apattern, char* apattern_end, char* astr, UChar* end)
{
int r;
- unsigned char *end;
regex_t* reg;
OnigErrorInfo einfo;
UChar* pattern = (UChar* )apattern;
return -1;
}
- if (onigenc_is_valid_mbc_string(enc, str, (UChar* )str_null_end) != 0) {
- end = str + onigenc_str_bytelen_null(enc, str);
+ if (onigenc_is_valid_mbc_string(enc, str, end) != 0) {
r = search(reg, str, end);
}
unsigned char *str = (unsigned char*)malloc(remaining_size+4);
memset(str, 0, remaining_size+4);
memcpy(str, data, remaining_size);
- str_null_end = str + (remaining_size+4);
+ str_null_end = str + remaining_size;
int r;
OnigEncodingType *encodings[] = {
#endif
r = exec(enc, ONIG_OPTION_NONE, (char *)pattern, (char *)pattern_end,
- (char *)str, (char *)str_null_end);
+ (char *)str, str_null_end);
free(pattern);
free(str);