From: K.Kosako Date: Wed, 27 Nov 2013 02:03:53 +0000 (+0900) Subject: add type OnigEndCallListItemType and onig_add_end_call(). X-Git-Tag: v5.9.6~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=863c5c922fbb4dc811527966d700bca97b088342;p=onig add type OnigEndCallListItemType and onig_add_end_call(). --- diff --git a/regcomp.c b/regcomp.c index 995e1d8..d4d16c1 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2,7 +2,7 @@ regcomp.c - Oniguruma (regular expression library) **********************************************************************/ /*- - * Copyright (c) 2002-2008 K.Kosako + * Copyright (c) 2002-2013 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -5575,11 +5575,42 @@ onig_init(void) } +static OnigEndCallListItemType* EndCallTop; + +extern void onig_add_end_call(void (*func)(void)) +{ + OnigEndCallListItemType* item; + + item = (OnigEndCallListItemType* )xmalloc(sizeof(*item)); + if (item == 0) return ; + + item->next = EndCallTop; + item->func = func; + + EndCallTop = item; +} + +static void +exec_end_call_list(void) +{ + OnigEndCallListItemType* item = EndCallTop; + void (*func)(void); + + while (EndCallTop != 0) { + func = EndCallTop->func; + (*func)(); + + EndCallTop = EndCallTop->next; + } +} + extern int onig_end(void) { THREAD_ATOMIC_START; + exec_end_call_list(); + #ifdef ONIG_DEBUG_STATISTICS onig_print_statistics(stderr); #endif diff --git a/regint.h b/regint.h index a0ce491..0fba09b 100644 --- a/regint.h +++ b/regint.h @@ -4,7 +4,7 @@ regint.h - Oniguruma (regular expression library) **********************************************************************/ /*- - * Copyright (c) 2002-2008 K.Kosako + * Copyright (c) 2002-2013 K.Kosako * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -750,6 +750,14 @@ typedef struct { #define IS_CODE_SB_WORD(enc,code) \ (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code)) +typedef struct OnigEndCallListItem { + struct OnigEndCallListItem* next; + void (*func)(void); +} OnigEndCallListItemType; + +extern void onig_add_end_call(void (*func)(void)); + + #ifdef ONIG_DEBUG typedef struct { @@ -760,6 +768,7 @@ typedef struct { extern OnigOpInfoType OnigOpInfo[]; + extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar** nextp, OnigEncoding enc)); #ifdef ONIG_DEBUG_STATISTICS