diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-12-14 12:57:21 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-12-14 12:57:21 +0100 |
commit | 766e109fd638ef1eac33717b52e04a351da46483 (patch) | |
tree | c8bbecdc1d0d5d3e4bd89bcb28306597af9a1312 /regcomp.c | |
parent | 0dbf3761f6b98e5c16c9bfa0306ae5d3257d081f (diff) |
Imported Upstream version 5.9.6upstream/5.9.6
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -2,7 +2,7 @@ regcomp.c - Oniguruma (regular expression library) **********************************************************************/ /*- - * Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> + * Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -5575,11 +5575,44 @@ 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* prev; + void (*func)(void); + + while (EndCallTop != 0) { + func = EndCallTop->func; + (*func)(); + + prev = EndCallTop; + EndCallTop = EndCallTop->next; + xfree(prev); + } +} + extern int onig_end(void) { THREAD_ATOMIC_START; + exec_end_call_list(); + #ifdef ONIG_DEBUG_STATISTICS onig_print_statistics(stderr); #endif |