Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
string.c File Reference
#include "internal.h"
#include "ruby/re.h"
#include "encindex.h"
#include "probes.h"
#include "gc.h"
#include "ruby_assert.h"
#include "id.h"
#include <math.h>
#include <ctype.h>
#include "missing/crypt.h"
Include dependency graph for string.c:

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 STRING_ENUMERATORS_WANTARRAY   0 /* next major */
 
#define RUBY_MAX_CHAR_LEN   16
 
#define STR_IS_SHARED_M   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_TAINT|FL_EXIVAR) && RBASIC_CLASS(str) == rb_cString)
 
#define STR_BUF_MIN_SIZE   127
 
#define rb_str_dup_frozen   rb_str_new_frozen
 
#define str_buf_cat2(str, ptr)   str_buf_cat((str), (ptr), strlen(ptr))
 
#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 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 char * USTR
 

Enumerations

enum  neighbor_char { NEIGHBOR_NOT_CHAR, NEIGHBOR_FOUND, NEIGHBOR_WRAPPED }
 

Functions

static VALUE rb_str_clear (VALUE str)
 
static VALUE str_replace_shared_without_enc (VALUE str2, VALUE str)
 
static VALUE str_new_shared (VALUE klass, VALUE str)
 
static VALUE str_new_frozen (VALUE klass, VALUE orig)
 
static VALUE str_new_static (VALUE klass, const char *ptr, long len, int encindex)
 
static void str_make_independent_expand (VALUE str, long len, long expand, const int termlen)
 
static void str_modifiable (VALUE str)
 
static VALUE rb_str_downcase (int argc, VALUE *argv, VALUE str)
 
static void str_make_independent (VALUE str)
 
static rb_encodingget_actual_encoding (const int encidx, VALUE str)
 
static rb_encodingget_encoding (VALUE str)
 
static void mustnot_broken (VALUE str)
 
static void mustnot_wchar (VALUE str)
 
static int fstring_cmp (VALUE a, VALUE b)
 
static VALUE register_fstring (VALUE str)
 
static int fstr_update_callback (st_data_t *key, st_data_t *value, st_data_t arg, int existing)
 
RUBY_FUNC_EXPORTED VALUE rb_fstring (VALUE str)
 
static VALUE setup_fake_str (struct RString *fake_str, const char *name, long len, int encidx)
 
VALUE rb_setup_fake_str (struct RString *fake_str, const char *name, long len, rb_encoding *enc)
 
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)
 
VALUE rb_fstring_enc_cstr (const char *ptr, rb_encoding *enc)
 
static int fstring_set_class_i (st_data_t key, st_data_t val, st_data_t arg)
 
static int single_byte_optimizable (VALUE str)
 
static const char * search_nonascii (const char *p, const char *e)
 
static int coderange_scan (const char *p, long len, rb_encoding *enc)
 
long rb_str_coderange_scan_restartable (const char *s, const char *e, rb_encoding *enc, int *cr)
 
static void str_enc_copy (VALUE str1, VALUE str2)
 
static void rb_enc_cr_str_copy_for_substr (VALUE dest, VALUE src)
 
static void rb_enc_cr_str_exact_copy (VALUE dest, VALUE src)
 
int rb_enc_str_coderange (VALUE str)
 
int rb_enc_str_asciionly_p (VALUE str)
 
static void str_mod_check (VALUE s, const char *p, long len)
 
static size_t str_capacity (VALUE str, const int termlen)
 
size_t rb_str_capacity (VALUE str)
 
static void must_not_null (const char *ptr)
 
static VALUE str_alloc (VALUE klass)
 
static VALUE empty_str_alloc (VALUE klass)
 
static VALUE str_new0 (VALUE klass, const char *ptr, long len, int termlen)
 
static VALUE str_new (VALUE klass, const char *ptr, long len)
 
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)
 
static VALUE rb_tainted_str_new_with_enc (const char *ptr, long len, rb_encoding *enc)
 
VALUE rb_tainted_str_new_cstr (const char *ptr)
 
static VALUE str_cat_conv_enc_opts (VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
 
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_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)
 
static VALUE str_replace_shared (VALUE str2, VALUE str)
 
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 VALUE str_new_empty (VALUE str)
 
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)
 
static void str_discard (VALUE str)
 
static void str_shared_replace (VALUE str, VALUE str2)
 
void rb_str_shared_replace (VALUE str, VALUE str2)
 
VALUE rb_obj_as_string (VALUE obj)
 
static VALUE str_replace (VALUE str, VALUE str2)
 
static VALUE str_duplicate (VALUE klass, VALUE str)
 
VALUE rb_str_dup (VALUE str)
 
VALUE rb_str_resurrect (VALUE str)
 
static VALUE rb_str_init (int argc, VALUE *argv, VALUE str)
 
static long enc_strlen (const char *p, const char *e, rb_encoding *enc, int cr)
 
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)
 
static long str_strlen (VALUE str, rb_encoding *enc)
 
long rb_str_strlen (VALUE str)
 
VALUE rb_str_length (VALUE str)
 
static VALUE rb_str_bytesize (VALUE str)
 
static VALUE rb_str_empty (VALUE str)
 
VALUE rb_str_plus (VALUE str1, VALUE str2)
 
VALUE rb_str_times (VALUE str, VALUE times)
 
static VALUE rb_str_format_m (VALUE str, VALUE arg)
 
static void rb_check_lockedtmp (VALUE str)
 
static int str_dependent_p (VALUE str)
 
static int str_independent (VALUE str)
 
void rb_str_modify (VALUE str)
 
void rb_str_modify_expand (VALUE str, long expand)
 
static void str_modify_keep_cr (VALUE str)
 
void rb_must_asciicompat (VALUE str)
 
VALUE rb_string_value (volatile VALUE *ptr)
 
char * rb_string_value_ptr (volatile VALUE *ptr)
 
static int zero_filled (const char *s, int n)
 
static const char * str_null_char (const char *s, long len, const int minlen, rb_encoding *enc)
 
static char * str_fill_term (VALUE str, char *s, long len, int termlen)
 
void rb_str_change_terminator_length (VALUE str, const int oldtermlen, const int termlen)
 
char * rb_string_value_cstr (volatile VALUE *ptr)
 
char * rb_str_fill_terminator (VALUE str, const int newminlen)
 
VALUE rb_check_string_type (VALUE str)
 
static VALUE rb_str_s_try_convert (VALUE dummy, VALUE str)
 
static char * str_nth_len (const char *p, const char *e, long *nthp, rb_encoding *enc)
 
char * rb_enc_nth (const char *p, const char *e, long nth, rb_encoding *enc)
 
static char * str_nth (const char *p, const char *e, long nth, rb_encoding *enc, int singlebyte)
 
static long str_offset (const char *p, const char *e, long nth, rb_encoding *enc, int singlebyte)
 
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)
 
char * rb_str_subpos (VALUE str, long beg, long *lenp)
 
static VALUE str_substr (VALUE str, long beg, long len, int empty)
 
VALUE rb_str_substr (VALUE str, long beg, long len)
 
VALUE rb_str_freeze (VALUE str)
 
static VALUE str_uplus (VALUE str)
 
static VALUE str_uminus (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)
 
static VALUE str_buf_cat (VALUE str, const char *ptr, 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)
 
VALUE rb_str_concat_literals (size_t num, const VALUE *strary)
 
static VALUE rb_str_concat_multi (int argc, VALUE *argv, VALUE str)
 
VALUE rb_str_concat (VALUE str1, VALUE str2)
 
static VALUE rb_str_prepend_multi (int argc, VALUE *argv, VALUE str)
 
st_index_t rb_str_hash (VALUE str)
 
int rb_str_hash_cmp (VALUE str1, VALUE str2)
 
static VALUE rb_str_hash_m (VALUE str)
 
int rb_str_comparable (VALUE str1, VALUE str2)
 
int rb_str_cmp (VALUE str1, VALUE str2)
 
static VALUE str_eql (const VALUE str1, const VALUE str2)
 
VALUE rb_str_equal (VALUE str1, VALUE str2)
 
static VALUE rb_str_eql (VALUE str1, VALUE str2)
 
static VALUE rb_str_cmp_m (VALUE str1, VALUE str2)
 
static VALUE rb_str_casecmp (VALUE str1, VALUE str2)
 
static VALUE rb_str_casecmp_p (VALUE str1, VALUE str2)
 
static long rb_strseq_index (VALUE str, VALUE sub, long offset, int in_byte)
 
static VALUE rb_str_index_m (int argc, VALUE *argv, VALUE str)
 
static long str_rindex (VALUE str, VALUE sub, const char *s, long pos, rb_encoding *enc)
 
static long rb_str_rindex (VALUE str, VALUE sub, long pos)
 
