mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
360b98355e
commit
9ed1d63f41
6 changed files with 495 additions and 313 deletions
|
@ -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>
|
Thu Nov 26 09:50:02 2015 yui-knk <spiketeika@gmail.com>
|
||||||
|
|
||||||
* test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
|
* test/coverage/test_coverage.rb: Added test-case for Coverage.restart.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
unicode.c - Oniguruma (regular expression library)
|
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.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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)
|
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>
|
* Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
|
||||||
* All rights reserved.
|
* 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
|
extern int
|
||||||
onig_end(void)
|
onig_end(void)
|
||||||
{
|
{
|
||||||
THREAD_ATOMIC_START;
|
THREAD_ATOMIC_START;
|
||||||
|
|
||||||
|
exec_end_call_list();
|
||||||
|
|
||||||
#ifdef ONIG_DEBUG_STATISTICS
|
#ifdef ONIG_DEBUG_STATISTICS
|
||||||
if (!onig_is_prelude()) onig_print_statistics(stderr);
|
if (!onig_is_prelude()) onig_print_statistics(stderr);
|
||||||
#endif
|
#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;
|
size = sizeof(OnigCodePoint*) * new_size;
|
||||||
if (IS_NULL(list)) {
|
if (IS_NULL(list)) {
|
||||||
list = (const OnigCodePoint** )xmalloc(size);
|
list = (const OnigCodePoint** )xmalloc(size);
|
||||||
|
if (IS_NULL(list)) return ONIGERR_MEMORY;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
*plist = list;
|
||||||
*psize = new_size;
|
*psize = new_size;
|
||||||
|
|
||||||
|
|
35
regint.h
35
regint.h
|
@ -4,7 +4,7 @@
|
||||||
regint.h - Onigmo (Oniguruma-mod) (regular expression library)
|
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>
|
* Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -392,17 +392,17 @@ typedef unsigned int BitStatusType;
|
||||||
#define BIT_STATUS_CLEAR(stats) (stats) = 0
|
#define BIT_STATUS_CLEAR(stats) (stats) = 0
|
||||||
#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
|
#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
|
||||||
#define BIT_STATUS_AT(stats,n) \
|
#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 {\
|
#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));\
|
(stats) |= (1 << (n));\
|
||||||
else\
|
else\
|
||||||
(stats) |= 1;\
|
(stats) |= 1;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
|
#define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
|
||||||
if ((n) < (int )BIT_STATUS_BITS_NUM)\
|
if ((n) < (int )BIT_STATUS_BITS_NUM)\
|
||||||
(stats) |= (1 << (n));\
|
(stats) |= (1 << (n));\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -485,23 +485,29 @@ typedef struct _BBuf {
|
||||||
#define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
|
#define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
|
||||||
|
|
||||||
#define BBUF_SIZE_INC(buf,inc) do{\
|
#define BBUF_SIZE_INC(buf,inc) do{\
|
||||||
|
UChar *tmp;\
|
||||||
(buf)->alloc += (inc);\
|
(buf)->alloc += (inc);\
|
||||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
|
||||||
|
(buf)->p = tmp;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_EXPAND(buf,low) do{\
|
#define BBUF_EXPAND(buf,low) do{\
|
||||||
|
UChar *tmp;\
|
||||||
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
||||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
tmp = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
|
||||||
|
(buf)->p = tmp;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_ENSURE_SIZE(buf,size) do{\
|
#define BBUF_ENSURE_SIZE(buf,size) do{\
|
||||||
unsigned int new_alloc = (buf)->alloc;\
|
unsigned int new_alloc = (buf)->alloc;\
|
||||||
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
||||||
if ((buf)->alloc != new_alloc) {\
|
if ((buf)->alloc != new_alloc) {\
|
||||||
(buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
|
UChar *tmp;\
|
||||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
tmp = (UChar* )xrealloc((buf)->p, new_alloc);\
|
||||||
|
if (IS_NULL(tmp)) return(ONIGERR_MEMORY);\
|
||||||
|
(buf)->p = tmp;\
|
||||||
(buf)->alloc = new_alloc;\
|
(buf)->alloc = new_alloc;\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -903,6 +909,14 @@ typedef struct {
|
||||||
#define IS_CODE_SB_WORD(enc,code) \
|
#define IS_CODE_SB_WORD(enc,code) \
|
||||||
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_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
|
#ifdef ONIG_DEBUG
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -913,6 +927,7 @@ typedef struct {
|
||||||
|
|
||||||
extern OnigOpInfoType OnigOpInfo[];
|
extern OnigOpInfoType OnigOpInfo[];
|
||||||
|
|
||||||
|
|
||||||
extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc));
|
extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc));
|
||||||
|
|
||||||
#ifdef ONIG_DEBUG_STATISTICS
|
#ifdef ONIG_DEBUG_STATISTICS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue