extern int main(int argc, char* argv[])
{
int r;
+ int id;
UChar* name;
OnigEncoding use_encs[1];
if (r != ONIG_NORMAL) return -r;
name = (UChar* )"foo";
- r = onig_set_callout_of_name(name, name + strlen((char* )name),
+ id = onig_set_callout_of_name(name, name + strlen((char* )name),
foo, retraction_foo);
- if (r != ONIG_NORMAL) {
+ if (id < 0) {
fprintf(stderr, "ERROR: fail to set callout of name: %s\n", name);
+ //return -1;
}
(void)onig_set_callout_of_code(progress_callout_func);
#else
#define B1(name, func) do {\
- r = onig_set_callout_of_name((UChar* )#name, (UChar* )(#name + strlen(#name)),\
+ id = onig_set_callout_of_name((UChar* )#name, (UChar* )(#name + strlen(#name)),\
onig_builtin_ ## func, 0);\
- if (r != ONIG_NORMAL) return r;\
+ if (id < 0) return id;\
} while(0)
- int r;
+ int id;
B1(FAIL, fail);
B1(SUCCESS, success);
goto end;
}
- r = callout_name_entry(&e, name, name_end, callout, retraction_callout);
- if (r < 0) goto end;
-
- id = r;
+ id = callout_name_entry(&e, name, name_end, callout, retraction_callout);
+ if (id < 0) {
+ r = id;
+ goto end;
+ }
r = ONIG_NORMAL;
if (IS_NULL(CalloutNameFuncList)) {
CalloutNameFuncList->v[id].callout = callout;
CalloutNameFuncList->v[id].retraction_callout = retraction_callout;
CalloutNameFuncList->v[id].name = e->name;
+ r = id; // return id
end:
if (save_name != name) xfree(name);