Ruby  2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
string.c File Reference
#include "ruby/encoding.h"
#include "ruby/re.h"
#include "internal.h"
#include "encindex.h"
#include "probes.h"
#include "gc.h"
#include "ruby_assert.h"
#include "id.h"
#include "debug_counter.h"
#include "ruby/util.h"
#include <errno.h>
#include <math.h>
#include <ctype.h>
#include "missing/crypt.h"

Go to the source code of this file.

Data Structures

struct  mapping_buffer
 
struct  tr
 

Macros

#define BEG(no)   (regs->beg[(no)])
 
#define END(no)   (regs->end[(no)])
 
#define HAVE_CRYPT_R   1
 
#define RUBY_MAX_CHAR_LEN   16
 
#define STR_SHARED_ROOT   FL_USER5
 
#define STR_BORROWED   FL_USER6
 
#define STR_TMPLOCK   FL_USER7
 
#define STR_NOFREE   FL_USER18
 
#define STR_FAKESTR   FL_USER19
 
#define STR_SET_NOEMBED(str)
 
#define STR_SET_EMBED(str)   FL_UNSET((str), (STR_NOEMBED|STR_NOFREE))
 
#define STR_SET_EMBED_LEN(str, n)
 
#define STR_SET_LEN(str, n)
 
#define STR_DEC_LEN(str)
 
#define TERM_LEN(str)   rb_enc_mbminlen(rb_enc_get(str))
 
#define TERM_FILL(ptr, termlen)
 
#define RESIZE_CAPA(str, capacity)
 
#define RESIZE_CAPA_TERM(str, capacity, termlen)
 
#define STR_SET_SHARED(str, shared_str)
 
#define STR_HEAP_PTR(str)   (RSTRING(str)->as.heap.ptr)
 
#define STR_HEAP_SIZE(str)   ((size_t)RSTRING(str)->as.heap.aux.capa + TERM_LEN(str))
 
#define STR_ENC_GET(str)   get_encoding(str)
 
#define SHARABLE_MIDDLE_SUBSTRING   0
 
#define SHARABLE_SUBSTRING_P(beg, len, end)   ((beg) + (len) == (end))
 
#define STR_EMBEDDABLE_P(len, termlen)   ((len) <= RSTRING_EMBED_LEN_MAX + 1 - (termlen))
 
#define BARE_STRING_P(str)   (!FL_ANY_RAW(str, FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString)
 
#define aligned_ptr(value)   (uintptr_t *)(value)
 
#define STR_BUF_MIN_SIZE   63
 
#define rb_str_dup_frozen   rb_str_new_frozen
 
#define str_buf_cat2(str, ptr)   str_buf_cat((str), (ptr), strlen(ptr))
 
#define MIN_PRE_ALLOC_SIZE   48
 
#define lesser(a, b)   (((a)>(b))?(b):(a))
 
#define rb_str_index(str, sub, offset)   rb_strseq_index(str, sub, offset, 0)
 
#define rb_str_splice(str, beg, len, val)   rb_str_update(str, beg, len, val)
 
#define CHAR_ESC_LEN   13 /* sizeof(\x{ hex of 32bit unsigned int } \0) */
 
#define IS_EVSTR(p, e)   ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{'))
 
#define CASE_MAPPING_ADDITIONAL_LENGTH   20
 
#define CASEMAP_DEBUG   0
 
#define CHECK_IF_ASCII(c)
 
#define TR_TABLE_SIZE   257
 
#define ascii_isspace(c)   isspacetable[(unsigned char)(c)]
 
#define SPLIT_STR(beg, len)   (empty_count = split_string(result, str, beg, len, empty_count))
 
#define WANTARRAY(m, size)   (!rb_block_given_p() ? rb_ary_new_capa(size) : 0)
 
#define ENUM_ELEM(ary, e)   enumerator_element(ary, e)
 
#define CHARS_16BE(x)   (OnigUChar)((x)>>8), (OnigUChar)(x)
 
#define CHARS_16LE(x)   (OnigUChar)(x), (OnigUChar)((x)>>8)
 
#define CHARS_32BE(x)   CHARS_16BE((x)>>16), CHARS_16BE(x)
 
#define CHARS_32LE(x)   CHARS_16LE(x), CHARS_16LE((x)>>16)
 
#define CASE_UTF(e)
 
#define CRYPT_END()   ALLOCV_END(databuf)
 
#define DEFAULT_REPLACE_CHAR(str)
 
#define sym_equal   rb_obj_equal
 
#define rb_intern(str)   rb_intern_const(str)
 

Typedefs

typedef struct mapping_buffer mapping_buffer
 
typedef unsigned charUSTR
 

Enumerations

enum  neighbor_char { NEIGHBOR_NOT_CHAR, NEIGHBOR_FOUND, NEIGHBOR_WRAPPED }
 

Functions

RUBY_FUNC_EXPORTED VALUE rb_fstring (VALUE str)
 
VALUE rb_setup_fake_str (struct RString *fake_str, const char *name, long len, rb_encoding *enc)
 
MJIT_FUNC_EXPORTED VALUE rb_fstring_new (const char *ptr, long len)
 
VALUE rb_fstring_enc_new (const char *ptr, long len, rb_encoding *enc)
 
VALUE rb_fstring_cstr (const char *ptr)
 
long rb_str_coderange_scan_restartable (const char *s, const char *e, rb_encoding *enc, int *cr)
 
int rb_enc_str_coderange (VALUE str)
 
int rb_enc_str_asciionly_p (VALUE str)
 
size_t rb_str_capacity (VALUE str)
 
VALUE rb_str_new (const char *ptr, long len)
 
VALUE rb_usascii_str_new (const char *ptr, long len)
 
VALUE rb_utf8_str_new (const char *ptr, long len)
 
VALUE rb_enc_str_new (const char *ptr, long len, rb_encoding *enc)
 
VALUE rb_str_new_cstr (const char *ptr)
 
VALUE rb_usascii_str_new_cstr (const char *ptr)
 
VALUE rb_utf8_str_new_cstr (const char *ptr)
 
VALUE rb_enc_str_new_cstr (const char *ptr, rb_encoding *enc)
 
VALUE rb_str_new_static (const char *ptr, long len)
 
VALUE rb_usascii_str_new_static (const char *ptr, long len)
 
VALUE rb_utf8_str_new_static (const char *ptr, long len)
 
VALUE rb_enc_str_new_static (const char *ptr, long len, rb_encoding *enc)
 
VALUE rb_tainted_str_new (const char *ptr, long len)
 
VALUE rb_tainted_str_new_cstr (const char *ptr)
 
