diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-16 22:36:27 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-16 22:36:27 +0000 |
commit | 3caa4ee5e545ee975ca3dc3fa798e63876e59a05 (patch) | |
tree | c15c43e94c7e82c7260cf9d175919511e0dc0786 /regcomp.c | |
parent | 51d174a17704c56342488cc1cc932b0825a3f305 (diff) | |
download | bundler-3caa4ee5e545ee975ca3dc3fa798e63876e59a05.tar.gz |
* array.c (rb_ary_memsize): added.
* io.c (rb_io_memsize): added.
* regcomp.c (onig_memsize): added.
* string.c (rb_str_memsize): added.
* transcode.c (rb_transcoding_memsize, rb_econv_memsize): added.
* variable.c (rb_geneic_ivar_memsize): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -5202,6 +5202,20 @@ onig_free(regex_t* reg) } } +size_t +onig_memsize(regex_t *reg) +{ + size_t size = sizeof(regex_t); + if (IS_NOT_NULL(reg->p)) size += reg->alloc; + if (IS_NOT_NULL(reg->exact)) size += reg->exact_end - reg->exact; + if (IS_NOT_NULL(reg->int_map)) size += sizeof(int) * ONIG_CHAR_TABLE_SIZE; + if (IS_NOT_NULL(reg->int_map_backward)) size += sizeof(int) * ONIG_CHAR_TABLE_SIZE; + if (IS_NOT_NULL(reg->repeat_range)) size += reg->repeat_range_alloc * sizeof(OnigRepeatRange); + if (IS_NOT_NULL(reg->chain)) size += onig_memsize(reg->chain); + + return size; +} + #define REGEX_TRANSFER(to,from) do {\ (to)->state = ONIG_STATE_MODIFY;\ onig_free_body(to);\ |