From 4a288fa42c25d44173fbbe94c31111d43955ff4e Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Fri, 2 Mar 2018 16:31:59 +0900 Subject: [PATCH] don't use strndup() for Windows --- sample/callout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample/callout.c b/sample/callout.c index e249b36..2d526e5 100644 --- a/sample/callout.c +++ b/sample/callout.c @@ -38,8 +38,8 @@ callout_body(OnigCalloutArgs* args, void* user_data) acontents = onig_get_contents_by_callout_args(args); acontents_end = onig_get_contents_end_by_callout_args(args); if (acontents != 0) { - len = acontents_end - acontents; - contents = (UChar* )strndup((const char* )acontents, len); + OnigEncoding enc = onig_get_encoding(regex); + contents = onigenc_strdup(enc, acontents, acontents_end); } } -- 2.40.0