VALUE rb_str_conv_enc_opts (VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
 
VALUE rb_str_cat_conv_enc_opts (VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, int ecflags, VALUE ecopts)
 
VALUE rb_str_initialize (VALUE str, const char *ptr, long len, rb_encoding *enc)
 
VALUE rb_str_conv_enc (VALUE str, rb_encoding *from, rb_encoding *to)
 
VALUE rb_external_str_new_with_enc (const char *ptr, long len, rb_encoding *eenc)
 
VALUE rb_external_str_with_enc (VALUE str, rb_encoding *eenc)
 
VALUE rb_external_str_new (const char *ptr, long len)
 
VALUE rb_external_str_new_cstr (const char *ptr)
 
VALUE rb_locale_str_new (const char *ptr, long len)
 
VALUE rb_locale_str_new_cstr (const char *ptr)
 
VALUE rb_filesystem_str_new (const char *ptr, long len)
 
VALUE rb_filesystem_str_new_cstr (const char *ptr)
 
VALUE rb_str_export (VALUE str)
 
VALUE rb_str_export_locale (VALUE str)
 
VALUE rb_str_export_to_enc (VALUE str, rb_encoding *enc)
 
VALUE rb_str_new_shared (VALUE str)
 
VALUE rb_str_new_frozen (VALUE orig)
 
VALUE rb_str_tmp_frozen_acquire (VALUE orig)
 
void rb_str_tmp_frozen_release (VALUE orig, VALUE tmp)
 
VALUE rb_str_new_with_class (VALUE obj, const char *ptr, long len)
 
 STATIC_ASSERT (STR_BUF_MIN_SIZE, STR_BUF_MIN_SIZE > RSTRING_EMBED_LEN_MAX)
 
VALUE rb_str_buf_new (long capa)
 
VALUE rb_str_buf_new_cstr (const char *ptr)
 
VALUE rb_str_tmp_new (long len)
 
void rb_str_free (VALUE str)
 
RUBY_FUNC_EXPORTED size_t rb_str_memsize (VALUE str)
 
VALUE rb_str_to_str (VALUE str)
 
void rb_str_shared_replace (VALUE str, VALUE str2)
 
VALUE rb_obj_as_string (VALUE obj)
 
MJIT_FUNC_EXPORTED VALUE rb_obj_as_string_result (VALUE str, VALUE obj)
 
VALUE rb_str_dup (VALUE str)
 
VALUE rb_str_resurrect (VALUE str)
 
long rb_enc_strlen (const char *p, const char *e, rb_encoding *enc)
 
long rb_enc_strlen_cr (const char *p, const char *e, rb_encoding *enc, int *cr)
 
long rb_str_strlen (VALUE str)
 
VALUE rb_str_length (VALUE str)
 
VALUE rb_str_plus (VALUE str1, VALUE str2)
 
MJIT_FUNC_EXPORTED VALUE rb_str_opt_plus (VALUE str1, VALUE str2)
 
VALUE rb_str_times (VALUE str, VALUE times)
 
void rb_str_modify (VALUE str)
 
void rb_str_modify_expand (VALUE str, long expand)
 
void rb_must_asciicompat (VALUE str)
 
VALUE rb_string_value (volatile VALUE *ptr)
 
charrb_string_value_ptr (volatile VALUE *ptr)
 
void rb_str_change_terminator_length (VALUE str, const int oldtermlen, const int termlen)
 
charrb_str_to_cstr (VALUE str)
 
charrb_string_value_cstr (volatile VALUE *ptr)
 
charrb_str_fill_terminator (VALUE str, const int newminlen)
 
VALUE rb_check_string_type (VALUE str)
 
charrb_enc_nth (const char *p, const char *e, long nth, rb_encoding *enc)
 
long rb_str_offset (VALUE str, long pos)
 
long rb_str_sublen (VALUE str, long pos)
 
VALUE rb_str_subseq (VALUE str, long beg, long len)
 
charrb_str_subpos (VALUE str, long beg, long *lenp)
 
VALUE rb_str_substr (VALUE str, long beg, long len)
 
VALUE rb_str_freeze (VALUE str)
 
 RUBY_ALIAS_FUNCTION (rb_str_dup_frozen(VALUE str), rb_str_new_frozen,(str))
 
VALUE rb_str_unlocktmp (VALUE str)
 
RUBY_FUNC_EXPORTED VALUE rb_str_locktmp_ensure (VALUE str, VALUE(*func)(VALUE), VALUE arg)
 
void rb_str_set_len (VALUE str, long len)
 
VALUE rb_str_resize (VALUE str, long len)
 
VALUE rb_str_cat (VALUE str, const char *ptr, long len)
 
VALUE rb_str_cat_cstr (VALUE str, const char *ptr)
 
 RUBY_ALIAS_FUNCTION (rb_str_buf_cat(VALUE str, const char *ptr, long len), rb_str_cat,(str, ptr, len))
 
VALUE rb_enc_str_buf_cat (VALUE str, const char *ptr, long len, rb_encoding *ptr_enc)
 
VALUE rb_str_buf_cat_ascii (VALUE str, const char *ptr)
 
VALUE rb_str_buf_append (VALUE str, VALUE str2)
 
VALUE rb_str_append (VALUE str, VALUE str2)
 
MJIT_FUNC_EXPORTED VALUE rb_str_concat_literals (size_t num, const VALUE *strary)
 
VALUE rb_str_concat (VALUE str1, VALUE str2)
 
st_index_t rb_str_hash (VALUE str)
 
int rb_str_hash_cmp (VALUE str1, VALUE str2)
 
int rb_str_comparable (VALUE str1, VALUE str2)
 
int rb_str_cmp (VALUE str1, VALUE str2)
 
VALUE rb_str_equal (VALUE str1, VALUE str2)
 
MJIT_FUNC_EXPORTED VALUE rb_str_eql (VALUE str1, VALUE str2)
 
VALUE rb_str_succ (VALUE orig)
 
VALUE rb_str_upto_each (VALUE beg, VALUE end, int excl, int(*each)(VALUE, VALUE), VALUE arg)
 
VALUE rb_str_upto_endless_each (VALUE beg, int(*each)(VALUE, VALUE), VALUE arg)
 
VALUE rb_str_include_range_p (VALUE beg, VALUE end, VALUE val, VALUE exclusive)
 
VALUE rb_str_drop_bytes (VALUE str, long len)
 
void rb_str_update (VALUE str, long beg, long len, VALUE val)
 
VALUE rb_str_replace (VALUE str, VALUE str2)
 
int rb_str_buf_cat_escaped_char (VALUE result, unsigned int c, int unicode_p)
 
const charruby_escaped_char (int c)
 
VALUE rb_str_escape (VALUE str)
 
VALUE rb_str_inspect (VALUE str)
 
VALUE rb_str_dump (VALUE str)
 
VALUE rb_str_split (VALUE str, const char *sep0)
 
VALUE rb_str_chomp_string (VALUE str, VALUE rs)
 
VALUE rb_str_ord (VALUE s)
 
void rb_str_setter (VALUE val, ID id, VALUE *var)
 
VALUE rb_str_ellipsize (VALUE str, long len)
 Shortens str and adds three dots, an ellipsis, if it is longer than len characters. More...
 
VALUE rb_str_scrub (VALUE str, VALUE repl)
 
VALUE rb_enc_str_scrub (rb_encoding *enc, VALUE str, VALUE repl)
 
int rb_str_symname_p (VALUE sym)
 
VALUE rb_str_quote_unprintable (VALUE str)
 
MJIT_FUNC_EXPORTED VALUE rb_id_quote_unprintable (ID id)
 
VALUE rb_sym_to_s (VALUE sym)
 
MJIT_FUNC_EXPORTED VALUE rb_sym_proc_call (ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc)
 
ID rb_to_id (VALUE name)
 
VALUE rb_to_symbol (VALUE name)
 
void Init_String (void)
 

Variables

VALUE rb_cString
 
VALUE rb_cSymbol
 
const struct st_hash_type rb_fstring_hash_type
 
VALUE rb_fs
 

Macro Definition Documentation

◆ aligned_ptr

#define aligned_ptr (   value)    (uintptr_t *)(value)

◆ ascii_isspace

#define ascii_isspace (   c)    isspacetable[(unsigned char)(c)]

Definition at line 7808 of file string.c.

◆ BARE_STRING_P

#define BARE_STRING_P (   str)    (!FL_ANY_RAW(str, FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString)

Definition at line 265 of file string.c.

◆ BEG

#define BEG (   no)    (regs->beg[(no)])

Definition at line 25 of file string.c.

◆ CASE_MAPPING_ADDITIONAL_LENGTH

#define CASE_MAPPING_ADDITIONAL_LENGTH   20

Definition at line 6487 of file string.c.

◆ CASE_UTF

#define CASE_UTF (   e)
Value:
case ENCINDEX_UTF_##e: { \
static const OnigUChar source_UTF_##e[] = {CHARS_##e('\\'), CHARS_##e('X')}; \
source = source_UTF_##e; \
source_len = sizeof(source_UTF_##e); \
break; \
}

◆ CASEMAP_DEBUG

#define CASEMAP_DEBUG   0

Definition at line 6489 of file string.c.

◆ CHAR_ESC_LEN

#define CHAR_ESC_LEN   13 /* sizeof(\x{ hex of 32bit unsigned int } \0) */

Definition at line 5812 of file string.c.

◆ CHARS_16BE

#define CHARS_16BE (   x)    (OnigUChar)((x)>>8), (OnigUChar)(x)

◆ CHARS_16LE

#define CHARS_16LE (   x)    (OnigUChar)(x), (OnigUChar)((x)>>8)

◆ CHARS_32BE

#define CHARS_32BE (   x)    CHARS_16BE((x)>>16), CHARS_16BE(x)

◆ CHARS_32LE

#define CHARS_32LE (   x)    CHARS_16LE(x), CHARS_16LE((x)>>16)

◆ CHECK_IF_ASCII

#define CHECK_IF_ASCII (   c)
Value:
(void)((cr == ENC_CODERANGE_7BIT && !rb_isascii(c)) ? \
(cr = ENC_CODERANGE_VALID) : 0)

◆ CRYPT_END

#define CRYPT_END ( )    ALLOCV_END(databuf)

◆ DEFAULT_REPLACE_CHAR

#define DEFAULT_REPLACE_CHAR (   str)
Value:
do { \
static const char replace[sizeof(str)-1] = str; \
rep = replace; replen = (int)sizeof(replace); \
} while (0)

◆ END

#define END (   no)    (regs->end[(no)])

Definition at line 26 of file string.c.

◆ ENUM_ELEM

#define ENUM_ELEM (   ary,
 
)    enumerator_element(ary, e)

