diff options
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -343,6 +343,20 @@ str_frozen_check(VALUE s) } } +size_t +rb_str_capacity(VALUE str) +{ + if (STR_EMBED_P(str)) { + return RSTRING_EMBED_LEN_MAX; + } + else if (STR_NOCAPA_P(str)) { + return RSTRING(str)->as.heap.len; + } + else { + return RSTRING(str)->as.heap.aux.capa; + } +} + static inline VALUE str_alloc(VALUE klass) { |