зеркало из https://github.com/github/ruby.git
* regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:
Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692 + https://github.com/k-takata/Onigmo/pull/52 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
360b98355e
Коммит
9ed1d63f41
|
@ -1,3 +1,9 @@
|
|||
Thu Nov 26 17:22:53 2015 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* regcomp.c, regenc.c, regexec.c, regint.h, enc/unicode.c:
|
||||
Merge Onigmo 58fa099ed1a34367de67fb3d06dd48d076839692
|
||||
+ https://github.com/k-takata/Onigmo/pull/52
|
||||
|
||||
Thu Nov 26 09:50:02 2015 yui-knk <spiketeika@gmail.com>
|
||||
|
||||
* test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
unicode.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
|
||||
|
|
35
regcomp.c
35
regcomp.c
|
@ -2,7 +2,7 @@
|
|||
regcomp.c - Onigmo (Oniguruma-mod) (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>
|
||||
* Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -6023,11 +6023,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
|
||||
if (!onig_is_prelude()) onig_print_statistics(stderr);
|
||||
#endif
|
||||
|
|
8
regenc.c
8
regenc.c
|
@ -902,13 +902,15 @@ resize_property_list(int new_size, const OnigCodePoint*** plist, int* psize)
|
|||
size = sizeof(OnigCodePoint*) * new_size;
|
||||
if (IS_NULL(list)) {
|
||||
list = (const OnigCodePoint** )xmalloc(size);
|
||||
if (IS_NULL(list)) return ONIGERR_MEMORY;
|
||||
}
|
||||
else {
|
||||
list = (const OnigCodePoint** )xrealloc((void* )list, size);
|
||||
const OnigCodePoint **tmp;
|
||||
tmp = (const OnigCodePoint** )xrealloc((void* )list, size);
|
||||
if (IS_NULL(tmp)) return ONIGERR_MEMORY;
|
||||
list = tmp;
|
||||
}
|
||||
|
||||
if (IS_NULL(list)) return ONIGERR_MEMORY;
|
||||
|
||||
*plist = list;
|
||||
*psize = new_size;
|
||||
|
||||
|
|
720
regexec.c
720
regexec.c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
33
regint.h
33
regint.h
|
@ -4,7 +4,7 @@
|
|||
regint.h - Onigmo (Oniguruma-mod) (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>
|
||||
* Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -392,10 +392,10 @@ typedef unsigned int BitStatusType;
|
|||
#define BIT_STATUS_CLEAR(stats) (stats) = 0
|
||||
#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
|
||||
#define BIT_STATUS_AT(stats,n) \
|
||||
((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & ((BitStatusType)1 << n)) : ((stats) & 1))
|
||||
((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & ((BitStatusType )1 << n)) : ((stats) & 1))
|
||||
|
||||
#define BIT_STATUS_ON_AT(stats,n) do {\
|
||||
if ((n) < (int )BIT_STATUS_BITS_NUM) \
|
||||
if ((n) < (int )BIT_STATUS_BITS_NUM)\
|
||||
(stats) |= (1 << (n));\
|
||||
else\
|
||||
(stats) |= 1;\
|
||||
|
@ -485,23 +485,29 @@ typedef struct _BBuf {
|
|||
#define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
|
||||
|
||||
#define BBUF_SIZE_INC(buf,inc) do{\
|
||||
UChar *tmp;\
|
||||
(buf)->alloc += (inc);\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||
if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
|
||||
(buf)->p = tmp;\
|
||||
} while (0)
|
||||
|
||||
#define BBUF_EXPAND(buf,low) do{\
|
||||
UChar *tmp;\
|
||||
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||
if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
|
||||
(buf)->p = tmp;\
|
||||
} while (0)
|
||||
|
||||
#define BBUF_ENSURE_SIZE(buf,size) do{\
|
||||
unsigned int new_alloc = (buf)->alloc;\
|
||||
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
||||
if ((buf)->alloc != new_alloc) {\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
UChar *tmp;\
|
||||
tmp = (UChar* )xrealloc((buf)->p, new_alloc);\
|
||||
if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
|
||||
(buf)->p = tmp;\
|
||||
(buf)->alloc = new_alloc;\
|
||||
}\
|
||||
} while (0)
|
||||
|
@ -903,6 +909,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 {
|
||||
|
@ -913,6 +927,7 @@ typedef struct {
|
|||
|
||||
extern OnigOpInfoType OnigOpInfo[];
|
||||
|
||||
|
||||
extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc));
|
||||
|
||||
#ifdef ONIG_DEBUG_STATISTICS
|
||||
|
|
Загрузка…
Ссылка в новой задаче