Definition at line 8140 of file string.c.

◆ HAVE_CRYPT_R

#define HAVE_CRYPT_R   1

Definition at line 42 of file string.c.

◆ IS_EVSTR

#define IS_EVSTR (   p,
 
)    ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{'))

Definition at line 6023 of file string.c.

◆ lesser

#define lesser (   a,
 
)    (((a)>(b))?(b):(a))

Definition at line 3200 of file string.c.

◆ MIN_PRE_ALLOC_SIZE

#define MIN_PRE_ALLOC_SIZE   48

Definition at line 2971 of file string.c.

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

◆ rb_str_dup_frozen

#define rb_str_dup_frozen   rb_str_new_frozen

◆ rb_str_index

#define rb_str_index (   str,
  sub,
  offset 
)    rb_strseq_index(str, sub, offset, 0)

Definition at line 3490 of file string.c.

◆ rb_str_splice

#define rb_str_splice (   str,
  beg,
  len,
  val 
)    rb_str_update(str, beg, len, val)

Definition at line 4687 of file string.c.

◆ RESIZE_CAPA

#define RESIZE_CAPA (   str,
  capacity 
)
Value:
do {\
const int termlen = TERM_LEN(str);\
RESIZE_CAPA_TERM(str,capacity,termlen);\
} while (0)

Definition at line 133 of file string.c.

◆ RESIZE_CAPA_TERM

#define RESIZE_CAPA_TERM (   str,
  capacity,
  termlen 
)
Value:
do {\
if (STR_EMBED_P(str)) {\
if (!STR_EMBEDDABLE_P(capacity, termlen)) {\
char *const tmp = ALLOC_N(char, (size_t)(capacity) + (termlen));\
const long tlen = RSTRING_LEN(str);\
memcpy(tmp, RSTRING_PTR(str), tlen);\
RSTRING(str)->as.heap.ptr = tmp;\
RSTRING(str)->as.heap.len = tlen;\
STR_SET_NOEMBED(str);\
RSTRING(str)->as.heap.aux.capa = (capacity);\
}\
}\
else {\
assert(!FL_TEST((str), STR_SHARED)); \
SIZED_REALLOC_N(RSTRING(str)->as.heap.ptr, char, \
(size_t)(capacity) + (termlen), STR_HEAP_SIZE(str)); \
RSTRING(str)->as.heap.aux.capa = (capacity);\
}\
} while (0)

Definition at line 137 of file string.c.

◆ RUBY_MAX_CHAR_LEN

#define RUBY_MAX_CHAR_LEN   16

Definition at line 86 of file string.c.

◆ SHARABLE_MIDDLE_SUBSTRING

#define SHARABLE_MIDDLE_SUBSTRING   0

Definition at line 173 of file string.c.

◆ SHARABLE_SUBSTRING_P

