]> granicus.if.org Git - onig/commitdiff
remove encoding argument from onig_set_callout_of_name()
authorK.Kosako <kosako@sofnec.co.jp>
Thu, 8 Feb 2018 08:26:03 +0000 (17:26 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Thu, 8 Feb 2018 08:26:03 +0000 (17:26 +0900)
sample/callout.c
src/oniguruma.h
src/regexec.c
src/regparse.c

index fb6dd2d2095a412a634f717d0107e8d29b456ee6..a9f9c08b3deeda662adb1dcadb57c21ce1a04280 100644 (file)
@@ -128,16 +128,15 @@ extern int main(int argc, char* argv[])
 {
   int r;
   UChar* name;
-  OnigEncoding enc;
   OnigEncoding use_encs[1];
 
-  use_encs[0] = enc = ONIG_ENCODING_UTF8;
+  use_encs[0] = ONIG_ENCODING_UTF8;
 
   onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
 
   onig_initialize_builtin_callouts();
   name = (UChar* )"FOO";
-  r = onig_set_callout_of_name(enc, name, name + strlen(name),
+  r = onig_set_callout_of_name(name, name + strlen(name),
                                callout_foo, retraction_callout_foo);
   if (r != ONIG_NORMAL) {
     fprintf(stderr, "ERROR: fail to set callout of name: %s\n", name);
index d18ed7a2aa49834fdedb69951f4eae2c6926fa33..a7cdc2abcee8143d3dc5385d346734fe396d0d80 100644 (file)
@@ -934,7 +934,7 @@ OnigCalloutFunc onig_get_retraction_callout_of_code P_((void));
 ONIG_EXTERN
 int onig_set_retraction_callout_of_code P_((OnigCalloutFunc f));
 ONIG_EXTERN
-int onig_set_callout_of_name P_((OnigEncoding enc, UChar* name, UChar* name_end, OnigCalloutFunc callout, OnigCalloutFunc retraction_callout));
+int onig_set_callout_of_name P_((UChar* name, UChar* name_end, OnigCalloutFunc callout, OnigCalloutFunc retraction_callout)); /* name: single-byte string */
 
 ONIG_EXTERN
 int onig_get_capture_range_in_callout P_((OnigCalloutArgs* args, int mem_num, int* begin, int* end));
index 1bb5a4b9f1f6fc4467c3f0023fd33fcfd6ded1f9..3630e28b485dfdf0efd4c20053f496b34e17aee9 100644 (file)
@@ -4874,7 +4874,7 @@ extern int
 onig_initialize_builtin_callouts(void)
 {
 #define B1(name, func)  do {\
-  r = onig_set_callout_of_name(0, (UChar* )#name, (UChar* )(#name + strlen(#name)),\
+  r = onig_set_callout_of_name((UChar* )#name, (UChar* )(#name + strlen(#name)),\
                                onig_builtin_ ## func, 0);\
   if (r != ONIG_NORMAL) return r;\
 } while(0)
index f9c42786cd9d1c5efd7d977525bcbb1ff2a6d4fe..267bf1806af46187509a2753faba8abdcf46b22a 100644 (file)
@@ -1398,9 +1398,10 @@ is_allowed_callout_name(UChar* name, UChar* name_end)
   return 1;
 }
 
-extern int
-onig_set_callout_of_name(OnigEncoding enc, UChar* name, UChar* name_end,
-                         OnigCalloutFunc callout, OnigCalloutFunc retraction_callout)
+static int
+set_callout_of_name_with_enc(OnigEncoding enc, UChar* name, UChar* name_end,
+                             OnigCalloutFunc callout,
+                             OnigCalloutFunc retraction_callout)
 {
   int r;
   int id;
@@ -1444,6 +1445,13 @@ onig_set_callout_of_name(OnigEncoding enc, UChar* name, UChar* name_end,
   return r;
 }
 
+extern int
+onig_set_callout_of_name(UChar* name, UChar* name_end,
+                         OnigCalloutFunc callout, OnigCalloutFunc retraction_callout)
+{
+  return set_callout_of_name_with_enc(0, name, name_end, callout, retraction_callout);
+}
+
 extern int
 onig_get_callout_id_from_name(OnigEncoding enc, UChar* name, UChar* name_end,
                               int* rid)