static VALUE rb_str_rindex_m (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_match (VALUE x, VALUE y)
 
static VALUE get_pat (VALUE)
 
static VALUE rb_str_match_m (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_match_m_p (int argc, VALUE *argv, VALUE str)
 
static enum neighbor_char enc_succ_char (char *p, long len, rb_encoding *enc)
 
static enum neighbor_char enc_pred_char (char *p, long len, rb_encoding *enc)
 
static enum neighbor_char enc_succ_alnum_char (char *p, long len, rb_encoding *enc, char *carry)
 
static VALUE str_succ (VALUE str)
 
VALUE rb_str_succ (VALUE orig)
 
static VALUE rb_str_succ_bang (VALUE str)
 
static int all_digits_p (const char *s, long len)
 
static VALUE str_upto_each (VALUE beg, VALUE end, int excl, int(*each)(VALUE, VALUE), VALUE)
 
static int str_upto_i (VALUE str, VALUE arg)
 
static VALUE rb_str_upto (int argc, VALUE *argv, VALUE beg)
 
static int include_range_i (VALUE str, VALUE arg)
 
VALUE rb_str_include_range_p (VALUE beg, VALUE end, VALUE val, VALUE exclusive)
 
static VALUE rb_str_subpat (VALUE str, VALUE re, VALUE backref)
 
static VALUE rb_str_aref (VALUE str, VALUE indx)
 
static VALUE rb_str_aref_m (int argc, VALUE *argv, VALUE str)
 
VALUE rb_str_drop_bytes (VALUE str, long len)
 
static void rb_str_splice_0 (VALUE str, long beg, long len, VALUE val)
 
void rb_str_update (VALUE str, long beg, long len, VALUE val)
 
static void rb_str_subpat_set (VALUE str, VALUE re, VALUE backref, VALUE val)
 
static VALUE rb_str_aset (VALUE str, VALUE indx, VALUE val)
 
static VALUE rb_str_aset_m (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_insert (VALUE str, VALUE idx, VALUE str2)
 
static VALUE rb_str_slice_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE get_pat_quoted (VALUE pat, int check)
 
static long rb_pat_search (VALUE pat, VALUE str, long pos, int set_backref_str)
 
static VALUE rb_str_sub_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_sub (int argc, VALUE *argv, VALUE str)
 
static VALUE str_gsub (int argc, VALUE *argv, VALUE str, int bang)
 
static VALUE rb_str_gsub_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_gsub (int argc, VALUE *argv, VALUE str)
 
VALUE rb_str_replace (VALUE str, VALUE str2)
 
static VALUE rb_str_chr (VALUE str)
 
static VALUE rb_str_getbyte (VALUE str, VALUE index)
 
static VALUE rb_str_setbyte (VALUE str, VALUE index, VALUE value)
 
static VALUE str_byte_substr (VALUE str, long beg, long len, int empty)
 
static VALUE str_byte_aref (VALUE str, VALUE indx)
 
static VALUE rb_str_byteslice (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_reverse (VALUE str)
 
static VALUE rb_str_reverse_bang (VALUE str)
 
static VALUE rb_str_include (VALUE str, VALUE arg)
 
static VALUE rb_str_to_i (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_to_f (VALUE str)
 
static VALUE rb_str_to_s (VALUE str)
 
int rb_str_buf_cat_escaped_char (VALUE result, unsigned int c, int unicode_p)
 
VALUE rb_str_escape (VALUE str)
 
VALUE rb_str_inspect (VALUE str)
 
VALUE rb_str_dump (VALUE str)
 
static void rb_str_check_dummy_enc (rb_encoding *enc)
 
static OnigCaseFoldType check_case_options (int argc, VALUE *argv, OnigCaseFoldType flags)
 
static VALUE rb_str_casemap (VALUE source, OnigCaseFoldType *flags, rb_encoding *enc)
 
static void rb_str_ascii_casemap (VALUE source, OnigCaseFoldType *flags, rb_encoding *enc)
 
static VALUE rb_str_upcase_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_upcase (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_downcase_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_capitalize_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_capitalize (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_swapcase_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_swapcase (int argc, VALUE *argv, VALUE str)
 
static unsigned int trnext (struct tr *t, rb_encoding *enc)
 
static VALUE rb_str_delete_bang (int, VALUE *, VALUE)
 
static VALUE tr_trans (VALUE str, VALUE src, VALUE repl, int sflag)
 
static VALUE rb_str_tr_bang (VALUE str, VALUE src, VALUE repl)
 
static VALUE rb_str_tr (VALUE str, VALUE src, VALUE repl)
 
static void tr_setup_table (VALUE str, char stable[TR_TABLE_SIZE], int first, VALUE *tablep, VALUE *ctablep, rb_encoding *enc)
 
static int tr_find (unsigned int c, const char table[TR_TABLE_SIZE], VALUE del, VALUE nodel)
 
static VALUE rb_str_delete (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_squeeze_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_squeeze (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_tr_s_bang (VALUE str, VALUE src, VALUE repl)
 
static VALUE rb_str_tr_s (VALUE str, VALUE src, VALUE repl)
 
static VALUE rb_str_count (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_fs_check (VALUE val)
 
static VALUE rb_str_split_m (int argc, VALUE *argv, VALUE str)
 
VALUE rb_str_split (VALUE str, const char *sep0)
 
static const char * chomp_newline (const char *p, const char *e, rb_encoding *enc)
 
static VALUE rb_str_enumerate_lines (int argc, VALUE *argv, VALUE str, int wantarray)
 
static VALUE rb_str_each_line (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_lines (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_each_byte_size (VALUE str, VALUE args, VALUE eobj)
 
static VALUE rb_str_enumerate_bytes (VALUE str, int wantarray)
 
static VALUE rb_str_each_byte (VALUE str)
 
static VALUE rb_str_bytes (VALUE str)
 
static VALUE rb_str_each_char_size (VALUE str, VALUE args, VALUE eobj)
 
static VALUE rb_str_enumerate_chars (VALUE str, int wantarray)
 
static VALUE rb_str_each_char (VALUE str)
 
static VALUE rb_str_chars (VALUE str)
 
static VALUE rb_str_enumerate_codepoints (VALUE str, int wantarray)
 
static VALUE rb_str_each_codepoint (VALUE str)
 
static VALUE rb_str_codepoints (VALUE str)
 
static long chopped_length (VALUE str)
 
static VALUE rb_str_chop_bang (VALUE str)
 
static VALUE rb_str_chop (VALUE str)
 
static long chompped_length (VALUE str, VALUE rs)
 
static VALUE chomp_rs (int argc, const VALUE *argv)
 
VALUE rb_str_chomp_string (VALUE str, VALUE rs)
 
static VALUE rb_str_chomp_bang (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_chomp (int argc, VALUE *argv, VALUE str)
 
static long lstrip_offset (VALUE str, const char *s, const char *e, rb_encoding *enc)
 
static VALUE rb_str_lstrip_bang (VALUE str)
 
static VALUE rb_str_lstrip (VALUE str)
 
static long rstrip_offset (VALUE str, const char *s, const char *e, rb_encoding *enc)
 
static VALUE rb_str_rstrip_bang (VALUE str)
 
static VALUE rb_str_rstrip (VALUE str)
 
static VALUE rb_str_strip_bang (VALUE str)
 
static VALUE rb_str_strip (VALUE str)
 
static VALUE scan_once (VALUE str, VALUE pat, long *start)
 
static VALUE rb_str_scan (VALUE str, VALUE pat)
 
static VALUE rb_str_hex (VALUE str)
 
static VALUE rb_str_oct (VALUE str)
 
static VALUE rb_str_crypt (VALUE str, VALUE salt)
 
VALUE rb_str_ord (VALUE s)
 
static VALUE rb_str_sum (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_justify (int argc, VALUE *argv, VALUE str, char jflag)
 
static VALUE rb_str_ljust (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_rjust (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_center (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_partition (VALUE str, VALUE sep)
 
static VALUE rb_str_rpartition (VALUE str, VALUE sep)
 
static VALUE rb_str_start_with (int argc, VALUE *argv, VALUE str)
 
static VALUE rb_str_end_with (int argc, VALUE *argv, VALUE str)
 
void rb_str_setter (VALUE val, ID id, VALUE *var)
 
static void rb_fs_setter (VALUE val, ID id, VALUE *var)
 
static VALUE rb_str_force_encoding (VALUE str, VALUE enc)
 
static VALUE rb_str_b (VALUE str)
 
static VALUE rb_str_valid_encoding_p (VALUE str)
 
static VALUE rb_str_is_ascii_only_p (VALUE str)
 
VALUE rb_str_ellipsize (VALUE str, long len)
 Shortens str and adds three dots, an ellipsis, if it is longer than len characters. More...
 
static VALUE str_compat_and_valid (VALUE str, rb_encoding *enc)
 
static VALUE enc_str_scrub (rb_encoding *enc, VALUE str, VALUE repl, int cr)
 
VALUE rb_str_scrub (VALUE str, VALUE repl)
 
VALUE rb_enc_str_scrub (rb_encoding *enc, VALUE str, VALUE repl)
 
static VALUE str_scrub (int argc, VALUE *argv, VALUE str)
 
static VALUE str_scrub_bang (int argc, VALUE *argv, VALUE str)
 
static int sym_printable (const char *s, const char *send, rb_encoding *enc)
 
int rb_str_symname_p (VALUE sym)
 
VALUE rb_str_quote_unprintable (VALUE str)
 
VALUE rb_id_quote_unprintable (ID id)
 
static VALUE sym_inspect (VALUE sym)
 
VALUE rb_sym_to_s (VALUE sym)
 
static VALUE sym_to_sym (VALUE sym)
 
VALUE rb_sym_proc_call (ID mid, int argc, const VALUE *argv, VALUE passed_proc)
 
static VALUE sym_succ (VALUE sym)
 
static VALUE sym_cmp (VALUE sym, VALUE other)
 
static VALUE sym_casecmp (VALUE sym, VALUE other)
 
static VALUE sym_casecmp_p (VALUE sym, VALUE other)
 
static VALUE sym_match (VALUE sym, VALUE other)
 
static VALUE sym_match_m (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_match_m_p (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_aref (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_length (VALUE sym)
 
static VALUE sym_empty (VALUE sym)
 
static VALUE sym_upcase (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_downcase (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_capitalize (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_swapcase (int argc, VALUE *argv, VALUE sym)
 
static VALUE sym_encoding (VALUE sym)
 
static VALUE string_for_symbol (VALUE name)
 
ID rb_to_id (VALUE name)
 
VALUE rb_to_symbol (VALUE name)
 
void Init_String (void)
 

Variables

VALUE rb_cString
 
VALUE rb_cSymbol
 
static VALUE sym_ascii
 
static VALUE sym_turkic
 
static VALUE sym_lithuanian
 
static VALUE sym_fold
 
const struct st_hash_type rb_fstring_hash_type
 
VALUE rb_fs
 
static const char isspacetable [256]
 

Macro Definition Documentation

◆ ascii_isspace

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

Definition at line 7187 of file string.c.

Referenced by lstrip_offset(), rb_str_split_m(), and rstrip_offset().

◆ BARE_STRING_P

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

Definition at line 258 of file string.c.

Referenced by fstr_update_callback(), and rb_fstring().

◆ BEG

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

Definition at line 22 of file string.c.

Referenced by rb_str_split_m(), rb_str_sub_bang(), rb_str_subpat_set(), scan_once(), and str_gsub().

◆ CASE_MAPPING_ADDITIONAL_LENGTH

#define CASE_MAPPING_ADDITIONAL_LENGTH   20

Definition at line 5969 of file string.c.

Referenced by rb_str_casemap().

◆ CASEMAP_DEBUG

#define CASEMAP_DEBUG   0

Definition at line 5971 of file string.c.

Referenced by rb_str_ascii_casemap(), and rb_str_casemap().

◆ CHAR_ESC_LEN

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

Definition at line 5552 of file string.c.

Referenced by rb_str_buf_cat_escaped_char(), rb_str_escape(), and rb_str_inspect().

◆ CHECK_IF_ASCII

#define CHECK_IF_ASCII (   c)
Value:
(void)((cr == ENC_CODERANGE_7BIT && !rb_isascii(c)) ? \
(cr = ENC_CODERANGE_VALID) : 0)
#define ENC_CODERANGE_7BIT
Definition: encoding.h:100
#define ENC_CODERANGE_VALID
Definition: encoding.h:101
static int rb_isascii(int c)
Definition: ruby.h:2104

Referenced by tr_trans().

◆ 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)

Referenced by enc_str_scrub().

◆ END

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

Definition at line 23 of file string.c.

Referenced by rb_str_split_m(), rb_str_sub_bang(), rb_str_subpat_set(), scan_once(), and str_gsub().

◆ HAVE_CRYPT_R

#define HAVE_CRYPT_R   1

Definition at line 38 of file string.c.

◆ IS_EVSTR

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

Definition at line 5758 of file string.c.

Referenced by rb_str_dump().

◆ lesser

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

Definition at line 3022 of file string.c.

Referenced by rb_str_cmp().

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

Referenced by Init_String(), and rb_str_match_m().

◆ 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 3283 of file string.c.

Referenced by rb_str_aref(), rb_str_aset(), rb_str_include(), rb_str_index_m(), and rb_str_partition().

◆ rb_str_splice

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

Definition at line 4440 of file string.c.

Referenced by rb_str_aset(), rb_str_aset_m(), and rb_str_insert().

◆ RESIZE_CAPA

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

Definition at line 128 of file string.c.

Referenced by rb_str_splice_0(), rb_str_sub_bang(), and str_succ().

◆ 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)); \
REALLOC_N(RSTRING(str)->as.heap.ptr, char, (size_t)(capacity) + (termlen));\
RSTRING(str)->as.heap.aux.capa = (capacity);\
}\
} while (0)
#define RSTRING(obj)
Definition: ruby.h:1208
#define STR_EMBEDDABLE_P(len, termlen)
Definition: string.c:174
#define FL_TEST(x, f)
Definition: ruby.h:1284
#define ALLOC_N(type, n)
Definition: ruby.h:1587
#define RSTRING_LEN(str)
Definition: ruby.h:978
#define RSTRING_PTR(str)
Definition: ruby.h:982
#define STR_SHARED
Definition: internal.h:1487
#define STR_EMBED_P(str)
Definition: internal.h:1488

Definition at line 132 of file string.c.

Referenced by rb_str_modify_expand(), and str_buf_cat().

◆ RUBY_MAX_CHAR_LEN

#define RUBY_MAX_CHAR_LEN   16

Definition at line 82 of file string.c.

Referenced by rb_str_to_s().

◆ SHARABLE_MIDDLE_SUBSTRING

#define SHARABLE_MIDDLE_SUBSTRING   0

Definition at line 166 of file string.c.

◆ SHARABLE_SUBSTRING_P

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

Definition at line 169 of file string.c.

Referenced by rb_str_subseq(), str_byte_substr(), and str_substr().

◆ str_buf_cat2

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

Definition at line 2661 of file string.c.

Referenced by rb_str_inspect().

◆ STR_BUF_MIN_SIZE

#define STR_BUF_MIN_SIZE   127

Definition at line 1244 of file string.c.

Referenced by rb_str_buf_new(), and rb_str_init().

◆ 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)
#define RSTRING_LEN(str)
Definition: ruby.h:978
#define STR_EMBED_P(str)
Definition: internal.h:1488

Definition at line 108 of file string.c.

◆ STR_EMBEDDABLE_P

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

◆ STR_ENC_GET

#define STR_ENC_GET (   str)    get_encoding(str)

◆ STR_FAKESTR

#define STR_FAKESTR   FL_USER19

Definition at line 86 of file string.c.

Referenced by fstr_update_callback(), register_fstring(), and setup_fake_str().

◆ STR_HEAP_PTR

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

Definition at line 160 of file string.c.

Referenced by rb_str_free(), rb_str_resize(), str_discard(), and tr_trans().

◆ STR_HEAP_SIZE

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

Definition at line 161 of file string.c.

Referenced by rb_str_free(), rb_str_init(), rb_str_memsize(), str_discard(), and tr_trans().

◆ STR_IS_SHARED_M

#define STR_IS_SHARED_M   FL_USER6

Definition at line 83 of file string.c.

Referenced by rb_str_tmp_frozen_release(), and str_new_frozen().

◆ STR_NOFREE

#define STR_NOFREE   FL_USER18

◆ STR_SET_EMBED

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

◆ STR_SET_EMBED_LEN

#define STR_SET_EMBED_LEN (   str,
 
)
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 93 of file string.c.

Referenced by rb_str_clear(), rb_str_drop_bytes(), rb_str_resize(), str_make_independent_expand(), str_new_frozen(), str_replace_shared_without_enc(), and str_shared_replace().

◆ STR_SET_LEN

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

Definition at line 99 of file string.c.

Referenced by rb_str_cat_conv_enc_opts(), rb_str_chomp_string(), rb_str_chop_bang(), rb_str_delete_bang(), rb_str_justify(), rb_str_lstrip_bang(), rb_str_reverse(), rb_str_rstrip_bang(), rb_str_set_len(), rb_str_splice_0(), rb_str_squeeze_bang(), rb_str_strip_bang(), rb_str_sub_bang(), rb_str_times(), str_buf_cat(), str_new0(), and str_succ().

◆ STR_SET_NOEMBED

#define STR_SET_NOEMBED (   str)
Value:
do {\
FL_SET((str), STR_NOEMBED);\
STR_SET_EMBED_LEN((str), 0);\
} while (0)
#define STR_NOEMBED
Definition: internal.h:1486

Definition at line 88 of file string.c.

Referenced by str_make_independent_expand(), str_new0(), str_new_frozen(), str_new_static(), str_replace(), str_shared_replace(), and tr_trans().

◆ 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); \
if (RBASIC_CLASS((shared_str)) == 0) /* for CoW-friendliness */ \
FL_SET_RAW((shared_str), STR_IS_SHARED_M); \
} \
} while (0)
#define RSTRING(obj)
Definition: ruby.h:1208
#define STR_IS_SHARED_M
Definition: string.c:83
#define FL_TEST(x, f)
Definition: ruby.h:1284
#define STR_FAKESTR
Definition: string.c:86
#define RBASIC_CLASS(obj)
Definition: ruby.h:878
#define STR_SHARED
Definition: internal.h:1487

Definition at line 151 of file string.c.

Referenced by str_new_frozen(), str_replace(), str_replace_shared_without_enc(), and str_shared_replace().

◆ STR_TMPLOCK

#define STR_TMPLOCK   FL_USER7

◆ STRING_ENUMERATORS_WANTARRAY

#define STRING_ENUMERATORS_WANTARRAY   0 /* next major */

Definition at line 41 of file string.c.

◆ sym_equal

#define sym_equal   rb_obj_equal

Definition at line 9581 of file string.c.

Referenced by Init_String().

◆ 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)
#define UNLIKELY(x)
Definition: ffi_common.h:126

Definition at line 120 of file string.c.

Referenced by rb_str_change_terminator_length(), rb_str_chomp_string(), rb_str_chop_bang(), rb_str_delete_bang(), rb_str_init(), rb_str_justify(), rb_str_lstrip_bang(), rb_str_plus(), rb_str_resize(), rb_str_rstrip_bang(), rb_str_set_len(), rb_str_splice_0(), rb_str_squeeze_bang(), rb_str_strip_bang(), rb_str_sub_bang(), rb_str_times(), str_buf_cat(), str_fill_term(), str_make_independent_expand(), str_new0(), str_new_frozen(), str_replace_shared_without_enc(), str_succ(), and tr_trans().

◆ TERM_LEN

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

◆ TR_TABLE_SIZE

#define TR_TABLE_SIZE   257

Definition at line 6736 of file string.c.

Referenced by rb_str_count(), rb_str_delete_bang(), and rb_str_squeeze_bang().

Typedef Documentation

◆ mapping_buffer

◆ USTR

typedef unsigned char* USTR

Definition at line 6368 of file string.c.

Enumeration Type Documentation

◆ neighbor_char

Enumerator
NEIGHBOR_NOT_CHAR 
NEIGHBOR_FOUND 
NEIGHBOR_WRAPPED 

Definition at line 3678 of file string.c.

Function Documentation

◆ all_digits_p()

static int all_digits_p ( const char *  s,
long  len 
)
static

Definition at line 4004 of file string.c.

References ISDIGIT, and str_upto_each().

Referenced by rb_str_include_range_p(), and str_upto_each().

◆ check_case_options()

static OnigCaseFoldType check_case_options ( int  argc,
VALUE argv,
OnigCaseFoldType  flags 
)
static

◆ chomp_newline()

static const char* chomp_newline ( const char *  p,
const char *  e,
rb_encoding enc 
)
static

Definition at line 7460 of file string.c.

References NULL, rb_enc_ascget(), rb_enc_is_newline, and rb_enc_prev_char.

Referenced by rb_str_enumerate_lines().

◆ chomp_rs()

static VALUE chomp_rs ( int  argc,
const VALUE argv 
)
static

Definition at line 8122 of file string.c.

References NIL_P, rb_check_arity, rb_rs, and StringValue.

Referenced by rb_str_chomp(), and rb_str_chomp_bang().

◆ chompped_length()

static long chompped_length ( VALUE  str,
VALUE  rs 
)
static

◆ chopped_length()

static long chopped_length ( VALUE  str)
static

Definition at line 7954 of file string.c.

References rb_enc_ascget(), rb_enc_prev_char, RSTRING_LEN, RSTRING_PTR, and STR_ENC_GET.

Referenced by rb_str_chop(), and rb_str_chop_bang().

◆ coderange_scan()

static int coderange_scan ( const char *  p,
long  len,
rb_encoding enc 
)
static

◆ empty_str_alloc()

static VALUE empty_str_alloc ( VALUE  klass)
inlinestatic

Definition at line 695 of file string.c.

References RUBY_DTRACE_CREATE_HOOK, str_alloc(), and STRING.

Referenced by Init_String().

◆ enc_pred_char()

static enum neighbor_char enc_pred_char ( char *  p,
long  len,
rb_encoding enc 
)
static

◆ enc_str_scrub()

static VALUE enc_str_scrub ( rb_encoding enc,
VALUE  str,
VALUE  repl,
int  cr 
)
static

◆ enc_strlen()

static long enc_strlen ( const char *  p,
const char *  e,
rb_encoding enc,
int  cr 
)
inlinestatic

◆ enc_succ_alnum_char()

static enum neighbor_char enc_succ_alnum_char ( char *  p,
long  len,
rb_encoding enc,
char *  carry 
)
static

◆ enc_succ_char()

static enum neighbor_char enc_succ_char ( char *  p,
long  len,
rb_encoding enc 
)
static

◆ fstr_update_callback()

static int fstr_update_callback ( st_data_t key,
st_data_t value,
st_data_t  arg,
int  existing 
)
static

◆ fstring_cmp()

static int fstring_cmp ( VALUE  a,
VALUE  b 
)
static

Definition at line 406 of file string.c.

References ENCODING_GET, memcmp(), and RSTRING_GETMEM.

Referenced by mustnot_wchar().

◆ fstring_set_class_i()

static int fstring_set_class_i ( st_data_t  key,
st_data_t  val,
st_data_t  arg 
)
static

Definition at line 399 of file string.c.

References RBASIC_SET_CLASS, and ST_CONTINUE.

Referenced by Init_String().

◆ get_actual_encoding()

static rb_encoding* get_actual_encoding ( const int  encidx,
VALUE  str 
)
static

◆ get_encoding()

static rb_encoding* get_encoding ( VALUE  str)
static

Definition at line 227 of file string.c.

References ENCODING_GET, and get_actual_encoding().

◆ get_pat()

static VALUE get_pat ( VALUE  pat)
static

◆ get_pat_quoted()

static VALUE get_pat_quoted ( VALUE  pat,
int  check 
)
static

◆ include_range_i()

static int include_range_i ( VALUE  str,
VALUE  arg 
)
static

Definition at line 4147 of file string.c.

References Qnil, and rb_equal().

Referenced by rb_str_include_range_p().

◆ Init_String()

void Init_String ( void  )

Definition at line 10012 of file string.c.

References assert, CLASS_OF, empty_str_alloc(), fstring_set_class_i(), ID2SYM, Qnil, rb_cObject, rb_cString, rb_cSymbol, rb_define_alloc_func(), rb_define_class(), rb_define_hooked_variable(), rb_define_method(), rb_define_singleton_method(), rb_fs, rb_fs_setter(), rb_include_module(), rb_intern, rb_mComparable, rb_obj_encoding(), rb_str_aref_m(), rb_str_aset_m(), rb_str_b(), rb_str_bytes(), rb_str_bytesize(), rb_str_byteslice(), rb_str_capitalize(), rb_str_capitalize_bang(), rb_str_casecmp(), rb_str_casecmp_p(), rb_str_center(), rb_str_chars(), rb_str_chomp(), rb_str_chomp_bang(), rb_str_chop(), rb_str_chop_bang(), rb_str_chr(), rb_str_clear(), rb_str_cmp_m(), rb_str_codepoints(), rb_str_concat(), rb_str_concat_multi(), rb_str_count(), rb_str_crypt(), rb_str_delete(), rb_str_downcase(), rb_str_downcase_bang(), rb_str_dump(), rb_str_each_byte(), rb_str_each_char(), rb_str_each_codepoint(), rb_str_each_line(), rb_str_empty(), rb_str_end_with(), rb_str_eql(), rb_str_equal(), rb_str_force_encoding(), rb_str_format_m(), rb_str_freeze(), rb_str_getbyte(), rb_str_gsub(), rb_str_gsub_bang(), rb_str_hash_m(), rb_str_hex(), rb_str_include(), rb_str_index_m(), rb_str_init(), rb_str_insert(), rb_str_inspect(), rb_str_intern(), rb_str_is_ascii_only_p(), rb_str_length(), rb_str_lines(), rb_str_ljust(), rb_str_lstrip(), rb_str_lstrip_bang(), rb_str_match(), rb_str_match_m(), rb_str_match_m_p(), rb_str_oct(), rb_str_ord(), rb_str_partition(), rb_str_plus(), rb_str_prepend_multi(), rb_str_replace(), rb_str_reverse(), rb_str_reverse_bang(), rb_str_rindex_m(), rb_str_rjust(), rb_str_rpartition(), rb_str_rstrip(), rb_str_rstrip_bang(), rb_str_s_try_convert(), rb_str_scan(), rb_str_setbyte(), rb_str_slice_bang(), rb_str_split_m(), rb_str_squeeze(), rb_str_squeeze_bang(), rb_str_start_with(), rb_str_strip(), rb_str_strip_bang(), rb_str_sub(), rb_str_sub_bang(), rb_str_succ(), rb_str_succ_bang(), rb_str_sum(), rb_str_swapcase(), rb_str_swapcase_bang(), rb_str_times(), rb_str_to_f(), rb_str_to_i(), rb_str_to_s(), rb_str_tr(), rb_str_tr_bang(), rb_str_tr_s(), rb_str_tr_s_bang(), rb_str_upcase(), rb_str_upcase_bang(), rb_str_upto(), rb_str_valid_encoding_p(), rb_sym_all_symbols(), rb_sym_to_proc(), rb_sym_to_s(), rb_undef_alloc_func(), rb_undef_method(), rb_vm_fstring_table(), st_foreach, str_scrub(), str_scrub_bang(), str_uminus(), str_uplus(), sym_aref(), sym_ascii, sym_capitalize(), sym_casecmp(), sym_casecmp_p(), sym_cmp(), sym_downcase(), sym_empty(), sym_encoding(), sym_equal, sym_fold, sym_inspect(), sym_length(), sym_lithuanian, sym_match(), sym_match_m(), sym_match_m_p(), sym_succ(), sym_swapcase(), sym_to_sym(), sym_turkic, and sym_upcase().

◆ lstrip_offset()

static long lstrip_offset ( VALUE  str,
const char *  s,
const char *  e,
rb_encoding enc 
)
static

◆ must_not_null()

static void must_not_null ( const char *  ptr)
inlinestatic

Definition at line 680 of file string.c.

References rb_eArgError, and rb_raise().

Referenced by rb_enc_str_new_cstr(), rb_str_cat_cstr(), and rb_str_new_cstr().

◆ mustnot_broken()

static void mustnot_broken ( VALUE  str)
static

Definition at line 233 of file string.c.

References is_broken_string, rb_eArgError, rb_enc_name, rb_raise(), and STR_ENC_GET.

Referenced by rb_str_scan(), and rb_str_split_m().

◆ mustnot_wchar()

static void mustnot_wchar ( VALUE  str)
static

◆ rb_check_lockedtmp()

static void rb_check_lockedtmp ( VALUE  str)
inlinestatic

◆ rb_check_string_type()

VALUE rb_check_string_type ( VALUE  str)

◆ rb_enc_cr_str_copy_for_substr()

static void rb_enc_cr_str_copy_for_substr ( VALUE  dest,
VALUE  src 
)
static

◆ rb_enc_cr_str_exact_copy()

static void rb_enc_cr_str_exact_copy ( VALUE  dest,
VALUE  src 
)
static

Definition at line 613 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, and str_enc_copy().

Referenced by rb_str_init(), str_new_frozen(), str_replace(), and str_replace_shared().

◆ rb_enc_nth()

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

Definition at line 2238 of file string.c.

References str_nth_len().

Referenced by rb_str_ellipsize(), and rb_str_format().

◆ 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 
)

◆ 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 793 of file string.c.

References must_not_null(), rb_eArgError, rb_enc_mbminlen, rb_enc_str_new(), rb_raise(), and strlen().

Referenced by join_path(), and syserr_initialize().

◆ rb_enc_str_new_static()

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

Definition at line 847 of file string.c.

References rb_cString, rb_enc_to_index(), and str_new_static().

◆ rb_enc_str_scrub()

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

Definition at line 9239 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_UNKNOWN, enc_str_scrub(), and STR_ENC_GET.

Referenced by str_transcode0().

◆ rb_enc_strlen()

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

Definition at line 1646 of file string.c.

References ENC_CODERANGE_UNKNOWN, and enc_strlen().

Referenced by rb_str_format(), and update_char_offset().

◆ rb_enc_strlen_cr()

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

◆ rb_external_str_new()

VALUE rb_external_str_new ( const char *  ptr,
long  len 
)

◆ 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 1044 of file string.c.

References rb_external_str_new_with_enc(), and rb_filesystem_encoding().

Referenced by etc_systmpdir().

◆ rb_filesystem_str_new_cstr()

VALUE rb_filesystem_str_new_cstr ( const char *  ptr)

◆ rb_fs_check()

static VALUE rb_fs_check ( VALUE  val)
static

Definition at line 7159 of file string.c.

References NIL_P, rb_check_string_type(), RB_TYPE_P, T_REGEXP, T_STRING, and val.

Referenced by rb_fs_setter(), and rb_str_split_m().

◆ rb_fs_setter()

static void rb_fs_setter ( VALUE  val,
ID  id,
VALUE var 
)
static

Definition at line 9072 of file string.c.

References PRIsVALUE, rb_eTypeError, rb_fs_check(), rb_id2str, rb_raise(), and val.

Referenced by Init_String().

◆ rb_fstring()

RUBY_FUNC_EXPORTED VALUE rb_fstring ( VALUE  str)

◆ rb_fstring_cstr()

VALUE rb_fstring_cstr ( const char *  ptr)

◆ rb_fstring_enc_cstr()

VALUE rb_fstring_enc_cstr ( const char *  ptr,
rb_encoding enc 
)

Definition at line 393 of file string.c.

References rb_fstring_enc_new(), and strlen().

◆ rb_fstring_enc_new()

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

Definition at line 380 of file string.c.

References rb_setup_fake_str(), and register_fstring().

Referenced by rb_fstring_enc_cstr().

◆ rb_fstring_new()

VALUE rb_fstring_new ( const char *  ptr,
long  len 
)

◆ rb_id_quote_unprintable()

VALUE rb_id_quote_unprintable ( ID  id)

Definition at line 9640 of file string.c.

References rb_id2str, and rb_str_quote_unprintable().

◆ rb_locale_str_new()

VALUE rb_locale_str_new ( const char *  ptr,
long  len 
)

◆ rb_locale_str_new_cstr()

VALUE rb_locale_str_new_cstr ( const char *  ptr)

◆ rb_must_asciicompat()

void rb_must_asciicompat ( VALUE  str)

◆ rb_obj_as_string()

VALUE rb_obj_as_string ( VALUE  obj)

◆ rb_pat_search()

static long rb_pat_search ( VALUE  pat,
VALUE  str,
long  pos,
int  set_backref_str 
)
static

◆ 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 
)

◆ rb_str_aref()

static VALUE rb_str_aref ( VALUE  str,
VALUE  indx 
)
static

◆ rb_str_aref_m()

static VALUE rb_str_aref_m ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_ascii_casemap()

static void rb_str_ascii_casemap ( VALUE  source,
OnigCaseFoldType flags,
rb_encoding enc 
)
static

◆ rb_str_aset()

static VALUE rb_str_aset ( VALUE  str,
VALUE  indx,
VALUE  val 
)
static

◆ rb_str_aset_m()

static VALUE rb_str_aset_m ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_b()

static VALUE rb_str_b ( VALUE  str)
static

◆ rb_str_buf_append()

VALUE rb_str_buf_append ( VALUE  str,
VALUE  str2 
)

◆ 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 5555 of file string.c.

References buf, CHAR_ESC_LEN, ISPRINT, rb_str_buf_cat(), snprintf, and strlen().

Referenced by rb_reg_expr_str(), rb_str_escape(), and rb_str_inspect().

◆ rb_str_buf_new()

VALUE rb_str_buf_new ( long  capa)

◆ rb_str_buf_new_cstr()

VALUE rb_str_buf_new_cstr ( const char *  ptr)

Definition at line 1263 of file string.c.

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

Referenced by rb_load_fail().

◆ rb_str_bytes()

static VALUE rb_str_bytes ( VALUE  str)
static

Definition at line 7749 of file string.c.

References rb_str_enumerate_bytes().

Referenced by Init_String().

◆ rb_str_bytesize()

static VALUE rb_str_bytesize ( VALUE  str)
static

Definition at line 1765 of file string.c.

References LONG2NUM, and RSTRING_LEN.

Referenced by Init_String().

◆ rb_str_byteslice()

static VALUE rb_str_byteslice ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 5329 of file string.c.

References NUM2LONG, rb_check_arity, str_byte_aref(), str_byte_substr(), and TRUE.

Referenced by Init_String().

◆ rb_str_capacity()

size_t rb_str_capacity ( VALUE  str)

◆ rb_str_capitalize()

static VALUE rb_str_capitalize ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 6307 of file string.c.

References rb_str_capitalize_bang(), and rb_str_dup().

Referenced by Init_String(), and sym_capitalize().

◆ rb_str_capitalize_bang()

static VALUE rb_str_capitalize_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_casecmp()

static VALUE rb_str_casecmp ( VALUE  str1,
VALUE  str2 
)
static

◆ rb_str_casecmp_p()

static VALUE rb_str_casecmp_p ( VALUE  str1,
VALUE  str2 
)
static

Definition at line 3265 of file string.c.

References Qnil, rb_enc_compatible(), rb_str_downcase(), rb_str_eql(), StringValue, and sym_fold.

Referenced by Init_String(), and sym_casecmp_p().

◆ rb_str_casemap()

static VALUE rb_str_casemap ( VALUE  source,
OnigCaseFoldType flags,
rb_encoding enc 
)
static

◆ 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 
)

◆ rb_str_cat_cstr()

VALUE rb_str_cat_cstr ( VALUE  str,
const char *  ptr 
)

◆ rb_str_center()

static VALUE rb_str_center ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 8900 of file string.c.

References rb_str_justify().

Referenced by Init_String().

◆ rb_str_change_terminator_length()

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

◆ rb_str_chars()

static VALUE rb_str_chars ( VALUE  str)
static

Definition at line 7853 of file string.c.

References rb_str_enumerate_chars().

Referenced by Init_String().

◆ rb_str_check_dummy_enc()

static void rb_str_check_dummy_enc ( rb_encoding enc)
static

◆ rb_str_chomp()

static VALUE rb_str_chomp ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 8192 of file string.c.

References chomp_rs(), chompped_length(), NIL_P, rb_str_dup(), and rb_str_subseq().

Referenced by Init_String().

◆ rb_str_chomp_bang()

static VALUE rb_str_chomp_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 8158 of file string.c.

References chomp_rs(), NIL_P, Qnil, rb_str_chomp_string(), RSTRING_LEN, and str_modify_keep_cr().

Referenced by Init_String().

◆ rb_str_chomp_string()

VALUE rb_str_chomp_string ( VALUE  str,
VALUE  rs 
)

◆ rb_str_chop()

static VALUE rb_str_chop ( VALUE  str)
static

Definition at line 8016 of file string.c.

References chopped_length(), and rb_str_subseq().

Referenced by Init_String().

◆ rb_str_chop_bang()

static VALUE rb_str_chop_bang ( VALUE  str)
static

◆ rb_str_chr()

static VALUE rb_str_chr ( VALUE  str)
static

Definition at line 5142 of file string.c.

References rb_str_substr().

Referenced by Init_String().

◆ rb_str_clear()

static VALUE rb_str_clear ( VALUE  str)
static

◆ rb_str_cmp()

int rb_str_cmp ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_cmp_m()

static VALUE rb_str_cmp_m ( VALUE  str1,
VALUE  str2 
)
static

Definition at line 3159 of file string.c.

References INT2FIX, rb_check_funcall(), rb_invcmp(), rb_str_cmp(), RB_TYPE_P, result, and T_STRING.

Referenced by Init_String(), and sym_cmp().

◆ rb_str_codepoints()

static VALUE rb_str_codepoints ( VALUE  str)
static

Definition at line 7947 of file string.c.

References rb_str_enumerate_codepoints().

Referenced by Init_String().

◆ 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()

VALUE rb_str_concat_literals ( size_t  num,
const VALUE strary 
)

◆ rb_str_concat_multi()

static VALUE rb_str_concat_multi ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 2872 of file string.c.

References argc, rb_enc_copy(), rb_str_buf_append(), rb_str_concat(), rb_str_tmp_new(), and str_modifiable().

Referenced by Init_String().

◆ 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_count()

static VALUE rb_str_count ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_crypt()

static VALUE rb_str_crypt ( VALUE  str,
VALUE  salt 
)
static

◆ rb_str_delete()

static VALUE rb_str_delete ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 6908 of file string.c.

References rb_str_delete_bang(), and rb_str_dup().

Referenced by Init_String().

◆ rb_str_delete_bang()

static VALUE rb_str_delete_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_downcase()

static VALUE rb_str_downcase ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 6246 of file string.c.

References rb_str_downcase_bang(), and rb_str_dup().

Referenced by Init_String(), rb_str_casecmp_p(), and sym_downcase().

◆ rb_str_downcase_bang()

static VALUE rb_str_downcase_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_drop_bytes()

VALUE rb_str_drop_bytes ( VALUE  str,
long  len 
)

◆ rb_str_dump()

VALUE rb_str_dump ( VALUE  str)

◆ rb_str_dup()

VALUE rb_str_dup ( VALUE  str)

◆ rb_str_each_byte()

static VALUE rb_str_each_byte ( VALUE  str)
static

Definition at line 7732 of file string.c.

References rb_str_enumerate_bytes().

Referenced by Init_String().

◆ rb_str_each_byte_size()

static VALUE rb_str_each_byte_size ( VALUE  str,
VALUE  args,
VALUE  eobj 
)
static

Definition at line 7675 of file string.c.

References LONG2FIX, and RSTRING_LEN.

Referenced by rb_str_enumerate_bytes().

◆ rb_str_each_char()

static VALUE rb_str_each_char ( VALUE  str)
static

Definition at line 7836 of file string.c.

References rb_str_enumerate_chars().

Referenced by Init_String().

◆ rb_str_each_char_size()

static VALUE rb_str_each_char_size ( VALUE  str,
VALUE  args,
VALUE  eobj 
)
static

Definition at line 7755 of file string.c.

References rb_str_length().

Referenced by rb_str_enumerate_chars(), and rb_str_enumerate_codepoints().

◆ rb_str_each_codepoint()

static VALUE rb_str_each_codepoint ( VALUE  str)
static

Definition at line 7929 of file string.c.

References rb_str_enumerate_codepoints().

Referenced by Init_String().

◆ rb_str_each_line()

static VALUE rb_str_each_line ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 7651 of file string.c.

References rb_str_enumerate_lines().

Referenced by Init_String().

◆ 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 9169 of file string.c.

References 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_raise(), rb_str_append(), rb_str_cat(), rb_str_encode(), rb_str_new_with_class(), rb_str_subseq(), rb_usascii_str_new(), RSTRING_LEN, and RSTRING_PTR.

Referenced by intern_str(), rb_hash_fetch_m(), and syserr_fail2_in().

◆ rb_str_empty()

static VALUE rb_str_empty ( VALUE  str)
static

Definition at line 1782 of file string.c.

References Qfalse, Qtrue, and RSTRING_LEN.

Referenced by Init_String(), and sym_empty().

◆ rb_str_end_with()

static VALUE rb_str_end_with ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 9040 of file string.c.

References argc, memcmp(), Qfalse, Qtrue, rb_enc_check(), rb_enc_left_char_head, RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_String().

◆ rb_str_enumerate_bytes()

static VALUE rb_str_enumerate_bytes ( VALUE  str,
int  wantarray 
)
static

◆ rb_str_enumerate_chars()

static VALUE rb_str_enumerate_chars ( VALUE  str,
int  wantarray 
)
static

◆ rb_str_enumerate_codepoints()

static VALUE rb_str_enumerate_codepoints ( VALUE  str,
int  wantarray 
)
static

◆ rb_str_enumerate_lines()

static VALUE rb_str_enumerate_lines ( int  argc,
VALUE argv,
VALUE  str,
int  wantarray 
)
static

◆ rb_str_eql()

static VALUE rb_str_eql ( VALUE  str1,
VALUE  str2 
)
static

Definition at line 3125 of file string.c.

References Qfalse, Qtrue, RB_TYPE_P, str_eql(), and T_STRING.

Referenced by Init_String(), and rb_str_casecmp_p().

◆ rb_str_equal()

VALUE rb_str_equal ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_escape()

VALUE rb_str_escape ( VALUE  str)

◆ rb_str_export()

VALUE rb_str_export ( VALUE  str)

Definition at line 1056 of file string.c.

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

◆ rb_str_export_locale()

VALUE rb_str_export_locale ( VALUE  str)

Definition at line 1062 of file string.c.

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

◆ rb_str_export_to_enc()

VALUE rb_str_export_to_enc ( VALUE  str,
rb_encoding enc 
)

Definition at line 1068 of file string.c.

References rb_str_conv_enc(), and STR_ENC_GET.

Referenced by alias(), scalar(), start_document(), start_mapping(), start_sequence(), and transcode_string().

◆ rb_str_fill_terminator()

char* rb_str_fill_terminator ( VALUE  str,
const int  newminlen 
)

Definition at line 2156 of file string.c.

References len, RSTRING_LEN, RSTRING_PTR, and str_fill_term().

Referenced by get_env_cstr().

◆ rb_str_force_encoding()

static VALUE rb_str_force_encoding ( VALUE  str,
VALUE  enc 
)
static

Definition at line 9092 of file string.c.

References ENC_CODERANGE_CLEAR, rb_enc_associate(), rb_to_encoding(), and str_modifiable().

Referenced by Init_String().

◆ rb_str_format_m()

static VALUE rb_str_format_m ( VALUE  str,
VALUE  arg 
)
static

Definition at line 1903 of file string.c.

References NIL_P, RARRAY_CONST_PTR, RARRAY_LENINT, rb_check_array_type(), RB_GC_GUARD, and rb_str_format().

Referenced by Init_String().

◆ rb_str_free()

void rb_str_free ( VALUE  str)

◆ rb_str_freeze()

VALUE rb_str_freeze ( VALUE  str)

◆ rb_str_getbyte()

static VALUE rb_str_getbyte ( VALUE  str,
VALUE  index 
)
static

Definition at line 5154 of file string.c.

References INT2FIX, NUM2LONG, Qnil, RSTRING_LEN, and RSTRING_PTR.

Referenced by Init_String().

◆ rb_str_gsub()

static VALUE rb_str_gsub ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 5079 of file string.c.

References str_gsub().

Referenced by Init_String().

◆ rb_str_gsub_bang()

static VALUE rb_str_gsub_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 5028 of file string.c.

References str_gsub(), and str_modify_keep_cr().

Referenced by Init_String().

◆ 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 2995 of file string.c.

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

Referenced by cdhash_cmp(), and rb_any_cmp().

◆ rb_str_hash_m()

static VALUE rb_str_hash_m ( VALUE  str)
static

Definition at line 3016 of file string.c.

References hval, rb_str_hash(), and ST2FIX.

Referenced by Init_String().

◆ rb_str_hex()

static VALUE rb_str_hex ( VALUE  str)
static

Definition at line 8565 of file string.c.

References FALSE, and rb_str_to_inum().

Referenced by Init_String().

◆ rb_str_include()

static VALUE rb_str_include ( VALUE  str,
VALUE  arg 
)
static

Definition at line 5448 of file string.c.

References Qfalse, Qtrue, rb_str_index, and StringValue.

Referenced by Init_String().

◆ rb_str_include_range_p()

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

◆ rb_str_index_m()

static VALUE rb_str_index_m ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_init()

static VALUE rb_str_init ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_insert()

static VALUE rb_str_insert ( VALUE  str,
VALUE  idx,
VALUE  str2 
)
static

Definition at line 4581 of file string.c.

References NUM2LONG, rb_str_append(), and rb_str_splice.

Referenced by Init_String().

◆ rb_str_inspect()

VALUE rb_str_inspect ( VALUE  str)

◆ rb_str_is_ascii_only_p()

static VALUE rb_str_is_ascii_only_p ( VALUE  str)
static

◆ rb_str_justify()

static VALUE rb_str_justify ( int  argc,
VALUE argv,
VALUE  str,
char  jflag 
)
static

◆ rb_str_length()

VALUE rb_str_length ( VALUE  str)

◆ rb_str_lines()

static VALUE rb_str_lines ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 7669 of file string.c.

References rb_str_enumerate_lines().

Referenced by Init_String().

◆ rb_str_ljust()

static VALUE rb_str_ljust ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 8860 of file string.c.

References rb_str_justify().

Referenced by Init_String().

◆ rb_str_locktmp_ensure()

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

◆ rb_str_lstrip()

static VALUE rb_str_lstrip ( VALUE  str)
static

Definition at line 8276 of file string.c.

References len, lstrip_offset(), rb_str_dup(), rb_str_subseq(), RSTRING_GETMEM, and STR_ENC_GET.

Referenced by Init_String().

◆ rb_str_lstrip_bang()

static VALUE rb_str_lstrip_bang ( VALUE  str)
static

◆ rb_str_match()

static VALUE rb_str_match ( VALUE  x,
VALUE  y 
)
static

◆ rb_str_match_m()

static VALUE rb_str_match_m ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 3638 of file string.c.

References get_pat(), NIL_P, rb_block_given_p(), rb_check_arity, rb_funcallv, rb_intern, rb_yield(), and result.

Referenced by Init_String(), and sym_match_m().

◆ rb_str_match_m_p()

static VALUE rb_str_match_m_p ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 3670 of file string.c.

References get_pat(), NUM2LONG, rb_check_arity, and rb_reg_match_p().

Referenced by Init_String(), and sym_match_m_p().

◆ rb_str_memsize()

RUBY_FUNC_EXPORTED size_t rb_str_memsize ( VALUE  str)

Definition at line 1294 of file string.c.

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

Referenced by obj_memsize_of().

◆ rb_str_modify()

void rb_str_modify ( VALUE  str)

◆ rb_str_modify_expand()

void rb_str_modify_expand ( VALUE  str,
long  expand 
)

◆ rb_str_new()

VALUE rb_str_new ( const char *  ptr,
long  len 
)

Definition at line 736 of file string.c.

References rb_cString, and str_new().

Referenced by addrinfo_ipv4_multicast_p(), addrinfo_mdump(), addrinfo_to_sockaddr(), appendline(), argf_getpartial(), asn1str_to_str(), BigDecimal_dump(), BigDecimal_inspect(), BigDecimal_split(), BigDecimal_to_f(), BigDecimal_to_s(), bsock_getpeername(), bsock_getsockname(), bsock_getsockopt(), bubblebabble_str_new(), check_pipe_command(), cState_array_nl(), cState_indent(), cState_object_nl(), cState_space(), cState_space_before(), cState_to_h(), date_strftime_internal(), decode_bstr(), decode_eoc(), dir_s_home(), econv_convert(), econv_description(), econv_finish(), econv_primitive_errinfo(), econv_putback(), etc_systmpdir(), extract_user_token(), fbuffer_append_char(), genrand_bytes(), gzfile_getc(), gzfile_read(), gzfile_read_all(), gzfile_read_header(), gzfile_readpartial(), gzreader_gets(), ibf_dump_setup(), ibf_load_object_string(), infected_str_new(), inspect1(), inspect2(), int_chr(), int_ossl_asn1_decode0_prim(), io_getc(), io_setstrbuf(), io_shift_cbuf(), iseq_ibf_load_extra_data(), join_der(), load_file_internal(), load_transcoder_entry(), make_econv_exception(), match_to_s(), Messaging_HandleMessage(), ossl_asn1cons_to_der(), ossl_asn1data_to_der(), ossl_asn1eoc_initialize(), ossl_bn_to_s(), ossl_cipher_final(), ossl_cipher_is_authenticated(), ossl_cipher_update(), ossl_dh_compute_key(), ossl_dh_to_der(), ossl_digest_finish(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_hmac_digest(), ossl_hmac_hexdigest(), ossl_hmac_s_digest(), ossl_hmac_s_hexdigest(), ossl_make_error(), ossl_membio2str0(), ossl_ocspbres_to_der(), ossl_ocspcid_get_issuer_key_hash(), ossl_ocspcid_get_issuer_name_hash(), ossl_ocspcid_to_der(), ossl_ocspreq_to_der(), ossl_ocspres_to_der(), ossl_ocspsres_to_der(), ossl_pkcs12_to_der(), ossl_pkcs5_pbkdf2_hmac_sha1(), ossl_pkcs7_to_der(), ossl_pkey_sign(), ossl_rand_bytes(), ossl_rsa_private_decrypt(), ossl_rsa_private_encrypt(), ossl_rsa_public_decrypt(), ossl_rsa_public_encrypt(), ossl_rsa_to_der(), ossl_spki_get_challenge(), ossl_spki_to_der(), ossl_ssl_get_client_ca_list(), ossl_ssl_read_internal(), ossl_ssl_session_get_id(), ossl_ssl_session_to_der(), ossl_sslctx_session_get_cb(), ossl_sslctx_set_ciphers(), ossl_str_new(), ossl_x509_to_der(), ossl_x509attr_get_value(), ossl_x509attr_to_der(), ossl_x509ext_to_der(), ossl_x509name_to_der(), ossl_x509req_to_der(), pack_pack(), parse(), proc_options(), push_include(), r_bytes0(), r_bytes1_buffered(), random_raw_seed(), rb_compile_cstr(), rb_digest_base_finish(), rb_enc_str_new(), rb_exc_new(), rb_execarg_commandline(), rb_execarg_parent_start1(), rb_execarg_run_options(), rb_f_backquote(), rb_file_dirname(), rb_file_join(), rb_file_s_basename(), rb_file_s_extname(), rb_gdbm_fetch(), rb_gdbm_firstkey(), rb_gdbm_nextkey(), rb_inflate_inflate(), rb_io_getline_fast(), rb_io_putc(), rb_io_ungetbyte(), rb_iseq_disasm(), rb_iseq_disasm_insn(), rb_nkf_convert(), rb_parser_compile_cstr(), rb_parser_printf(), rb_path_check(), rb_reg_compile(), rb_reg_quote(), rb_str_concat_literals(), rb_str_enumerate_lines(), rb_str_format(), rb_str_new_cstr(), rb_str_slice_bang(), rb_tainted_str_new(), rb_usascii_str_new(), rb_write_error2(), reg_named_captures_iter(), rsock_addrinfo_inspect_sockaddr(), rsock_ipaddr(), ruby_init_loadpath(), ruby_init_loadpath_safe(), s3e(), set_file_encoding(), set_option_encoding_once(), sock_s_gethostbyaddr(), sock_s_pack_sockaddr_in(), sock_s_unpack_sockaddr_in(), sock_sockaddr(), sock_sysaccept(), ssl_renegotiation_cb(), str_new(), strio_gets(), strio_putc(), strio_read(), strio_substr(), time_mdump(), zstream_detach_buffer(), zstream_detach_input(), and zstream_shift_buffer().

◆ rb_str_new_cstr()

VALUE rb_str_new_cstr ( const char *  ptr)

◆ rb_str_new_frozen()

VALUE rb_str_new_frozen ( VALUE  orig)

◆ rb_str_new_shared()

VALUE rb_str_new_shared ( VALUE  str)

Definition at line 1114 of file string.c.

References OBJ_INFECT, rb_obj_class(), and str_new_shared().

Referenced by mustbe_callable(), rb_file_s_basename(), and rb_str_subseq().

◆ rb_str_new_static()

VALUE rb_str_new_static ( const char *  ptr,
long  len 
)

Definition at line 829 of file string.c.

References rb_cString, and str_new_static().

◆ rb_str_new_with_class()

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

◆ rb_str_oct()

static VALUE rb_str_oct ( VALUE  str)
static

Definition at line 8589 of file string.c.

References FALSE, and rb_str_to_inum().

Referenced by Init_String().

◆ rb_str_offset()

long rb_str_offset ( VALUE  str,
long  pos 
)

Definition at line 2266 of file string.c.

References RSTRING_END, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, and str_offset().

Referenced by rb_str_rpartition(), and reg_match_pos().

◆ rb_str_ord()

VALUE rb_str_ord ( VALUE  s)

Definition at line 8673 of file string.c.

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

Referenced by Init_String().

◆ rb_str_partition()

static VALUE rb_str_partition ( VALUE  str,
VALUE  sep 
)
static

◆ rb_str_plus()

VALUE rb_str_plus ( VALUE  str1,
VALUE  str2 
)

◆ rb_str_prepend_multi()

static VALUE rb_str_prepend_multi ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 2967 of file string.c.

References argc, L, rb_enc_copy(), rb_str_append(), rb_str_tmp_new(), rb_str_update(), and str_modifiable().

Referenced by Init_String().

◆ 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 5097 of file string.c.

References str_discard(), str_modifiable(), str_replace(), and StringValue.

Referenced by Init_String(), rb_str_init(), and str_scrub_bang().

◆ rb_str_resize()

VALUE rb_str_resize ( VALUE  str,
long  len 
)

Definition at line 2562 of file string.c.

References RString::as, RString::capa, ENC_CODERANGE_CLEAR, len, MEMCPY, RString::ptr, rb_eArgError, rb_raise(), REALLOC_N, RSTRING, RSTRING_LEN, ruby_xfree(), STR_EMBED_P, STR_EMBEDDABLE_P, STR_HEAP_PTR, str_independent(), str_make_independent_expand(), STR_SET_EMBED, STR_SET_EMBED_LEN, TERM_FILL, and TERM_LEN.

Referenced by append_fspath(), appendline(), argf_getpartial(), argf_read(), big2str_generic(), BigDecimal_dump(), BigDecimal_inspect(), BigDecimal_split(), BigDecimal_to_s(), check_gid_switch(), copy_home_path(), copy_stream_body(), copy_stream_fallback_body(), do_opendir(), econv_primitive_convert(), flo_to_s(), glob_helper(), gzfile_error_inspect(), gzfile_readpartial(), join_path(), JSON_parse_string(), literal_concat0(), moreswitches(), new_regexp_gen(), ossl_cipher_update(), ossl_digest_finish(), ossl_ssl_read_internal(), push_include(), r_object0(), rb_econv_append(), rb_enc_vsprintf(), rb_feature_p(), rb_file_expand_path_internal(), rb_find_file_ext_safe(), rb_find_file_safe(), rb_gzfile_set_comment(), rb_gzfile_set_orig_name(), rb_io_getline_fast(), rb_iseq_disasm(), rb_marshal_dump_limited(), rb_nkf_putchar(), rb_reg_quote(), rb_reg_to_s(), rb_str_concat(), rb_str_format(), rb_str_freeze(), rb_str_vcatf(), rb_strftime_with_timespec(), realpath_rec(), ruby_init_loadpath(), ruby_init_loadpath_safe(), set_file_encoding(), setup_narg(), sock_sysaccept(), str_cat_conv_enc_opts(), str_shrink(), str_transcoding_resize(), strio_extend(), strio_init(), strio_read(), strio_truncate(), sym_inspect(), VpAlloc(), and w_nbyte().

◆ rb_str_resurrect()

VALUE rb_str_resurrect ( VALUE  str)

◆ rb_str_reverse()

static VALUE rb_str_reverse ( VALUE  str)
static

◆ rb_str_reverse_bang()

static VALUE rb_str_reverse_bang ( VALUE  str)
static

◆ rb_str_rindex()

static long rb_str_rindex ( VALUE  str,
VALUE  sub,
long  pos 
)
static

◆ rb_str_rindex_m()

static VALUE rb_str_rindex_m ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_rjust()

static VALUE rb_str_rjust ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 8880 of file string.c.

References rb_str_justify().

Referenced by Init_String().

◆ rb_str_rpartition()

static VALUE rb_str_rpartition ( VALUE  str,
VALUE  sep 
)
static

◆ rb_str_rstrip()

static VALUE rb_str_rstrip ( VALUE  str)
static

Definition at line 8365 of file string.c.

References rb_str_dup(), rb_str_subseq(), RSTRING_GETMEM, rstrip_offset(), and STR_ENC_GET.

Referenced by Init_String().

◆ rb_str_rstrip_bang()

static VALUE rb_str_rstrip_bang ( VALUE  str)
static

◆ rb_str_s_try_convert()

static VALUE rb_str_s_try_convert ( VALUE  dummy,
VALUE  str 
)
static

Definition at line 2182 of file string.c.

References rb_check_string_type().

Referenced by Init_String().

◆ rb_str_scan()

static VALUE rb_str_scan ( VALUE  str,
VALUE  pat 
)
static

◆ 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 9232 of file string.c.

References ENC_CODERANGE, enc_str_scrub(), and STR_ENC_GET.

Referenced by str_scrub(), and str_scrub_bang().

◆ rb_str_set_len()

void rb_str_set_len ( VALUE  str,
long  len 
)

◆ rb_str_setbyte()

static VALUE rb_str_setbyte ( VALUE  str,
VALUE  index,
VALUE  value 
)
static

◆ rb_str_setter()

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

Definition at line 9063 of file string.c.

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

Referenced by Init_IO().

◆ rb_str_shared_replace()

void rb_str_shared_replace ( VALUE  str,
VALUE  str2 
)

Definition at line 1314 of file string.c.

References str_shared_replace().

Referenced by str_encode_bang().

◆ rb_str_slice_bang()

static VALUE rb_str_slice_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 4616 of file string.c.

References argc, buf, NIL_P, rb_check_arity, rb_str_aref_m(), rb_str_aset_m(), rb_str_new(), result, and str_modify_keep_cr().

Referenced by Init_String().

◆ rb_str_splice_0()

static void rb_str_splice_0 ( VALUE  str,
long  beg,
long  len,
VALUE  val 
)
static

◆ rb_str_split()

VALUE rb_str_split ( VALUE  str,
const char *  sep0 
)

Definition at line 7450 of file string.c.

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

Referenced by ossl_sslctx_set_ecdh_curves().

◆ rb_str_split_m()

static VALUE rb_str_split_m ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_squeeze()

static VALUE rb_str_squeeze ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 7016 of file string.c.

References rb_str_dup(), and rb_str_squeeze_bang().

Referenced by Init_String().

◆ rb_str_squeeze_bang()

static VALUE rb_str_squeeze_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_start_with()

static VALUE rb_str_start_with ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 9011 of file string.c.

References argc, memcmp(), Qfalse, Qtrue, rb_enc_check(), RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_String().

◆ rb_str_strip()

static VALUE rb_str_strip ( VALUE  str)
static

Definition at line 8434 of file string.c.

References lstrip_offset(), rb_str_dup(), rb_str_subseq(), RSTRING_GETMEM, rstrip_offset(), and STR_ENC_GET.

Referenced by Init_String().

◆ rb_str_strip_bang()

static VALUE rb_str_strip_bang ( VALUE  str)
static

◆ rb_str_strlen()

long rb_str_strlen ( VALUE  str)

Definition at line 1735 of file string.c.

References NULL, and str_strlen().

Referenced by ibf_dump_pos().

◆ rb_str_sub()

static VALUE rb_str_sub ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 4878 of file string.c.

References rb_str_dup(), and rb_str_sub_bang().

Referenced by Init_String().

◆ rb_str_sub_bang()

static VALUE rb_str_sub_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_sublen()

long rb_str_sublen ( VALUE  str,
long  pos 
)

◆ rb_str_subpat()

static VALUE rb_str_subpat ( VALUE  str,
VALUE  re,
VALUE  backref 
)
static

◆ rb_str_subpat_set()

static void rb_str_subpat_set ( VALUE  str,
VALUE  re,
VALUE  backref,
VALUE  val 
)
static

◆ rb_str_subpos()

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

◆ 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 
)

◆ rb_str_succ()

VALUE rb_str_succ ( VALUE  orig)

◆ rb_str_succ_bang()

static VALUE rb_str_succ_bang ( VALUE  str)
static

Definition at line 3996 of file string.c.

References rb_str_modify(), and str_succ().

Referenced by Init_String().

◆ rb_str_sum()

static VALUE rb_str_sum ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_swapcase()

static VALUE rb_str_swapcase ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 6361 of file string.c.

References rb_str_dup(), and rb_str_swapcase_bang().

Referenced by Init_String(), and sym_swapcase().

◆ rb_str_swapcase_bang()

static VALUE rb_str_swapcase_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_symname_p()

int rb_str_symname_p ( VALUE  sym)

◆ rb_str_times()

VALUE rb_str_times ( VALUE  str,
VALUE  times 
)

◆ rb_str_tmp_frozen_acquire()

VALUE rb_str_tmp_frozen_acquire ( VALUE  orig)

Definition at line 1135 of file string.c.

References OBJ_FROZEN_RAW, OBJ_INFECT, and str_new_frozen().

Referenced by io_fwrite(), and rb_io_syswrite().

◆ 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)

◆ rb_str_to_f()

static VALUE rb_str_to_f ( VALUE  str)
static

Definition at line 5515 of file string.c.

References DBL2NUM, FALSE, and rb_str_to_dbl().

Referenced by Init_String().

◆ rb_str_to_i()

static VALUE rb_str_to_i ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 5482 of file string.c.

References FALSE, NUM2INT, rb_eArgError, rb_raise(), rb_scan_args(), and rb_str_to_inum().

Referenced by Init_String().

◆ rb_str_to_s()

static VALUE rb_str_to_s ( VALUE  str)
static

◆ rb_str_to_str()

VALUE rb_str_to_str ( VALUE  str)

◆ rb_str_tr()

static VALUE rb_str_tr ( VALUE  str,
VALUE  src,
VALUE  repl 
)
static

Definition at line 6729 of file string.c.

References rb_str_dup(), and tr_trans().

Referenced by Init_String().

◆ rb_str_tr_bang()

static VALUE rb_str_tr_bang ( VALUE  str,
VALUE  src,
VALUE  repl 
)
static

Definition at line 6687 of file string.c.

References tr_trans().

Referenced by Init_String().

◆ rb_str_tr_s()

static VALUE rb_str_tr_s ( VALUE  str,
VALUE  src,
VALUE  repl 
)
static

Definition at line 7053 of file string.c.

References rb_str_dup(), and tr_trans().

Referenced by Init_String().

◆ rb_str_tr_s_bang()

static VALUE rb_str_tr_s_bang ( VALUE  str,
VALUE  src,
VALUE  repl 
)
static

Definition at line 7033 of file string.c.

References tr_trans().

Referenced by Init_String().

◆ rb_str_unlocktmp()

VALUE rb_str_unlocktmp ( VALUE  str)

◆ rb_str_upcase()

static VALUE rb_str_upcase ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 6143 of file string.c.

References rb_str_dup(), and rb_str_upcase_bang().

Referenced by Init_String(), and sym_upcase().

◆ rb_str_upcase_bang()

static VALUE rb_str_upcase_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

◆ rb_str_update()

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

◆ rb_str_upto()

static VALUE rb_str_upto ( int  argc,
VALUE argv,
VALUE  beg 
)
static

Definition at line 4055 of file string.c.

References Qnil, rb_scan_args(), RETURN_ENUMERATOR, RTEST, str_upto_each(), and str_upto_i().

Referenced by Init_String().

◆ rb_str_valid_encoding_p()

static VALUE rb_str_valid_encoding_p ( VALUE  str)
static

Definition at line 9129 of file string.c.

References ENC_CODERANGE_BROKEN, Qfalse, Qtrue, and rb_enc_str_coderange().

Referenced by Init_String().

◆ rb_string_value()

VALUE rb_string_value ( volatile VALUE ptr)

Definition at line 2041 of file string.c.

References RString::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)

◆ rb_string_value_ptr()

char* rb_string_value_ptr ( volatile VALUE ptr)

Definition at line 2052 of file string.c.

References rb_string_value(), and RSTRING_PTR.

◆ rb_strseq_index()

static long rb_strseq_index ( VALUE  str,
VALUE  sub,
long  offset,
int  in_byte 
)
static

◆ rb_sym_proc_call()

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

Definition at line 9716 of file string.c.

References rb_eArgError, rb_funcall_with_block(), rb_raise(), rb_sym_to_proc(), and sym.

Referenced by vm_yield_with_symbol(), and yield_under().

◆ rb_sym_to_s()

VALUE rb_sym_to_s ( VALUE  sym)

Definition at line 9693 of file string.c.

References rb_cString, rb_sym2str, and str_new_shared().

Referenced by Init_String().

◆ rb_tainted_str_new()

VALUE rb_tainted_str_new ( const char *  ptr,
long  len 
)

◆ rb_tainted_str_new_cstr()

VALUE rb_tainted_str_new_cstr ( const char *  ptr)

◆ rb_tainted_str_new_with_enc()

static VALUE rb_tainted_str_new_with_enc ( const char *  ptr,
long  len,
rb_encoding enc 
)
static

Definition at line 862 of file string.c.

References OBJ_TAINT, and rb_enc_str_new().

Referenced by rb_external_str_new_with_enc().

◆ rb_to_id()

ID rb_to_id ( VALUE  name)

◆ rb_to_symbol()

VALUE rb_to_symbol ( VALUE  name)

◆ rb_usascii_str_new()

VALUE rb_usascii_str_new ( const char *  ptr,
long  len 
)

◆ 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 835 of file string.c.

References ENCINDEX_US_ASCII, rb_cString, and str_new_static().

◆ rb_utf8_str_new()

VALUE rb_utf8_str_new ( const char *  ptr,
long  len 
)

Definition at line 750 of file string.c.

References rb_cString, rb_enc_associate_index(), rb_utf8_encindex(), and str_new().

Referenced by env_enc_str_new(), and ruby_init_loadpath_safe().

◆ rb_utf8_str_new_cstr()

VALUE rb_utf8_str_new_cstr ( const char *  ptr)

Definition at line 785 of file string.c.

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

Referenced by external_str_new_cstr(), and push_pattern().

◆ rb_utf8_str_new_static()

VALUE rb_utf8_str_new_static ( const char *  ptr,
long  len 
)

Definition at line 841 of file string.c.

References ENCINDEX_UTF_8, rb_cString, and str_new_static().

◆ register_fstring()

static VALUE register_fstring ( VALUE  str)
static

◆ rstrip_offset()

static long rstrip_offset ( VALUE  str,
const char *  s,
const char *  e,
rb_encoding enc 
)
static

◆ RUBY_ALIAS_FUNCTION() [1/2]

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

Definition at line 2514 of file string.c.

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

◆ RUBY_ALIAS_FUNCTION() [2/2]

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

◆ scan_once()

static VALUE scan_once ( VALUE  str,
VALUE  pat,
long *  start 
)
static

◆ search_nonascii()

static const char* search_nonascii ( const char *  p,
const char *  e 
)
inlinestatic

◆ setup_fake_str()

static VALUE setup_fake_str ( struct RString fake_str,
const char *  name,
long  len,
int  encidx 
)
static

◆ single_byte_optimizable()

static int single_byte_optimizable ( VALUE  str)
inlinestatic

◆ str_alloc()

static VALUE str_alloc ( VALUE  klass)
inlinestatic

◆ str_buf_cat()

static VALUE str_buf_cat ( VALUE  str,
const char *  ptr,
long  len 
)
static

◆ str_byte_aref()

static VALUE str_byte_aref ( VALUE  str,
VALUE  indx 
)
static

Definition at line 5281 of file string.c.

References FALSE, FIX2LONG, FIXNUM_P, NUM2LONG, Qfalse, Qnil, rb_range_beg_len(), RSTRING_LEN, str_byte_substr(), and TRUE.

Referenced by rb_str_byteslice().

◆ str_byte_substr()

static VALUE str_byte_substr ( VALUE  str,
long  beg,
long  len,
int  empty 
)
static

◆ str_capacity()

static size_t str_capacity ( VALUE  str,
const int  termlen 
)
static

◆ str_cat_conv_enc_opts()

static VALUE str_cat_conv_enc_opts ( VALUE  newstr,
long  ofs,
const char *  ptr,
long  len,
rb_encoding from,
rb_encoding to,
int  ecflags,
VALUE  ecopts 
)
static

◆ str_compat_and_valid()

static VALUE str_compat_and_valid ( VALUE  str,
rb_encoding enc 
)
static

◆ str_dependent_p()

static int str_dependent_p ( VALUE  str)
inlinestatic

Definition at line 1931 of file string.c.

References FL_TEST, STR_EMBED_P, STR_NOFREE, and STR_SHARED.

Referenced by rb_str_change_terminator_length(), str_fill_term(), and str_independent().

◆ str_discard()

static void str_discard ( VALUE  str)
inlinestatic

◆ str_duplicate()

static VALUE str_duplicate ( VALUE  klass,
VALUE  str 
)
inlinestatic

◆ str_enc_copy()

static void str_enc_copy ( VALUE  str1,
VALUE  str2 
)
inlinestatic

◆ str_eql()

static VALUE str_eql ( const VALUE  str1,
const VALUE  str2 
)
static

Definition at line 3077 of file string.c.

References memcmp(), Qfalse, Qtrue, rb_str_comparable(), RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_str_eql(), and rb_str_equal().

◆ str_fill_term()

static char* str_fill_term ( VALUE  str,
char *  s,
long  len,
int  termlen 
)
static

◆ str_gsub()

static VALUE str_gsub ( int  argc,
VALUE argv,
VALUE  str,
int  bang 
)
static

◆ str_independent()

static int str_independent ( VALUE  str)
inlinestatic

◆ str_make_independent()

static void str_make_independent ( VALUE  str)
inlinestatic

◆ str_make_independent_expand()

static void str_make_independent_expand ( VALUE  str,
long  len,
long  expand,
const int  termlen 
)
static

◆ str_mod_check()

static void str_mod_check ( VALUE  s,
const char *  p,
long  len 
)
inlinestatic

◆ str_modifiable()

static void str_modifiable ( VALUE  str)
inlinestatic

◆ str_modify_keep_cr()

static void str_modify_keep_cr ( VALUE  str)
static

◆ str_new()

static VALUE str_new ( VALUE  klass,
const char *  ptr,
long  len 
)
static

Definition at line 730 of file string.c.

References str_new0().

Referenced by rb_str_new(), rb_str_tmp_new(), rb_utf8_str_new(), and str_new_frozen().

◆ str_new0()

static VALUE str_new0 ( VALUE  klass,
const char *  ptr,
long  len,
int  termlen 
)
static

◆ str_new_empty()

static VALUE str_new_empty ( VALUE  str)
static

Definition at line 1236 of file string.c.

References OBJ_INFECT, rb_enc_copy(), and rb_str_new_with_class().

Referenced by rb_str_partition(), rb_str_rpartition(), and rb_str_split_m().

◆ str_new_frozen()

static VALUE str_new_frozen ( VALUE  klass,
VALUE  orig 
)
static

◆ str_new_shared()

static VALUE str_new_shared ( VALUE  klass,
VALUE  str 
)
static

◆ str_new_static()

static VALUE str_new_static ( VALUE  klass,
const char *  ptr,
long  len,
int  encindex 
)
static

◆ str_nth()

static char* str_nth ( const char *  p,
const char *  e,
long  nth,
rb_encoding enc,
int  singlebyte 
)
static

Definition at line 2244 of file string.c.

References str_nth_len().

Referenced by rb_str_rindex(), rb_str_update(), and str_offset().

◆ str_nth_len()

static char* str_nth_len ( const char *  p,
const char *  e,
long *  nthp,
rb_encoding enc 
)
static

◆ str_null_char()

static const char* str_null_char ( const char *  s,
long  len,
const int  minlen,
rb_encoding enc 
)
static

Definition at line 2068 of file string.c.

References len, rb_enc_mbclen(), and zero_filled().

Referenced by rb_string_value_cstr().

◆ str_offset()

static long str_offset ( const char *  p,
const char *  e,
long  nth,
rb_encoding enc,
int  singlebyte 
)
static

◆ str_replace()

static VALUE str_replace ( VALUE  str,
VALUE  str2 
)
static

◆ str_replace_shared()

static VALUE str_replace_shared ( VALUE  str2,
VALUE  str 
)
static

Definition at line 1100 of file string.c.

References rb_enc_cr_str_exact_copy(), and str_replace_shared_without_enc().

Referenced by str_new_shared(), and str_replace().

◆ str_replace_shared_without_enc()

static VALUE str_replace_shared_without_enc ( VALUE  str2,
VALUE  str 
)
static

◆ str_rindex()

static long str_rindex ( VALUE  str,
VALUE  sub,
const char *  s,
long  pos,
rb_encoding enc 
)
static

Definition at line 3438 of file string.c.

References memcmp(), rb_enc_prev_char, RSTRING_END, RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_str_index_m(), and rb_str_rindex().

◆ str_scrub()

static VALUE str_scrub ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 9509 of file string.c.

References NIL_P, Qnil, rb_check_arity, rb_str_dup(), and rb_str_scrub().

Referenced by Init_String().

◆ str_scrub_bang()

static VALUE str_scrub_bang ( int  argc,
VALUE argv,
VALUE  str 
)
static

Definition at line 9531 of file string.c.

References NIL_P, Qnil, rb_check_arity, rb_str_replace(), and rb_str_scrub().

Referenced by Init_String().

◆ str_shared_replace()

static void str_shared_replace ( VALUE  str,
VALUE  str2 
)
static

◆ str_strlen()

static long str_strlen ( VALUE  str,
rb_encoding enc 
)
static

◆ str_substr()

static VALUE str_substr ( VALUE  str,
long  beg,
long  len,
int  empty 
)
static

◆ str_succ()

static VALUE str_succ ( VALUE  str)
static

◆ str_uminus()

static VALUE str_uminus ( VALUE  str)
static

Definition at line 2504 of file string.c.

References OBJ_FROZEN, rb_str_dup(), and rb_str_freeze().

Referenced by Init_String().

◆ str_uplus()

static VALUE str_uplus ( VALUE  str)
static

Definition at line 2484 of file string.c.

References OBJ_FROZEN, and rb_str_dup().

Referenced by Init_String().

◆ str_upto_each()

static VALUE str_upto_each ( VALUE  beg,
VALUE  end,
int  excl,
int(*)(VALUE, VALUE each,
VALUE  arg 
)
static

◆ str_upto_i()

static int str_upto_i ( VALUE  str,
VALUE  arg 
)
static

Definition at line 4016 of file string.c.

References rb_yield().

Referenced by rb_str_upto().

◆ string_for_symbol()

static VALUE string_for_symbol ( VALUE  name)
static

Definition at line 9965 of file string.c.

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

Referenced by rb_to_id(), and rb_to_symbol().

◆ sym_aref()

static VALUE sym_aref ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9867 of file string.c.

References rb_str_aref_m(), and rb_sym2str.

Referenced by Init_String().

◆ sym_capitalize()

static VALUE sym_capitalize ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9933 of file string.c.

References rb_str_capitalize(), rb_str_intern(), and rb_sym2str.

Referenced by Init_String().

◆ sym_casecmp()

static VALUE sym_casecmp ( VALUE  sym,
VALUE  other 
)
static

Definition at line 9791 of file string.c.

References Qnil, rb_str_casecmp(), rb_sym2str, and SYMBOL_P.

Referenced by Init_String().

◆ sym_casecmp_p()

static VALUE sym_casecmp_p ( VALUE  sym,
VALUE  other 
)
static

Definition at line 9809 of file string.c.

References Qnil, rb_str_casecmp_p(), rb_sym2str, and SYMBOL_P.

Referenced by Init_String().

◆ sym_cmp()

static VALUE sym_cmp ( VALUE  sym,
VALUE  other 
)
static

Definition at line 9772 of file string.c.

References Qnil, rb_str_cmp_m(), rb_sym2str, and SYMBOL_P.

Referenced by Init_String().

◆ sym_downcase()

static VALUE sym_downcase ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9920 of file string.c.

References rb_str_downcase(), rb_str_intern(), and rb_sym2str.

Referenced by Init_String().

◆ sym_empty()

static VALUE sym_empty ( VALUE  sym)
static

Definition at line 9894 of file string.c.

References rb_str_empty(), and rb_sym2str.

Referenced by Init_String().

◆ sym_encoding()

static VALUE sym_encoding ( VALUE  sym)
static

Definition at line 9959 of file string.c.

References rb_obj_encoding(), and rb_sym2str.

Referenced by Init_String().

◆ sym_inspect()

static VALUE sym_inspect ( VALUE  sym)
static

◆ sym_length()

static VALUE sym_length ( VALUE  sym)
static

Definition at line 9881 of file string.c.

References rb_str_length(), and rb_sym2str.

Referenced by Init_String().

◆ sym_match()

static VALUE sym_match ( VALUE  sym,
VALUE  other 
)
static

Definition at line 9825 of file string.c.

References rb_str_match(), and rb_sym2str.

Referenced by Init_String().

◆ sym_match_m()

static VALUE sym_match_m ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9838 of file string.c.

References rb_str_match_m(), and rb_sym2str.

Referenced by Init_String().

◆ sym_match_m_p()

static VALUE sym_match_m_p ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9851 of file string.c.

References rb_str_match_m_p().

Referenced by Init_String().

◆ sym_printable()

static int sym_printable ( const char *  s,
const char *  send,
rb_encoding enc 
)
static

◆ sym_succ()

static VALUE sym_succ ( VALUE  sym)
static

Definition at line 9752 of file string.c.

References rb_str_intern(), rb_str_succ(), and rb_sym2str.

Referenced by Init_String().

◆ sym_swapcase()

static VALUE sym_swapcase ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9946 of file string.c.

References rb_str_intern(), rb_str_swapcase(), and rb_sym2str.

Referenced by Init_String().

◆ sym_to_sym()

static VALUE sym_to_sym ( VALUE  sym)
static

Definition at line 9710 of file string.c.

References sym.

Referenced by Init_String().

◆ sym_upcase()

static VALUE sym_upcase ( int  argc,
VALUE argv,
VALUE  sym 
)
static

Definition at line 9907 of file string.c.

References rb_str_intern(), rb_str_upcase(), and rb_sym2str.

Referenced by Init_String().

◆ tr_find()

static int tr_find ( unsigned int  c,
const char  table[TR_TABLE_SIZE],
VALUE  del,
VALUE  nodel 
)
static

Definition at line 6802 of file string.c.

References FALSE, NIL_P, rb_hash_lookup(), TRUE, and UINT2NUM.

Referenced by rb_str_count(), rb_str_delete_bang(), and rb_str_squeeze_bang().

◆ tr_setup_table()

static void tr_setup_table ( VALUE  str,
char  stable[TR_TABLE_SIZE],
int  first,
VALUE tablep,
VALUE ctablep,
rb_encoding enc 
)
static

◆ tr_trans()

static VALUE tr_trans ( VALUE  str,
VALUE  src,
VALUE  repl,
int  sflag 
)
static

◆ trnext()

static unsigned int trnext ( struct tr t,
rb_encoding enc 
)
static

◆ zero_filled()

static int zero_filled ( const char *  s,
int  n 
)
static

Definition at line 2059 of file string.c.

Referenced by str_fill_term(), and str_null_char().

Variable Documentation

◆ isspacetable

const char isspacetable[256]
static
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}

Definition at line 7168 of file string.c.

◆ rb_cString

VALUE rb_cString

◆ rb_cSymbol

VALUE rb_cSymbol

Definition at line 66 of file string.c.

Referenced by Init_String().

◆ rb_fs

VALUE rb_fs

Definition at line 435 of file string.c.

Referenced by Init_String(), and rb_str_split_m().

◆ rb_fstring_hash_type

const struct st_hash_type rb_fstring_hash_type
Initial value:
= {
}
st_index_t rb_str_hash(VALUE str)
Definition: string.c:2985
static int fstring_cmp(VALUE a, VALUE b)
Definition: string.c:406

Definition at line 253 of file string.c.

◆ sym_ascii

VALUE sym_ascii
static

Definition at line 194 of file string.c.

Referenced by check_case_options(), and Init_String().

◆ sym_fold

VALUE sym_fold
static

Definition at line 194 of file string.c.

Referenced by check_case_options(), Init_String(), and rb_str_casecmp_p().

◆ sym_lithuanian

VALUE sym_lithuanian
static

Definition at line 194 of file string.c.

Referenced by check_case_options(), and Init_String().

◆ sym_turkic

VALUE sym_turkic
static

Definition at line 194 of file string.c.

Referenced by check_case_options(), and Init_String().