#define SHARABLE_SUBSTRING_P (   beg,
  len,
  end 
)    ((beg) + (len) == (end))

Definition at line 176 of file string.c.

◆ SPLIT_STR

#define SPLIT_STR (   beg,
  len 
)    (empty_count = split_string(result, str, beg, len, empty_count))

◆ STR_BORROWED

#define STR_BORROWED   FL_USER6

Definition at line 88 of file string.c.

◆ str_buf_cat2

#define str_buf_cat2 (   str,
  ptr 
)    str_buf_cat((str), (ptr), strlen(ptr))

Definition at line 2809 of file string.c.

◆ STR_BUF_MIN_SIZE

#define STR_BUF_MIN_SIZE   63

Definition at line 1311 of file string.c.

◆ STR_DEC_LEN

#define STR_DEC_LEN (   str)
Value:
do {\
if (STR_EMBED_P(str)) {\
long n = RSTRING_LEN(str);\
n--;\
STR_SET_EMBED_LEN((str), n);\
}\
else {\
RSTRING(str)->as.heap.len--;\
}\
} while (0)

Definition at line 113 of file string.c.

◆ STR_EMBEDDABLE_P

#define STR_EMBEDDABLE_P (   len,
  termlen 
)    ((len) <= RSTRING_EMBED_LEN_MAX + 1 - (termlen))

Definition at line 181 of file string.c.

◆ STR_ENC_GET

#define STR_ENC_GET (   str)    get_encoding(str)

Definition at line 170 of file string.c.

◆ STR_FAKESTR

#define STR_FAKESTR   FL_USER19

Definition at line 91 of file string.c.

◆ STR_HEAP_PTR

#define STR_HEAP_PTR (   str)    (RSTRING(str)->as.heap.ptr)

Definition at line 167 of file string.c.

◆ STR_HEAP_SIZE

#define STR_HEAP_SIZE (   str)    ((size_t)RSTRING(str)->as.heap.aux.capa + TERM_LEN(str))

Definition at line 168 of file string.c.

◆ STR_NOFREE

#define STR_NOFREE   FL_USER18

Definition at line 90 of file string.c.

◆ STR_SET_EMBED

#define STR_SET_EMBED (   str)    FL_UNSET((str), (STR_NOEMBED|STR_NOFREE))

Definition at line 97 of file string.c.

◆ STR_SET_EMBED_LEN

#define STR_SET_EMBED_LEN (   str,
  n 
)
Value:
do { \
long tmp_n = (n);\
RBASIC(str)->flags &= ~RSTRING_EMBED_LEN_MASK;\
RBASIC(str)->flags |= (tmp_n) << RSTRING_EMBED_LEN_SHIFT;\
} while (0)

Definition at line 98 of file string.c.

◆ STR_SET_LEN

#define STR_SET_LEN (   str,
  n 
)
Value:
do { \
if (STR_EMBED_P(str)) {\
STR_SET_EMBED_LEN((str), (n));\
}\
else {\
RSTRING(str)->as.heap.len = (n);\
}\
} while (0)

Definition at line 104 of file string.c.

◆ STR_SET_NOEMBED

#define STR_SET_NOEMBED (   str)
Value:
do {\
FL_SET((str), STR_NOEMBED);\
STR_SET_EMBED_LEN((str), 0);\
} while (0)

Definition at line 93 of file string.c.

◆ STR_SET_SHARED

#define STR_SET_SHARED (   str,
  shared_str 
)
Value:
do { \
if (!FL_TEST(str, STR_FAKESTR)) { \
RB_OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
FL_SET((str), STR_SHARED); \
FL_SET((shared_str), STR_SHARED_ROOT); \
if (RBASIC_CLASS((shared_str)) == 0) /* for CoW-friendliness */ \
FL_SET_RAW((shared_str), STR_BORROWED); \
} \
} while (0)

Definition at line 157 of file string.c.

◆ STR_SHARED_ROOT

#define STR_SHARED_ROOT   FL_USER5

Definition at line 87 of file string.c.

◆ STR_TMPLOCK

#define STR_TMPLOCK   FL_USER7

Definition at line 89 of file string.c.

◆ sym_equal

#define sym_equal   rb_obj_equal

Definition at line 10676 of file string.c.

◆ TERM_FILL

#define TERM_FILL (   ptr,
  termlen 
)
Value:
do {\
char *const term_fill_ptr = (ptr);\
const int term_fill_len = (termlen);\
*term_fill_ptr = '\0';\
if (UNLIKELY(term_fill_len > 1))\
memset(term_fill_ptr, 0, term_fill_len);\
} while (0)

Definition at line 125 of file string.c.

◆ TERM_LEN

#define TERM_LEN (   str)    rb_enc_mbminlen(rb_enc_get(str))

Definition at line 124 of file string.c.

◆ TR_TABLE_SIZE

#define TR_TABLE_SIZE   257

Definition at line 7357 of file string.c.

◆ WANTARRAY

#define WANTARRAY (   m,
  size 
)    (!rb_block_given_p() ? rb_ary_new_capa(size) : 0)

Definition at line 8125 of file string.c.

Typedef Documentation

◆ mapping_buffer

◆ USTR

typedef unsigned char* USTR

Definition at line 6987 of file string.c.

Enumeration Type Documentation

◆ neighbor_char

Enumerator
NEIGHBOR_NOT_CHAR 
NEIGHBOR_FOUND 
NEIGHBOR_WRAPPED 

Definition at line 3879 of file string.c.

Function Documentation

◆ Init_String()

void Init_String ( void  )

◆ rb_check_string_type()

VALUE rb_check_string_type ( VALUE  str)

◆ rb_enc_nth()

char* rb_enc_nth ( const char p,
const char e,
long  nth,
rb_encoding enc 
)

Definition at line 2388 of file string.c.

Referenced by rb_str_ellipsize().

◆ rb_enc_str_asciionly_p()

int rb_enc_str_asciionly_p ( VALUE  str)

◆ rb_enc_str_buf_cat()

VALUE rb_enc_str_buf_cat ( VALUE  str,
const char ptr,
long  len,
rb_encoding ptr_enc 
)

Definition at line 2919 of file string.c.

References ENC_CODERANGE_UNKNOWN, len, NULL, ptr, rb_enc_to_index(), and str.

Referenced by rb_reg_regsub().

◆ rb_enc_str_coderange()

int rb_enc_str_coderange ( VALUE  str)

◆ rb_enc_str_new()

VALUE rb_enc_str_new ( const char ptr,
long  len,
rb_encoding enc 
)

◆ rb_enc_str_new_cstr()

VALUE rb_enc_str_new_cstr ( const char ptr,
rb_encoding enc 
)

Definition at line 836 of file string.c.

◆ rb_enc_str_new_static()

VALUE rb_enc_str_new_static ( const char ptr,
long  len,
rb_encoding enc 
)

Definition at line 890 of file string.c.

◆ rb_enc_str_scrub()

VALUE rb_enc_str_scrub ( rb_encoding enc,
VALUE  str,
VALUE  repl 
)

Definition at line 10255 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_UNKNOWN, str, and STR_ENC_GET.

◆ rb_enc_strlen()

long rb_enc_strlen ( const char p,
const char e,
rb_encoding enc 
)

Definition at line 1740 of file string.c.

◆ rb_enc_strlen_cr()

long rb_enc_strlen_cr ( const char p,
const char e,
rb_encoding enc,
int cr 
)

Definition at line 1749 of file string.c.

References rb_enc_mbmaxlen, and rb_enc_mbminlen.

◆ rb_external_str_new()

VALUE rb_external_str_new ( const char ptr,
long  len 
)

Definition at line 1087 of file string.c.

References len, ptr, rb_default_external_encoding(), and rb_external_str_new_with_enc().

◆ rb_external_str_new_cstr()

VALUE rb_external_str_new_cstr ( const char ptr)

◆ rb_external_str_new_with_enc()

VALUE rb_external_str_new_with_enc ( const char ptr,
long  len,
rb_encoding eenc 
)

◆ rb_external_str_with_enc()

VALUE rb_external_str_with_enc ( VALUE  str,
rb_encoding eenc 
)

◆ rb_filesystem_str_new()

VALUE rb_filesystem_str_new ( const char ptr,
long  len 
)

Definition at line 1111 of file string.c.

References len, ptr, rb_external_str_new_with_enc(), and rb_filesystem_encoding().

◆ rb_filesystem_str_new_cstr()

VALUE rb_filesystem_str_new_cstr ( const char ptr)

Definition at line 1117 of file string.c.

References ptr, rb_external_str_new_with_enc(), rb_filesystem_encoding(), and strlen().

Referenced by rb_parser_compile_string().

◆ rb_fstring()

RUBY_FUNC_EXPORTED VALUE rb_fstring ( VALUE  str)

◆ rb_fstring_cstr()

VALUE rb_fstring_cstr ( const char ptr)

Definition at line 410 of file string.c.

References ptr, rb_fstring_new(), and strlen().

◆ rb_fstring_enc_new()

VALUE rb_fstring_enc_new ( const char ptr,
long  len,
rb_encoding enc 
)

Definition at line 403 of file string.c.

◆ rb_fstring_new()

MJIT_FUNC_EXPORTED VALUE rb_fstring_new ( const char ptr,
long  len 
)

Definition at line 396 of file string.c.

Referenced by rb_fstring_cstr().

◆ rb_id_quote_unprintable()

MJIT_FUNC_EXPORTED VALUE rb_id_quote_unprintable ( ID  id)

Definition at line 10735 of file string.c.

References rb_id2str, rb_str_inspect(), rb_str_symname_p(), and str.

◆ rb_locale_str_new()

VALUE rb_locale_str_new ( const char ptr,
long  len 
)

Definition at line 1099 of file string.c.

References len, ptr, rb_external_str_new_with_enc(), and rb_locale_encoding().

◆ rb_locale_str_new_cstr()

VALUE rb_locale_str_new_cstr ( const char ptr)

Definition at line 1105 of file string.c.

References ptr, rb_external_str_new_with_enc(), rb_locale_encoding(), and strlen().

◆ rb_must_asciicompat()

void rb_must_asciicompat ( VALUE  str)

◆ rb_obj_as_string()

VALUE rb_obj_as_string ( VALUE  obj)

Definition at line 1440 of file string.c.

References idTo_s, obj, rb_funcall, rb_obj_as_string_result(), RB_TYPE_P, str, and T_STRING.

Referenced by rb_inspect(), and rb_p().

◆ rb_obj_as_string_result()

MJIT_FUNC_EXPORTED VALUE rb_obj_as_string_result ( VALUE  str,
VALUE  obj 
)

Definition at line 1452 of file string.c.

References obj, rb_any_to_s(), RB_TYPE_P, str, and T_STRING.

Referenced by rb_obj_as_string().

◆ rb_setup_fake_str()

VALUE rb_setup_fake_str ( struct RString fake_str,
const char name,
long  len,
rb_encoding enc 
)

◆ rb_str_append()

VALUE rb_str_append ( VALUE  str,
VALUE  str2 
)

Definition at line 2965 of file string.c.

References rb_str_buf_append(), str, and StringValue().

Referenced by rb_keyword_error_new(), rb_load_fail(), rb_str_concat(), and rb_str_ellipsize().

◆ rb_str_buf_append()

VALUE rb_str_buf_append ( VALUE  str,
VALUE  str2 
)

Definition at line 2950 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, ENCODING_GET, RSTRING_LEN, RSTRING_PTR, and str.

Referenced by rb_str_append().

◆ rb_str_buf_cat_ascii()

VALUE rb_str_buf_cat_ascii ( VALUE  str,
const char ptr 
)

◆ rb_str_buf_cat_escaped_char()

int rb_str_buf_cat_escaped_char ( VALUE  result,
unsigned int  c,
int  unicode_p 
)

Definition at line 5815 of file string.c.

◆ rb_str_buf_new()

VALUE rb_str_buf_new ( long  capa)

Definition at line 1315 of file string.c.

References str.

Referenced by rb_econv_append(), rb_reg_regsub(), rb_str_buf_new_cstr(), and rb_str_concat_literals().

◆ rb_str_buf_new_cstr()

VALUE rb_str_buf_new_cstr ( const char ptr)

Definition at line 1331 of file string.c.

References len, ptr, rb_str_buf_cat, rb_str_buf_new(), str, and strlen().

◆ rb_str_capacity()

size_t rb_str_capacity ( VALUE  str)

Definition at line 712 of file string.c.

Referenced by rb_econv_append(), and rb_str_vcatf().

◆ rb_str_cat()

VALUE rb_str_cat ( VALUE  str,
const char ptr,
long  len 
)

◆ rb_str_cat_conv_enc_opts()

VALUE rb_str_cat_conv_enc_opts ( VALUE  newstr,
long  ofs,
const char ptr,
long  len,
rb_encoding from,
int  ecflags,
VALUE  ecopts 
)

Definition at line 943 of file string.c.

References len, ptr, rb_eIndexError, rb_raise(), rb_str_cat(), rb_str_modify(), RSTRING_LEN, and STR_SET_LEN.

◆ rb_str_cat_cstr()

VALUE rb_str_cat_cstr ( VALUE  str,
const char ptr 
)

Definition at line 2822 of file string.c.

◆ rb_str_change_terminator_length()

void rb_str_change_terminator_length ( VALUE  str,
const int  oldtermlen,
const int  termlen 
)

Definition at line 2230 of file string.c.

References RString::capa.

◆ rb_str_chomp_string()

VALUE rb_str_chomp_string ( VALUE  str,
VALUE  rs 
)

Definition at line 8921 of file string.c.

References len, RSTRING_LEN, and str.

◆ rb_str_cmp()

int rb_str_cmp ( VALUE  str1,
VALUE  str2 
)

Definition at line 3228 of file string.c.

References ENCODING_GET, lesser, memcmp(), rb_str_comparable(), and RSTRING_GETMEM.

Referenced by rb_iseq_pathobj_new().

◆ rb_str_coderange_scan_restartable()

long rb_str_coderange_scan_restartable ( const char s,
const char e,
rb_encoding enc,
int cr 
)

◆ rb_str_comparable()

int rb_str_comparable ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_concat()

VALUE rb_str_concat ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_concat_literals()

MJIT_FUNC_EXPORTED VALUE rb_str_concat_literals ( size_t  num,
const VALUE strary 
)

◆ rb_str_conv_enc()

VALUE rb_str_conv_enc ( VALUE  str,
rb_encoding from,
rb_encoding to 
)

◆ rb_str_conv_enc_opts()

VALUE rb_str_conv_enc_opts ( VALUE  str,
rb_encoding from,
rb_encoding to,
int  ecflags,
VALUE  ecopts 
)

◆ rb_str_drop_bytes()

VALUE rb_str_drop_bytes ( VALUE  str,
long  len 
)

Definition at line 4573 of file string.c.

References ptr, RSTRING_LEN, RSTRING_PTR, and str.

◆ rb_str_dump()

VALUE rb_str_dump ( VALUE  str)

Definition at line 6042 of file string.c.

References len, rb_enc_from_index(), rb_enc_get_index(), rb_encoding, and str.

◆ rb_str_dup()

VALUE rb_str_dup ( VALUE  str)

◆ rb_str_ellipsize()

VALUE rb_str_ellipsize ( VALUE  str,
long  len 
)

Shortens str and adds three dots, an ellipsis, if it is longer than len characters.

Parameters
strthe string to ellipsize.
lenthe maximum string length.
Returns
the ellipsized string.
Precondition
len must not be negative.
Postcondition
the length of the returned string in characters is less than or equal to len.
If the length of str is less than or equal len, returns str itself.
the encoding of returned string is equal to the encoding of str.
the class of returned string is equal to the class of str.
Note
the length is counted in characters.

Definition at line 10185 of file string.c.

References len, Qnil, rb_eIndexError, rb_enc_asciicompat, rb_enc_associate(), rb_enc_from_encoding(), rb_enc_get(), rb_enc_mbminlen, rb_enc_nth(), rb_enc_step_back, rb_encoding, rb_raise(), rb_str_append(), rb_str_cat(), rb_str_encode(), rb_str_new_with_class(), rb_str_subseq(), rb_usascii_str_new(), RSTRING_LEN, RSTRING_PTR, and str.

◆ rb_str_eql()

MJIT_FUNC_EXPORTED VALUE rb_str_eql ( VALUE  str1,
VALUE  str2 
)

Definition at line 3287 of file string.c.

References Qfalse, Qtrue, RB_TYPE_P, and T_STRING.

◆ rb_str_equal()

VALUE rb_str_equal ( VALUE  str1,
VALUE  str2 
)

Definition at line 3267 of file string.c.

References idTo_str, Qfalse, Qtrue, rb_equal(), rb_respond_to(), RB_TYPE_P, and T_STRING.

◆ rb_str_export()

VALUE rb_str_export ( VALUE  str)

Definition at line 1123 of file string.c.

References rb_default_external_encoding(), rb_str_conv_enc(), str, and STR_ENC_GET.

◆ rb_str_export_locale()

VALUE rb_str_export_locale ( VALUE  str)

Definition at line 1129 of file string.c.

References rb_locale_encoding(), rb_str_conv_enc(), str, and STR_ENC_GET.

◆ rb_str_export_to_enc()

VALUE rb_str_export_to_enc ( VALUE  str,
rb_encoding enc 
)

Definition at line 1135 of file string.c.

References rb_str_conv_enc(), str, and STR_ENC_GET.

◆ rb_str_fill_terminator()

char* rb_str_fill_terminator ( VALUE  str,
const int  newminlen 
)

Definition at line 2306 of file string.c.

References len, RSTRING_LEN, RSTRING_PTR, and str.

◆ rb_str_free()

void rb_str_free ( VALUE  str)

◆ rb_str_freeze()

VALUE rb_str_freeze ( VALUE  str)

Definition at line 2616 of file string.c.

References OBJ_FROZEN, rb_obj_freeze(), rb_str_resize(), RSTRING_LEN, and str.

◆ rb_str_hash()

st_index_t rb_str_hash ( VALUE  str)

◆ rb_str_hash_cmp()

int rb_str_hash_cmp ( VALUE  str1,
VALUE  str2 
)

Definition at line 3173 of file string.c.

References memcmp(), rb_str_comparable(), and RSTRING_GETMEM.

◆ rb_str_include_range_p()

VALUE rb_str_include_range_p ( VALUE  beg,
VALUE  end,
VALUE  val,
VALUE  exclusive 
)

◆ rb_str_initialize()

VALUE rb_str_initialize ( VALUE  str,
const char ptr,
long  len,
rb_encoding enc 
)

Definition at line 964 of file string.c.

References len, ptr, rb_enc_associate(), rb_str_cat(), str, and STR_SET_LEN.

◆ rb_str_inspect()

VALUE rb_str_inspect ( VALUE  str)

Definition at line 5930 of file string.c.

References buf, CHAR_ESC_LEN, ENCODING_GET, rb_enc_from_index(), rb_encoding, and str.

Referenced by rb_id_quote_unprintable().

◆ rb_str_length()

VALUE rb_str_length ( VALUE  str)

Definition at line 1843 of file string.c.

References LONG2NUM.

◆ rb_str_locktmp_ensure()

RUBY_FUNC_EXPORTED VALUE rb_str_locktmp_ensure ( VALUE  str,
VALUE(*)(VALUE func,
VALUE  arg 
)

Definition at line 2685 of file string.c.

References arg, rb_ensure(), rb_str_locktmp(), rb_str_unlocktmp(), and str.

◆ rb_str_memsize()

RUBY_FUNC_EXPORTED size_t rb_str_memsize ( VALUE  str)

Definition at line 1371 of file string.c.

References FL_TEST, str, STR_HEAP_SIZE, STR_NOEMBED, STR_NOFREE, and STR_SHARED.

◆ rb_str_modify()

void rb_str_modify ( VALUE  str)

Definition at line 2114 of file string.c.

Referenced by rb_str_cat_conv_enc_opts(), and rb_str_vcatf().

◆ rb_str_modify_expand()

void rb_str_modify_expand ( VALUE  str,
long  expand 
)

Definition at line 2122 of file string.c.

References len, LONG_MAX, rb_eArgError, rb_raise(), RSTRING_LEN, str, and TERM_LEN.

◆ rb_str_new()

VALUE rb_str_new ( const char ptr,
long  len 
)

◆ rb_str_new_cstr()

VALUE rb_str_new_cstr ( const char ptr)

◆ rb_str_new_frozen()

VALUE rb_str_new_frozen ( VALUE  orig)

Definition at line 1203 of file string.c.

References OBJ_FROZEN.

Referenced by rb_econv_substr_append(), rb_hash_key_str(), rb_str_include_range_p(), and rb_str_subseq().

◆ rb_str_new_shared()

VALUE rb_str_new_shared ( VALUE  str)

Definition at line 1197 of file string.c.

Referenced by rb_str_subseq().

◆ rb_str_new_static()

VALUE rb_str_new_static ( const char ptr,
long  len 
)

Definition at line 872 of file string.c.

◆ rb_str_new_with_class()

VALUE rb_str_new_with_class ( VALUE  obj,
const char ptr,
long  len 
)

Definition at line 1298 of file string.c.

Referenced by rb_str_ellipsize(), rb_str_subseq(), and rb_str_succ().

◆ rb_str_offset()

long rb_str_offset ( VALUE  str,
long  pos 
)

Definition at line 2416 of file string.c.

◆ rb_str_opt_plus()

MJIT_FUNC_EXPORTED VALUE rb_str_opt_plus ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_ord()

VALUE rb_str_ord ( VALUE  s)

Definition at line 9527 of file string.c.

References rb_enc_codepoint, RSTRING_END, RSTRING_PTR, STR_ENC_GET, and UINT2NUM.

◆ rb_str_plus()

VALUE rb_str_plus ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_quote_unprintable()

VALUE rb_str_quote_unprintable ( VALUE  str)

◆ rb_str_replace()

VALUE rb_str_replace ( VALUE  str,
VALUE  str2 
)

Definition at line 5363 of file string.c.

◆ rb_str_resize()

VALUE rb_str_resize ( VALUE  str,
long  len 
)

◆ rb_str_resurrect()

VALUE rb_str_resurrect ( VALUE  str)

Definition at line 1522 of file string.c.

References RSTRING_LEN, RUBY_DTRACE_CREATE_HOOK, and str.

Referenced by rb_str_concat_literals().

◆ rb_str_scrub()

VALUE rb_str_scrub ( VALUE  str,
VALUE  repl 
)
Parameters
strthe string to be scrubbed
replthe replacement character
Returns
If given string is invalid, returns a new string. Otherwise, returns Qnil.

Definition at line 10248 of file string.c.

References rb_encoding, str, and STR_ENC_GET.

◆ rb_str_set_len()

void rb_str_set_len ( VALUE  str,
long  len 
)

Definition at line 2692 of file string.c.

References RString::capa, str, and TERM_LEN.

Referenced by rb_econv_append().

◆ rb_str_setter()

void rb_str_setter ( VALUE  val,
ID  id,
VALUE var 
)

Definition at line 10077 of file string.c.

References NIL_P, PRIsVALUE, rb_eTypeError, rb_id2str, rb_raise(), RB_TYPE_P, and T_STRING.

◆ rb_str_shared_replace()

void rb_str_shared_replace ( VALUE  str,
VALUE  str2 
)

Definition at line 1391 of file string.c.

References str.

◆ rb_str_split()

VALUE rb_str_split ( VALUE  str,
const char sep0 
)

Definition at line 8116 of file string.c.

References rb_str_new_cstr(), str, and StringValue().

◆ rb_str_strlen()

long rb_str_strlen ( VALUE  str)

Definition at line 1829 of file string.c.

◆ rb_str_sublen()

long rb_str_sublen ( VALUE  str,
long  pos 
)

Definition at line 2463 of file string.c.

Referenced by rb_reg_match2().

◆ rb_str_subpos()

char* rb_str_subpos ( VALUE  str,
long  beg,
long lenp 
)

Definition at line 2497 of file string.c.

References L, len, rb_encoding, RSTRING_LEN, RSTRING_PTR, str, and STR_ENC_GET.

◆ rb_str_subseq()

VALUE rb_str_subseq ( VALUE  str,
long  beg,
long  len 
)

◆ rb_str_substr()

VALUE rb_str_substr ( VALUE  str,
long  beg,
long  len 
)

Definition at line 2584 of file string.c.

◆ rb_str_succ()

VALUE rb_str_succ ( VALUE  orig)

Definition at line 4090 of file string.c.

References rb_str_new_with_class(), RSTRING_LEN, RSTRING_PTR, and str.

◆ rb_str_symname_p()

int rb_str_symname_p ( VALUE  sym)

◆ rb_str_times()

VALUE rb_str_times ( VALUE  str,
VALUE  times 
)

Definition at line 1966 of file string.c.

References INT2FIX, len, n, rb_str_dup(), and str.

◆ rb_str_tmp_frozen_acquire()

VALUE rb_str_tmp_frozen_acquire ( VALUE  orig)

Definition at line 1210 of file string.c.

References OBJ_FROZEN_RAW.

◆ rb_str_tmp_frozen_release()

void rb_str_tmp_frozen_release ( VALUE  orig,
VALUE  tmp 
)

◆ rb_str_tmp_new()

VALUE rb_str_tmp_new ( long  len)

Definition at line 1343 of file string.c.

Referenced by VpAlloc().

◆ rb_str_to_cstr()

char* rb_str_to_cstr ( VALUE  str)

Definition at line 2284 of file string.c.

◆ rb_str_to_str()

VALUE rb_str_to_str ( VALUE  str)

Definition at line 1382 of file string.c.

References idTo_str, rb_convert_type_with_id(), str, and T_STRING.

Referenced by rb_string_value().

◆ rb_str_unlocktmp()

VALUE rb_str_unlocktmp ( VALUE  str)

Definition at line 2675 of file string.c.

References FL_TEST, FL_UNSET, rb_eRuntimeError, rb_raise(), str, and STR_TMPLOCK.

Referenced by rb_str_locktmp_ensure().

◆ rb_str_update()

void rb_str_update ( VALUE  str,
long  beg,
long  len,
VALUE  val 
)

Definition at line 4643 of file string.c.

References rb_encoding.

◆ rb_str_upto_each()

VALUE rb_str_upto_each ( VALUE  beg,
VALUE  end,
int  excl,
int(*)(VALUE, VALUE each,
VALUE  arg 
)

Definition at line 4263 of file string.c.

◆ rb_str_upto_endless_each()

VALUE rb_str_upto_endless_each ( VALUE  beg,
int(*)(VALUE, VALUE each,
VALUE  arg 
)

Definition at line 4345 of file string.c.

◆ rb_string_value()

VALUE rb_string_value ( volatile VALUE ptr)

Definition at line 2175 of file string.c.

References ptr, rb_str_to_str(), RB_TYPE_P, and T_STRING.

Referenced by rb_string_value_cstr(), and rb_string_value_ptr().

◆ rb_string_value_cstr()

char* rb_string_value_cstr ( volatile VALUE ptr)

Definition at line 2291 of file string.c.

References ptr, rb_string_value(), and str.

◆ rb_string_value_ptr()

char* rb_string_value_ptr ( volatile VALUE ptr)

Definition at line 2186 of file string.c.

References ptr, rb_string_value(), RSTRING_PTR, and str.

◆ rb_sym_proc_call()

MJIT_FUNC_EXPORTED VALUE rb_sym_proc_call ( ID  mid,
int  argc,
const VALUE argv,
int  kw_splat,
VALUE  passed_proc 
)

Definition at line 10816 of file string.c.

References argc, argv, obj, rb_eArgError, rb_funcall_with_block_kw(), and rb_raise().

◆ rb_sym_to_s()

VALUE rb_sym_to_s ( VALUE  sym)

Definition at line 10793 of file string.c.

◆ rb_tainted_str_new()

VALUE rb_tainted_str_new ( const char ptr,
long  len 
)

Definition at line 896 of file string.c.

References len, ptr, rb_str_new(), and rb_warning().

◆ rb_tainted_str_new_cstr()

VALUE rb_tainted_str_new_cstr ( const char ptr)

Definition at line 903 of file string.c.

References ptr, rb_str_new_cstr(), and rb_warning().

◆ rb_usascii_str_new()

VALUE rb_usascii_str_new ( const char ptr,
long  len 
)

Definition at line 780 of file string.c.

References ENC_CODERANGE_7BIT, ENCODING_CODERANGE_SET, len, ptr, rb_str_new(), rb_usascii_encindex(), and str.

Referenced by rb_str_ellipsize().

◆ rb_usascii_str_new_cstr()

VALUE rb_usascii_str_new_cstr ( const char ptr)

◆ rb_usascii_str_new_static()

VALUE rb_usascii_str_new_static ( const char ptr,
long  len 
)

Definition at line 878 of file string.c.

◆ rb_utf8_str_new()

VALUE rb_utf8_str_new ( const char ptr,
long  len 
)

Definition at line 788 of file string.c.

References str.

◆ rb_utf8_str_new_cstr()

VALUE rb_utf8_str_new_cstr ( const char ptr)

Definition at line 828 of file string.c.

References ptr, rb_enc_associate_index(), rb_str_new_cstr(), rb_utf8_encindex(), and str.

◆ rb_utf8_str_new_static()

VALUE rb_utf8_str_new_static ( const char ptr,
long  len 
)

Definition at line 884 of file string.c.

◆ RUBY_ALIAS_FUNCTION() [1/2]

RUBY_ALIAS_FUNCTION ( rb_str_buf_cat(VALUE str, const char *ptr, long len ,
rb_str_cat  ,
(str, ptr, len  
)

◆ RUBY_ALIAS_FUNCTION() [2/2]

RUBY_ALIAS_FUNCTION ( rb_str_dup_frozen(VALUE str ,
rb_str_new_frozen  ,
(str  
)

Definition at line 2661 of file string.c.

References FL_SET, FL_TEST, rb_eRuntimeError, rb_raise(), str, and STR_TMPLOCK.

◆ ruby_escaped_char()

const char* ruby_escaped_char ( int  c)

Definition at line 5848 of file string.c.

References NULL.

◆ STATIC_ASSERT()

Variable Documentation

◆ rb_fs

VALUE rb_fs

Definition at line 452 of file string.c.

◆ rb_fstring_hash_type

const struct st_hash_type rb_fstring_hash_type
Initial value:
= {
fstring_cmp,
}

Definition at line 260 of file string.c.

Referenced by Init_vm_objects().

STR_EMBEDDABLE_P
#define STR_EMBEDDABLE_P(len, termlen)
Definition: string.c:181
UNLIKELY
#define UNLIKELY(x)
Definition: ffi_common.h:126
void
void
Definition: rb_mjit_min_header-2.7.0.h:13273
RSTRING_EMBED_LEN_MASK
@ RSTRING_EMBED_LEN_MASK
Definition: ruby.h:979
ENC_CODERANGE_VALID
#define ENC_CODERANGE_VALID
Definition: encoding.h:105
RSTRING_EMBED_LEN_SHIFT
@ RSTRING_EMBED_LEN_SHIFT
Definition: ruby.h:981
RSTRING_PTR
#define RSTRING_PTR(str)
Definition: ruby.h:1009
TERM_LEN
#define TERM_LEN(str)
Definition: string.c:124
STR_BORROWED
#define STR_BORROWED
Definition: string.c:88
int
__inline__ int
Definition: rb_mjit_min_header-2.7.0.h:2839
ptr
struct RIMemo * ptr
Definition: debug.c:74
FL_TEST
#define FL_TEST(x, f)
Definition: ruby.h:1353
OnigUChar
unsigned char OnigUChar
Definition: onigmo.h:79
STR_NOEMBED
#define STR_NOEMBED
Definition: internal.h:2155
ALLOC_N
#define ALLOC_N(type, n)
Definition: ruby.h:1663
STR_SHARED
#define STR_SHARED
Definition: internal.h:2156
RBASIC_CLASS
#define RBASIC_CLASS(obj)
Definition: ruby.h:906
STR_SHARED_ROOT
#define STR_SHARED_ROOT
Definition: string.c:87
STR_HEAP_SIZE
#define STR_HEAP_SIZE(str)
Definition: string.c:168
rb_str_hash
st_index_t rb_str_hash(VALUE str)
Definition: string.c:3163
n
const char size_t n
Definition: rb_mjit_min_header-2.7.0.h:5456
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
ENC_CODERANGE_7BIT
#define ENC_CODERANGE_7BIT
Definition: encoding.h:104
RSTRING
#define RSTRING(obj)
Definition: ruby.h:1271
STR_EMBED_P
#define STR_EMBED_P(str)
Definition: internal.h:2157
RSTRING_LEN
#define RSTRING_LEN(str)
Definition: ruby.h:1005
STR_FAKESTR
#define STR_FAKESTR
Definition: string.c:91