string.c File Reference

#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
#include "vm_core.h"
#include "internal.h"
#include "probes.h"
#include <assert.h>
#include <math.h>
#include <ctype.h>

Go to the source code of this file.

Data Structures

struct  tr

Defines

#define BEG(no)   (regs->beg[(no)])
#define END(no)   (regs->end[(no)])
#define STRING_ENUMERATORS_WANTARRAY   0
#define RUBY_MAX_CHAR_LEN   16
#define STR_TMPLOCK   FL_USER7
#define STR_UNSET_NOCAPA(s)
#define STR_SET_NOEMBED(str)
#define STR_SET_EMBED(str)   FL_UNSET((str), STR_NOEMBED)
#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 STR_SET_SHARED(str, shared_str)
#define STR_HEAP_PTR(str)   (RSTRING(str)->as.heap.ptr)
#define STR_HEAP_SIZE(str)   (RSTRING(str)->as.heap.aux.capa + TERM_LEN(str))
#define STR_ENC_GET(str)   get_encoding(str)
#define STR_BUF_MIN_SIZE   128
#define str_make_independent(str)   str_make_independent_expand((str), 0L)
#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 CHAR_ESC_LEN   13
#define IS_EVSTR(p, e)   ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{'))
#define CHECK_IF_ASCII(c)
#define TR_TABLE_SIZE   257
#define ascii_isspace(c)   isspacetable[(unsigned char)(c)]
#define DEFAULT_REPLACE_CHAR(str)
#define rb_intern(str)   rb_intern_const(str)

Typedefs

typedef unsigned char * USTR

Enumerations

enum  neighbor_char { NEIGHBOR_NOT_CHAR, NEIGHBOR_FOUND, NEIGHBOR_WRAPPED }

Functions

static VALUE rb_str_clear (VALUE str)
rb_encodingrb_enc_get_from_index (int index)
static rb_encodingget_actual_encoding (const int encidx, VALUE str)
static rb_encodingget_encoding (VALUE str)
static int fstring_cmp (VALUE a, VALUE b)
static int fstr_update_callback (st_data_t *key, st_data_t *value, st_data_t arg, int existing)
VALUE rb_fstring (VALUE str)
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)
size_t rb_str_capacity (VALUE str)
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_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_enc_str_new_cstr (const char *ptr, rb_encoding *enc)
VALUE rb_tainted_str_new (const char *ptr, long len)
VALUE rb_tainted_str_new_cstr (const char *ptr)
VALUE rb_str_conv_enc_opts (VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
VALUE rb_str_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_without_enc (VALUE str2, VALUE str)
static VALUE str_replace_shared (VALUE str2, VALUE str)
static VALUE str_new_shared (VALUE klass, VALUE str)
static VALUE str_new3 (VALUE klass, VALUE str)
VALUE rb_str_new_shared (VALUE str)
static VALUE str_new4 (VALUE klass, VALUE str)
VALUE rb_str_new_frozen (VALUE orig)
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_alloc_tmp_buffer (volatile VALUE *store, long len)
void rb_free_tmp_buffer (volatile VALUE *store)
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)
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 str_modifiable (VALUE str)
static int str_independent (VALUE str)
static void str_make_independent_expand (VALUE str, long expand)
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_str_associate (VALUE str, VALUE add)
VALUE rb_str_associated (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 oldtermlen, int termlen)
char * rb_string_value_cstr (volatile VALUE *ptr)
void 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)
VALUE rb_str_substr (VALUE str, long beg, long len)
VALUE rb_str_freeze (VALUE str)
 RUBY_ALIAS_FUNCTION (rb_str_dup_frozen(VALUE str), rb_str_new_frozen,(str))
VALUE rb_str_unlocktmp (VALUE str)
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_buf_cat (VALUE str, const char *ptr, long len)
VALUE rb_str_buf_cat2 (VALUE str, const char *ptr)
VALUE rb_str_cat (VALUE str, const char *ptr, long len)
VALUE rb_str_cat2 (VALUE str, const char *ptr)
static VALUE rb_enc_cr_str_buf_cat (VALUE str, const char *ptr, long len, int ptr_encindex, int ptr_cr, int *ptr_cr_ret)
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 (VALUE str1, VALUE str2)
static VALUE rb_str_prepend (VALUE str, VALUE str2)
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 long rb_str_index (VALUE str, VALUE sub, long offset)
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, int)
static VALUE rb_str_match_m (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)
VALUE rb_str_succ (VALUE orig)
static VALUE rb_str_succ_bang (VALUE str)
static VALUE rb_str_upto (int argc, VALUE *argv, VALUE beg)
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)
static void rb_str_splice (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 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)
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_inspect (VALUE str)
VALUE rb_str_dump (VALUE str)
static void rb_str_check_dummy_enc (rb_encoding *enc)
static VALUE rb_str_upcase_bang (VALUE str)
static VALUE rb_str_upcase (VALUE str)
static VALUE rb_str_downcase_bang (VALUE str)
static VALUE rb_str_downcase (VALUE str)
static VALUE rb_str_capitalize_bang (VALUE str)
static VALUE rb_str_capitalize (VALUE str)
static VALUE rb_str_swapcase_bang (VALUE str)
static VALUE rb_str_swapcase (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_str_split_m (int argc, VALUE *argv, VALUE str)
VALUE rb_str_split (VALUE str, const char *sep0)
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 VALUE rb_str_chomp_bang (int argc, VALUE *argv, VALUE str)
static VALUE rb_str_chomp (int argc, VALUE *argv, VALUE str)
static VALUE rb_str_lstrip_bang (VALUE str)
static VALUE rb_str_lstrip (VALUE str)
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_intern (VALUE s)
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 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.
static VALUE str_compat_and_valid (VALUE str, rb_encoding *enc)
VALUE rb_str_scrub (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 VALUE sym_equal (VALUE sym1, VALUE sym2)
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)
static VALUE sym_call (VALUE args, VALUE sym, int argc, VALUE *argv, VALUE passed_proc)
static VALUE sym_to_proc (VALUE sym)
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_match (VALUE sym, VALUE other)
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 (VALUE sym)
static VALUE sym_downcase (VALUE sym)
static VALUE sym_capitalize (VALUE sym)
static VALUE sym_swapcase (VALUE sym)
static VALUE sym_encoding (VALUE sym)
ID rb_to_id (VALUE name)
void Init_String (void)

Variables

VALUE rb_cString
VALUE rb_cSymbol
static st_tablefrozen_strings
static struct st_hash_type fstring_hash_type
VALUE rb_fs
static ID id_to_s
static const char isspacetable [256]


Define Documentation

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

Definition at line 6146 of file string.c.

Referenced by rb_str_rstrip_bang(), and rb_str_split_m().

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

Definition at line 22 of file string.c.

#define CHAR_ESC_LEN   13

Definition at line 4744 of file string.c.

Referenced by rb_str_buf_cat_escaped_char(), and rb_str_inspect().

#define CHECK_IF_ASCII (  ) 

Value:

(void)((cr == ENC_CODERANGE_7BIT && !rb_isascii(c)) ? \
           (cr = ENC_CODERANGE_VALID) : 0)

Referenced by tr_trans().

#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 rb_str_scrub().

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

Definition at line 23 of file string.c.

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

Definition at line 4886 of file string.c.

Referenced by rb_str_dump().

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

Definition at line 2458 of file string.c.

Referenced by rb_str_cmp().

#define rb_intern ( str   )     rb_intern_const(str)

#define rb_str_dup_frozen   rb_str_new_frozen

#define RESIZE_CAPA ( str,
capacity   ) 

Value:

do {\
    const int termlen = TERM_LEN(str);\
    if (STR_EMBED_P(str)) {\
        if ((capacity) > RSTRING_EMBED_LEN_MAX) {\
            char *const tmp = ALLOC_N(char, (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 {\
        REALLOC_N(RSTRING(str)->as.heap.ptr, char, (capacity)+termlen);\
        if (!STR_NOCAPA_P(str))\
            RSTRING(str)->as.heap.aux.capa = (capacity);\
    }\
} while (0)

Definition at line 96 of file string.c.

Referenced by rb_str_associate(), rb_str_splice_0(), rb_str_sub_bang(), rb_str_succ(), and str_buf_cat().

#define RUBY_MAX_CHAR_LEN   16

Definition at line 50 of file string.c.

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

Definition at line 2121 of file string.c.

Referenced by rb_str_inspect().

#define STR_BUF_MIN_SIZE   128

Definition at line 888 of file string.c.

Referenced by rb_str_buf_new().

#define STR_DEC_LEN ( str   ) 

Value:

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

Definition at line 76 of file string.c.

Referenced by rb_str_chomp_bang().

#define STR_ENC_GET ( str   )     get_encoding(str)

Definition at line 124 of file string.c.

Referenced by chopped_length(), fstr_update_callback(), rb_enc_cr_str_copy_for_substr(), rb_enc_str_asciionly_p(), rb_enc_str_coderange(), rb_str_aref(), rb_str_capitalize_bang(), rb_str_clear(), rb_str_concat(), rb_str_conv_enc_opts(), rb_str_downcase_bang(), rb_str_enumerate_codepoints(), rb_str_export(), rb_str_export_locale(), rb_str_export_to_enc(), rb_str_index_m(), rb_str_justify(), rb_str_length(), rb_str_lstrip_bang(), rb_str_offset(), rb_str_ord(), rb_str_quote_unprintable(), rb_str_reverse(), rb_str_rindex_m(), rb_str_rstrip_bang(), rb_str_scrub(), rb_str_shared_replace(), rb_str_split_m(), rb_str_squeeze_bang(), rb_str_strlen(), rb_str_sub_bang(), rb_str_sublen(), rb_str_subpos(), rb_str_succ(), rb_str_swapcase_bang(), rb_str_symname_p(), rb_str_upcase_bang(), scan_once(), single_byte_optimizable(), str_byte_substr(), str_compat_and_valid(), str_gsub(), str_strlen(), and sym_inspect().

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

Definition at line 121 of file string.c.

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

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

Definition at line 122 of file string.c.

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

#define str_make_independent ( str   )     str_make_independent_expand((str), 0L)

Definition at line 1481 of file string.c.

Referenced by rb_str_associate(), rb_str_modify(), str_fill_term(), and str_modify_keep_cr().

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

Definition at line 60 of file string.c.

Referenced by rb_str_clear(), rb_str_drop_bytes(), rb_str_resize(), rb_str_shared_replace(), and str_replace_shared_without_enc().

#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 61 of file string.c.

Referenced by rb_str_clear(), rb_str_drop_bytes(), rb_str_resize(), rb_str_shared_replace(), and str_replace_shared_without_enc().

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

Definition at line 67 of file string.c.

Referenced by rb_str_chomp_bang(), 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_sub_bang(), rb_str_succ(), str_buf_cat(), and str_new0().

#define STR_SET_NOEMBED ( str   ) 

Value:

do {\
    FL_SET((str), STR_NOEMBED);\
    STR_SET_EMBED_LEN((str), 0);\
} while (0)

Definition at line 56 of file string.c.

Referenced by rb_str_resize(), rb_str_shared_replace(), str_make_independent_expand(), str_new0(), str_new4(), str_replace(), and tr_trans().

#define STR_SET_SHARED ( str,
shared_str   ) 

Value:

do { \
    RB_OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
    FL_SET((str), ELTS_SHARED); \
} while (0)

Definition at line 116 of file string.c.

Referenced by str_new4(), str_replace(), and str_replace_shared_without_enc().

#define STR_TMPLOCK   FL_USER7

Definition at line 51 of file string.c.

Referenced by rb_str_unlocktmp(), RUBY_ALIAS_FUNCTION(), and str_modifiable().

#define STR_UNSET_NOCAPA (  ) 

Value:

do {\
    if (FL_TEST((s),STR_NOEMBED)) FL_UNSET((s),(ELTS_SHARED|STR_ASSOC));\
} while (0)

Definition at line 52 of file string.c.

Referenced by rb_str_modify_expand(), rb_str_shared_replace(), and str_make_independent_expand().

#define STRING_ENUMERATORS_WANTARRAY   0

Definition at line 32 of file string.c.

#define TERM_FILL ( ptr,
termlen   ) 

Value:

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

Definition at line 88 of file string.c.

Referenced by rb_str_append(), rb_str_cat(), rb_str_resize(), rb_str_set_len(), str_fill_term(), str_make_independent_expand(), and str_new0().

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

Definition at line 87 of file string.c.

Referenced by rb_str_cat(), rb_str_modify_expand(), rb_str_resize(), rb_str_set_len(), rb_str_splice_0(), str_buf_cat(), and str_make_independent_expand().

#define TR_TABLE_SIZE   257

Definition at line 5706 of file string.c.

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


Typedef Documentation

typedef unsigned char* USTR

Definition at line 5338 of file string.c.


Enumeration Type Documentation

enum neighbor_char

Enumerator:
NEIGHBOR_NOT_CHAR 
NEIGHBOR_FOUND 
NEIGHBOR_WRAPPED 

Definition at line 3054 of file string.c.


Function Documentation

static long chopped_length ( VALUE  str  )  [static]

Definition at line 6876 of file string.c.

References re_registers::beg, re_registers::end, 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().

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

Definition at line 291 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_VALID, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, rb_enc_asciicompat, rb_enc_precise_mbclen(), rb_enc_to_index, and search_nonascii().

Referenced by rb_enc_cr_str_buf_cat(), rb_enc_str_coderange(), and rb_str_sub_bang().

static VALUE empty_str_alloc ( VALUE  klass  )  [inline, static]

Definition at line 489 of file string.c.

References rb_sourcefile, rb_sourceline(), RUBY_DTRACE_STRING_CREATE, RUBY_DTRACE_STRING_CREATE_ENABLED, and str_alloc().

Referenced by Init_String().

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

Definition at line 3113 of file string.c.

References MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, NEIGHBOR_FOUND, NEIGHBOR_NOT_CHAR, rb_enc_code_to_mbclen, rb_enc_mbc_to_codepoint, rb_enc_mbcput, rb_enc_mbminlen, and rb_enc_precise_mbclen().

Referenced by enc_succ_alnum_char().

static long enc_strlen ( const char *  p,
const char *  e,
rb_encoding enc,
int  cr 
) [inline, static]

Definition at line 1095 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_VALID, ISASCII, rb_enc_asciicompat, rb_enc_fast_mbclen(), rb_enc_mbclen(), rb_enc_mbmaxlen, rb_enc_mbminlen, and search_nonascii().

Referenced by rb_enc_strlen(), and rb_str_sublen().

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

Definition at line 3175 of file string.c.

References enc_pred_char(), enc_succ_char(), MEMCPY, NEIGHBOR_FOUND, NEIGHBOR_NOT_CHAR, ONIGENC_CODE_TO_MBC_MAXLEN, ONIGENC_CTYPE_ALPHA, ONIGENC_CTYPE_DIGIT, range, rb_enc_isctype, and rb_enc_mbc_to_codepoint.

Referenced by rb_str_succ().

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

Definition at line 3061 of file string.c.

References MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, NEIGHBOR_FOUND, NEIGHBOR_NOT_CHAR, rb_enc_code_to_mbclen, rb_enc_mbc_to_codepoint, rb_enc_mbcput, rb_enc_mbminlen, and rb_enc_precise_mbclen().

Referenced by enc_succ_alnum_char(), and rb_str_succ().

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

Definition at line 174 of file string.c.

References OBJ_FREEZE, rb_enc_str_new(), rb_gc_resurrect(), rb_str_new_frozen(), RBASIC, RSTRING_FSTR, RSTRING_LEN, RSTRING_PTR, ST_CONTINUE, ST_STOP, STR_ENC_GET, STR_SHARED_P, and VALUE.

Referenced by rb_fstring().

static int fstring_cmp ( VALUE  a,
VALUE  b 
) [static]

Definition at line 224 of file string.c.

References cmp, ENCODING_GET, and rb_str_hash_cmp().

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

Definition at line 217 of file string.c.

References RBASIC_SET_CLASS, ST_CONTINUE, and VALUE.

Referenced by Init_String().

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

Definition at line 129 of file string.c.

References rb_ascii8bit_encoding(), rb_enc_from_index(), rb_enc_get_from_index(), RSTRING_LEN, and RSTRING_PTR.

Referenced by get_encoding(), and rb_str_inspect().

static rb_encoding* get_encoding ( VALUE  str  )  [static]

Definition at line 159 of file string.c.

References ENCODING_GET, and get_actual_encoding().

static VALUE get_pat ( VALUE  ,
int   
) [static]

Definition at line 3938 of file string.c.

References Check_Type, NIL_P, rb_check_string_type(), rb_reg_quote(), rb_reg_regcomp(), T_REGEXP, T_STRING, TYPE, and val.

Referenced by rb_str_match_m(), rb_str_scan(), rb_str_split_m(), rb_str_sub_bang(), and str_gsub().

void Init_String ( void   ) 

Definition at line 8762 of file string.c.

References CLASS_OF, empty_str_alloc(), frozen_strings, fstring_set_class_i(), id_to_s, Qnil, rb_cObject, rb_cString, rb_cSymbol, rb_define_alloc_func(), rb_define_class(), rb_define_method(), rb_define_singleton_method(), rb_define_variable(), rb_fs, rb_include_module(), rb_intern, rb_mComparable, rb_obj_encoding(), rb_obj_freeze(), 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_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_count(), rb_str_crypt(), rb_str_delete(), rb_str_delete_bang(), 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_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_oct(), rb_str_ord(), rb_str_partition(), rb_str_plus(), rb_str_prepend(), 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_s(), rb_undef_alloc_func(), rb_undef_method(), st_foreach(), str_scrub(), str_scrub_bang(), sym_aref, sym_capitalize(), sym_casecmp(), sym_cmp(), sym_downcase(), sym_empty(), sym_encoding, sym_equal(), sym_inspect(), sym_length(), sym_match(), sym_succ(), sym_swapcase(), sym_to_proc(), sym_to_sym(), and sym_upcase().

void* rb_alloc_tmp_buffer ( volatile VALUE *  store,
long  len 
)

Definition at line 925 of file string.c.

References rb_str_tmp_new(), RSTRING_PTR, and VALUE.

VALUE rb_check_string_type ( VALUE  str  ) 

Definition at line 1679 of file string.c.

References rb_check_convert_type(), and T_STRING.

Referenced by ary_join_1(), check_setter_id(), constant_arg(), env_has_value(), env_rassoc(), error_print(), get_pat(), gzreader_gets(), io_encoding_set(), make_exception(), marshal_load(), month_arg(), prepare_getline_args(), range_each(), range_step(), rb_ary_join(), rb_ary_times(), rb_check_id(), rb_check_sockaddr_string_type(), rb_convert_to_integer(), rb_digest_instance_equal(), rb_f_kill(), rb_io_extract_encoding_option(), rb_str_format(), rb_str_index_m(), rb_str_partition(), rb_str_rindex_m(), rb_str_rpartition(), rb_str_s_try_convert(), rb_String(), rb_to_encoding_index(), rb_to_id(), reg_operand(), setup_narg(), strio_each(), strio_getline(), strio_readlines(), trap_handler(), and utc_offset_arg().

static VALUE rb_enc_cr_str_buf_cat ( VALUE  str,
const char *  ptr,
long  len,
int  ptr_encindex,
int  ptr_cr,
int *  ptr_cr_ret 
) [static]

Definition at line 2165 of file string.c.

References coderange_scan(), ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_UNKNOWN, ENC_CODERANGE_VALID, ENCODING_CODERANGE_SET, ENCODING_GET, ENCODING_IS_ASCII8BIT, rb_eArgError, rb_eEncCompatError, rb_enc_asciicompat, rb_enc_from_index(), rb_enc_name, rb_enc_str_coderange(), rb_raise(), rb_str_buf_cat(), RSTRING_LEN, and str_buf_cat().

Referenced by rb_enc_str_buf_cat(), rb_str_buf_append(), and rb_str_buf_cat_ascii().

static void rb_enc_cr_str_copy_for_substr ( VALUE  dest,
VALUE  src 
) [static]

Definition at line 398 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, rb_enc_asciicompat, RSTRING_END, RSTRING_LEN, RSTRING_PTR, search_nonascii(), str_enc_copy(), and STR_ENC_GET.

Referenced by rb_str_reverse(), rb_str_subseq(), rb_str_substr(), rb_str_succ(), and rb_str_times().

static void rb_enc_cr_str_exact_copy ( VALUE  dest,
VALUE  src 
) [static]

Definition at line 428 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, and str_enc_copy().

Referenced by rb_str_new_frozen(), str_new4(), str_replace(), and str_replace_shared().

rb_encoding* rb_enc_get_from_index ( int  index  ) 

Definition at line 602 of file encoding.c.

References must_encindex().

Referenced by get_actual_encoding().

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

Definition at line 1753 of file string.c.

References str_nth_len().

Referenced by rb_str_ellipsize(), and rb_str_format().

int rb_enc_str_asciionly_p ( VALUE  str  ) 

Definition at line 448 of file string.c.

References ENC_CODERANGE_7BIT, FALSE, rb_enc_asciicompat, rb_enc_str_coderange(), STR_ENC_GET, and TRUE.

Referenced by file_path_convert(), fnmatch_brace(), rb_enc_compatible(), rb_file_expand_path_internal(), rb_inspect(), rb_reg_quote(), and rb_reg_s_union().

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

Definition at line 2251 of file string.c.

References ENC_CODERANGE_UNKNOWN, NULL, rb_enc_cr_str_buf_cat(), and rb_enc_to_index.

Referenced by rb_reg_regsub(), str_gsub(), and strio_write().

int rb_enc_str_coderange ( VALUE  str  ) 

Definition at line 435 of file string.c.

References coderange_scan(), ENC_CODERANGE, ENC_CODERANGE_SET, ENC_CODERANGE_UNKNOWN, RSTRING_LEN, RSTRING_PTR, and STR_ENC_GET.

Referenced by parser_str_new(), prepare_getline_args(), rb_econv_prepare_options(), rb_enc_compatible(), rb_enc_cr_str_buf_cat(), rb_enc_str_asciionly_p(), rb_external_str_with_enc(), rb_file_expand_path_internal(), rb_reg_initialize_str(), rb_reg_prepare_enc(), rb_reg_preprocess_dregexp(), rb_str_comparable(), rb_str_hash(), rb_str_is_ascii_only_p(), rb_str_succ(), rb_str_valid_encoding_p(), reg_fragment_setenc_gen(), str_compat_and_valid(), str_transcode0(), sym_check_asciionly(), and w_symbol().

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

Definition at line 548 of file string.c.

References rb_cString, rb_enc_associate(), rb_enc_mbminlen, rb_str_new(), str_new0(), and VALUE.

Referenced by append_fspath(), compile_snprintf(), do_opendir(), econv_get_replacement(), fole_missing(), fstr_update_callback(), get_user_from_path(), io_getc(), lex_get_str(), ole_alloc_vstr(), parser_str_new(), prepare_getline_args(), rb_enc_str_new_cstr(), rb_enc_uint_chr(), rb_intern3(), rb_io_getline_1(), rb_push_glob(), rb_reg_initialize(), rb_reg_initialize_m(), rb_reg_source(), rb_str_scrub(), rb_str_upto(), rb_w32_conv_from_wchar(), register_symid(), strftimev(), strio_getc(), strio_init(), strio_substr(), strio_ungetc(), sym_inspect(), time_strftime(), and transcode_loop().

VALUE rb_enc_str_new_cstr ( const char *  ptr,
rb_encoding enc 
)

Definition at line 577 of file string.c.

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

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

Definition at line 1141 of file string.c.

References ENC_CODERANGE_UNKNOWN, and enc_strlen().

Referenced by rb_str_format(), and update_char_offset().

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

Definition at line 1147 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_VALID, ISASCII, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, rb_enc_asciicompat, rb_enc_mbmaxlen, rb_enc_mbminlen, rb_enc_precise_mbclen(), and search_nonascii().

Referenced by str_strlen().

VALUE rb_external_str_new ( const char *  ptr,
long  len 
)

Definition at line 707 of file string.c.

References rb_default_external_encoding(), and rb_external_str_new_with_enc().

Referenced by fsdbm_delete(), fsdbm_delete_if(), fsdbm_each_key(), fsdbm_each_pair(), fsdbm_each_value(), fsdbm_fetch(), fsdbm_invert(), fsdbm_key(), fsdbm_keys(), fsdbm_select(), fsdbm_shift(), fsdbm_to_a(), fsdbm_to_hash(), fsdbm_values(), and ruby_script().

VALUE rb_external_str_new_cstr ( const char *  ptr  ) 

Definition at line 713 of file string.c.

References rb_default_external_encoding(), rb_external_str_new_with_enc(), and strlen().

Referenced by ruby_set_argv().

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

Definition at line 686 of file string.c.

References rb_external_str_with_enc(), rb_tainted_str_new(), and VALUE.

Referenced by dir_each(), dir_read(), push_pattern(), rb_external_str_new(), rb_external_str_new_cstr(), rb_filesystem_str_new(), rb_filesystem_str_new_cstr(), rb_locale_str_new(), and rb_locale_str_new_cstr().

VALUE rb_external_str_with_enc ( VALUE  str,
rb_encoding eenc 
)

Definition at line 695 of file string.c.

References ENC_CODERANGE_7BIT, rb_ascii8bit_encoding(), rb_default_internal_encoding(), rb_enc_associate(), rb_enc_str_coderange(), rb_str_conv_enc(), and rb_usascii_encoding().

Referenced by dir_each(), and rb_external_str_new_with_enc().

VALUE rb_filesystem_str_new ( const char *  ptr,
long  len 
)

Definition at line 731 of file string.c.

References rb_external_str_new_with_enc(), and rb_filesystem_encoding().

VALUE rb_filesystem_str_new_cstr ( const char *  ptr  ) 

Definition at line 737 of file string.c.

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

Referenced by env_fetch(), etc_sysconfdir(), etc_systmpdir(), load_path_getcwd(), rb_compile_cstr(), rb_compile_string(), rb_f_getenv(), rb_parser_compile_cstr(), rb_parser_compile_file(), rb_parser_compile_string(), and search_required().

void rb_free_tmp_buffer ( volatile VALUE *  store  ) 

Definition at line 933 of file string.c.

References rb_str_clear(), and VALUE.

VALUE rb_fstring ( VALUE  str  ) 

Definition at line 201 of file string.c.

References Check_Type, FL_TEST, frozen_strings, fstr_update_callback(), fstring_hash_type, Qnil, RSTRING_FSTR, st_data_t, st_init_table(), st_update(), T_STRING, and VALUE.

Referenced by case_when_optimizable_literal(), compile_dstr_fragments(), eval_string_with_cref(), iseq_compile_each(), prepare_iseq_build(), rb_id2str(), rb_insns_name_array(), rb_reg_initialize(), register_symid_str(), and when_vals().

VALUE rb_id_quote_unprintable ( ID  id  ) 

Definition at line 8421 of file string.c.

References rb_id2str(), and rb_str_quote_unprintable().

VALUE rb_locale_str_new ( const char *  ptr,
long  len 
)

Definition at line 719 of file string.c.

References rb_external_str_new_with_enc(), and rb_locale_encoding().

Referenced by env_str_new().

VALUE rb_locale_str_new_cstr ( const char *  ptr  ) 

Definition at line 725 of file string.c.

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

Referenced by filename_completion_proc_call(), hist_each(), hist_get(), rb_remove_history(), readline_attempted_completion_function(), readline_readline(), time_mdump(), time_zone(), and username_completion_proc_call().

void rb_must_asciicompat ( VALUE  str  ) 

Definition at line 1580 of file string.c.

References rb_eEncCompatError, rb_enc_asciicompat, rb_enc_get(), rb_enc_name, and rb_raise().

Referenced by dir_s_home(), rb_str2big_karatsuba(), rb_str2big_normal(), rb_str2big_poweroftwo(), rb_str_to_inum(), string_to_c(), string_to_c_strict(), string_to_r(), and string_to_r_strict().

VALUE rb_obj_as_string ( VALUE  obj  ) 

Definition at line 1011 of file string.c.

References id_to_s, OBJ_TAINT, OBJ_TAINTED, rb_any_to_s(), rb_funcall(), RB_TYPE_P, T_STRING, and VALUE.

Referenced by ary_join_1(), compile_err_append(), exc_inspect(), fdbm_store(), init_libraries(), io_write(), io_write_nonblock(), pruby_eval(), pruby_obj_to_var(), rand_random(), range_to_s(), rb_gzwriter_write(), rb_inspect(), rb_io_puts(), rb_io_syswrite(), rb_p(), rb_str_format(), rb_str_sub_bang(), readline_attempted_completion_function(), reg_fragment_check_gen(), ruby__sfvextra(), setup_exception(), str_gsub(), strio_write(), and tcl_protect_core().

VALUE rb_str_append ( VALUE  str,
VALUE  str2 
)

Definition at line 2298 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, len, OBJ_INFECT, rb_enc_associate(), rb_enc_check(), rb_enc_mbminlen, rb_str_buf_append(), rb_str_modify_expand(), RSTRING, RSTRING_LEN, RSTRING_PTR, STR_ASSOC_P, StringValue, and TERM_FILL.

Referenced by append_method(), argf_read(), compile_err_append(), dir_inspect(), eval_string_with_cref(), fc_path(), gzfile_error_inspect(), inspect_i(), inspect_range(), inspect_struct(), io_fillbuf(), join_der_i(), key2keyname(), make_version_str(), method_inspect(), name_err_mesg_to_str(), ole_raise(), ossl_sslctx_set_ciphers(), ossl_x509_inspect(), ossl_x509extfactory_create_ext(), parser_here_document(), path_sub_ext(), rand_random(), range_to_s(), rb_io_inspect(), rb_load_fail(), rb_mod_to_s(), rb_reg_s_union(), rb_set_class_path_string(), rb_stat_inspect(), rb_str_concat(), rb_str_ellipsize(), rb_str_insert(), reg_compile_gen(), sockopt_inspect(), strscan_concat(), sys_fail2(), tcl_protect_core(), tk_install_cmd_core(), warn_print(), and wmap_inspect_i().

static VALUE rb_str_aref ( VALUE  str,
VALUE  indx 
) [static]

Definition at line 3503 of file string.c.

References BUILTIN_TYPE, FIX2LONG, FIXNUM_P, INT2FIX, len, NIL_P, NUM2LONG, Qfalse, Qnil, rb_range_beg_len(), rb_str_dup(), rb_str_index(), rb_str_subpat(), rb_str_substr(), RSTRING_LEN, SPECIAL_CONST_P, STR_ENC_GET, str_strlen(), T_REGEXP, T_STRING, and UNREACHABLE.

Referenced by rb_str_aref_m().

static VALUE rb_str_aref_m ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 3622 of file string.c.

References NUM2LONG, rb_check_arity, rb_str_aref(), rb_str_subpat(), rb_str_substr(), RB_TYPE_P, and T_REGEXP.

Referenced by Init_String(), rb_str_slice_bang(), and sym_aref().

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

Definition at line 3783 of file string.c.

References re_registers::beg, FIX2LONG, FIXNUM_P, INT2FIX, len, NUM2LONG, rb_eIndexError, rb_raise(), rb_range_beg_len(), rb_str_index(), rb_str_splice(), rb_str_sublen(), rb_str_subpat_set(), SPECIAL_CONST_P, str_strlen(), T_REGEXP, T_STRING, and TYPE.

Referenced by rb_str_aset_m().

static VALUE rb_str_aset_m ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 3850 of file string.c.

References NUM2LONG, rb_check_arity, rb_str_aset(), rb_str_splice(), rb_str_subpat_set(), RB_TYPE_P, and T_REGEXP.

Referenced by Init_String(), and rb_str_slice_bang().

void rb_str_associate ( VALUE  str,
VALUE  add 
)

Definition at line 1539 of file string.c.

References FL_SET, rb_ary_concat(), rb_check_frozen, RB_OBJ_WRITE, RBASIC_CLEAR_CLASS, RESIZE_CAPA, RSTRING, RSTRING_LEN, STR_ASSOC, STR_ASSOC_P, STR_EMBED_P, str_make_independent, STR_SHARED_P, and VALUE.

Referenced by pack_unpack().

VALUE rb_str_associated ( VALUE  str  ) 

Definition at line 1570 of file string.c.

References Qfalse, RSTRING, STR_ASSOC_P, and STR_SHARED_P.

Referenced by pack_unpack().

static VALUE rb_str_b ( VALUE  str  )  [static]

Definition at line 7908 of file string.c.

References ENC_CODERANGE_CLEAR, OBJ_INFECT, rb_cString, str_alloc(), and str_replace_shared_without_enc().

Referenced by Init_String().

VALUE rb_str_buf_append ( VALUE  str,
VALUE  str2 
)

Definition at line 2282 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, ENCODING_GET, OBJ_INFECT, rb_enc_cr_str_buf_cat(), RSTRING_LEN, and RSTRING_PTR.

Referenced by append_method(), ary_join_0(), ary_join_1(), env_inspect(), exc_inspect(), gc_profile_result(), inspect_ary(), inspect_i(), literal_concat0(), match_inspect(), method_inspect(), rb_digest_instance_inspect(), rb_file_join(), rb_reg_preprocess_dregexp(), rb_str_append(), str_gsub(), and strio_write().

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

Definition at line 2124 of file string.c.

References rb_eArgError, rb_raise(), and str_buf_cat().

Referenced by append_utf8(), appendline(), encodes(), env_inspect(), exc_inspect(), fill_envp_buf_i(), json_string_unescape(), load_file_read_contents_callback(), match_inspect(), pack_unpack(), parser_nextc(), qpencode(), rb_enc_cr_str_buf_cat(), rb_execarg_fixup(), rb_file_expand_path_internal(), rb_reg_expr_str(), rb_reg_to_s(), rb_str_buf_cat2(), rb_str_buf_cat_escaped_char(), rb_str_buf_new_cstr(), rb_str_cat(), rb_str_scrub(), unescape_escaped_nonascii(), unescape_nonascii(), w_nbyte(), zstream_append_buffer(), and zstream_append_input().

VALUE rb_str_buf_cat2 ( VALUE  str,
const char *  ptr 
)

Definition at line 2134 of file string.c.

References rb_str_buf_cat(), and strlen().

Referenced by addrinfo_inspect(), append_method(), env_inspect(), fill_envp_buf_i(), inspect_ary(), inspect_enumerator(), inspect_hash(), match_inspect(), method_inspect(), rb_digest_instance_inspect(), rb_enc_reg_error_desc(), rb_reg_desc(), rb_reg_to_s(), and rb_stat_inspect().

VALUE rb_str_buf_cat_ascii ( VALUE  str,
const char *  ptr 
)

Definition at line 2258 of file string.c.

References ALLOCA_N, buf, ENC_CODERANGE_7BIT, ENC_CODERANGE_VALID, ENCODING_GET, len, rb_enc_asciicompat, rb_enc_codelen(), rb_enc_cr_str_buf_cat(), rb_enc_from_index(), rb_enc_mbcput, rb_enc_mbmaxlen, and strlen().

Referenced by inspect_i(), prepare_getline_args(), and rb_reg_s_union().

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

Definition at line 4747 of file string.c.

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

Referenced by rb_reg_expr_str(), and rb_str_inspect().

VALUE rb_str_buf_new ( long  capa  ) 

Definition at line 891 of file string.c.

References ALLOC_N, FL_SET, rb_cString, RSTRING, str_alloc(), STR_BUF_MIN_SIZE, STR_NOEMBED, and VALUE.

Referenced by appendline(), copy_stream_body(), copy_stream_fallback_body(), gc_profile_result(), JSON_parse_string(), marshal_dump(), parser_nextc(), pst_to_s(), rb_ary_join(), rb_digest_instance_inspect(), rb_econv_append(), rb_enc_vsprintf(), rb_execarg_fixup(), rb_file_join(), rb_reg_preprocess(), rb_reg_regsub(), rb_reg_s_union(), rb_str_buf_new_cstr(), rb_str_format(), rb_str_inspect(), rb_str_scrub(), str_gsub(), zstream_append_buffer(), and zstream_append_input().

VALUE rb_str_buf_new_cstr ( const char *  ptr  ) 

Definition at line 907 of file string.c.

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

Referenced by rb_load_fail().

static VALUE rb_str_bytes ( VALUE  str  )  [static]

Definition at line 6669 of file string.c.

References rb_str_enumerate_bytes().

Referenced by Init_String().

static VALUE rb_str_bytesize ( VALUE  str  )  [static]

Definition at line 1317 of file string.c.

References LONG2NUM, and RSTRING_LEN.

Referenced by Init_String().

static VALUE rb_str_byteslice ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 4520 of file string.c.

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

Referenced by Init_String().

size_t rb_str_capacity ( VALUE  str  ) 

Definition at line 468 of file string.c.

References RSTRING, RSTRING_EMBED_LEN_MAX, STR_EMBED_P, and STR_NOCAPA_P.

Referenced by append_fspath(), dump_object(), econv_primitive_convert(), rb_econv_append(), rb_str_set_len(), rb_str_vcatf(), and str_fill_term().

static VALUE rb_str_capitalize ( VALUE  str  )  [static]

Definition at line 5268 of file string.c.

References rb_str_capitalize_bang(), and rb_str_dup().

Referenced by Init_String(), and sym_capitalize().

static VALUE rb_str_capitalize_bang ( VALUE  str  )  [static]

Definition at line 5220 of file string.c.

References Qnil, rb_enc_codepoint_len(), rb_enc_islower, rb_enc_isupper, rb_enc_mbcput, rb_enc_tolower(), rb_enc_toupper(), rb_str_check_dummy_enc(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, and str_modify_keep_cr().

Referenced by Init_String(), and rb_str_capitalize().

static VALUE rb_str_casecmp ( VALUE  str1,
VALUE  str2 
) [static]

Definition at line 2628 of file string.c.

References INT2FIX, len, memcmp(), Qnil, rb_enc_ascget(), rb_enc_compatible(), rb_enc_mbclen(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), StringValue, and TOUPPER.

Referenced by Init_String(), and sym_casecmp().

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

Definition at line 2140 of file string.c.

References rb_eArgError, rb_raise(), rb_str_buf_cat(), rb_str_modify_expand(), RSTRING, STR_ASSOC_P, TERM_FILL, and TERM_LEN.

Referenced by eval_string_with_cref(), flo_to_s(), inspect1(), inspect_range(), io_getc(), io_shift_cbuf(), moreswitches(), ole_excepinfo2msg(), parser_here_document(), process_sflag(), r_bytes1_buffered(), range_to_s(), rb_file_dirname(), rb_id2str(), rb_io_inspect(), rb_str_cat2(), rb_str_concat(), rb_str_ellipsize(), realpath_rec(), reg_compile_gen(), rsock_inspect_sockaddr(), and time_strftime().

VALUE rb_str_cat2 ( VALUE  str,
const char *  ptr 
)

Definition at line 2159 of file string.c.

References rb_str_cat(), and strlen().

Referenced by addrinfo_inspect(), argf_next_argv(), cannot_be_coerced_into_BigDecimal(), clsid_from_remote(), compile_err_append(), compile_snprintf(), compile_warn_print(), cState_aset(), dir_inspect(), econv_description(), econv_inspect(), f_format(), fc_path(), foleparam_inspect(), folevariable_inspect(), gzfile_error_inspect(), insn_data_to_s_detail(), inspect2(), inspect_i(), inspect_obj(), inspect_struct(), make_inspect(), make_version_str(), name_err_mesg_to_str(), nucomp_inspect(), nurat_inspect(), oldbt_print_to(), ole_excepinfo2msg(), ole_hresult2msg(), ole_raise(), oletypelib_path(), ossl_make_error(), ossl_ssl_get_state(), ossl_sslctx_set_ciphers(), ossl_x509_inspect(), path_check_0(), proc_options(), process_sflag(), pst_inspect(), pst_message(), rb_econv_open_exc(), rb_find_file_ext_safe(), rb_io_inspect(), rb_iseq_disasm(), rb_iseq_disasm_insn(), rb_load_fail(), rb_mod_to_s(), rb_set_class_path(), rb_set_class_path_string(), realpath_rec(), rsock_inspect_sockaddr(), search_required(), sockopt_inspect(), sys_fail2(), warn_print(), wmap_inspect(), and wmap_inspect_i().

static VALUE rb_str_center ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7708 of file string.c.

References rb_str_justify().

Referenced by Init_String().

static VALUE rb_str_chars ( VALUE  str  )  [static]

Definition at line 6775 of file string.c.

References rb_str_enumerate_chars().

Referenced by Init_String().

static void rb_str_check_dummy_enc ( rb_encoding enc  )  [static]

Definition at line 5031 of file string.c.

References rb_eEncCompatError, rb_enc_dummy_p(), rb_enc_name, and rb_raise().

Referenced by rb_str_capitalize_bang(), rb_str_downcase_bang(), rb_str_rstrip_bang(), rb_str_swapcase_bang(), and rb_str_upcase_bang().

static VALUE rb_str_chomp ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7073 of file string.c.

References rb_str_chomp_bang(), and rb_str_dup().

Referenced by Init_String().

static VALUE rb_str_chomp_bang ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 6953 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_CLEAR, is_broken_string, len, memcmp(), NIL_P, Qnil, rb_default_rs, rb_enc_ascget(), rb_enc_check(), rb_enc_get(), rb_enc_is_newline, rb_enc_left_char_head, rb_enc_mbminlen, rb_rs, rb_scan_args(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, STR_DEC_LEN, str_modify_keep_cr(), STR_SET_LEN, and StringValue.

Referenced by Init_String(), and rb_str_chomp().

static VALUE rb_str_chop ( VALUE  str  )  [static]

Definition at line 6938 of file string.c.

References chopped_length(), and rb_str_subseq().

Referenced by Init_String().

static VALUE rb_str_chop_bang ( VALUE  str  )  [static]

Definition at line 6903 of file string.c.

References chopped_length(), ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_CLEAR, len, Qnil, RSTRING_LEN, RSTRING_PTR, str_modify_keep_cr(), and STR_SET_LEN.

Referenced by Init_String().

static VALUE rb_str_chr ( VALUE  str  )  [static]

Definition at line 4359 of file string.c.

References rb_str_substr().

Referenced by Init_String().

static VALUE rb_str_clear ( VALUE  str  )  [static]

Definition at line 4335 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, rb_enc_asciicompat, RSTRING_PTR, str_discard(), STR_ENC_GET, STR_SET_EMBED, and STR_SET_EMBED_LEN.

Referenced by Init_String(), and rb_free_tmp_buffer().

int rb_str_cmp ( VALUE  str1,
VALUE  str2 
)

Definition at line 2486 of file string.c.

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

Referenced by ary2list(), ary2list2(), iseq_location_setup(), ole_method_event(), ole_search_event(), ole_search_event_at(), oleclass_from_typelib(), oletypelib_search_registry(), rb_digest_instance_equal(), rb_str_cmp_m(), rb_str_upto(), sort_2(), typeinfo_from_ole(), and typelib_file_from_typelib().

static VALUE rb_str_cmp_m ( VALUE  str1,
VALUE  str2 
) [static]

Definition at line 2596 of file string.c.

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

Referenced by Init_String(), and sym_cmp().

static VALUE rb_str_codepoints ( VALUE  str  )  [static]

Definition at line 6869 of file string.c.

References rb_str_enumerate_codepoints().

Referenced by Init_String().

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

Definition at line 340 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_UNKNOWN, ENC_CODERANGE_VALID, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, rb_enc_asciicompat, rb_enc_precise_mbclen(), rb_enc_to_index, and search_nonascii().

Referenced by fnmatch_brace(), rb_io_getline_fast(), rb_reg_expr_str(), rb_str_format(), read_all(), and str_encode_associate().

int rb_str_comparable ( VALUE  str1,
VALUE  str2 
)

Definition at line 2461 of file string.c.

References ENC_CODERANGE_7BIT, ENCODING_GET, FALSE, rb_enc_asciicompat, rb_enc_from_index(), rb_enc_str_coderange(), RSTRING_LEN, and TRUE.

Referenced by rb_str_cmp(), rb_str_hash_cmp(), and str_eql().

VALUE rb_str_concat ( VALUE  str1,
VALUE  str2 
)

Definition at line 2340 of file string.c.

References ALLOCA_N, buf, ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, FIX2LONG, FIXNUM_P, len, ONIGERR_INVALID_CODE_POINT_VALUE, ONIGERR_TOO_BIG_WIDE_CHAR_VALUE, rb_ascii8bit_encoding(), rb_enc_associate(), rb_enc_codelen(), rb_enc_mbcput, rb_enc_name, rb_enc_precise_mbclen(), rb_eRangeError, rb_num_to_uint(), rb_raise(), rb_str_append(), rb_str_cat(), rb_str_resize(), RB_TYPE_P, rb_usascii_encoding(), RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, and T_BIGNUM.

Referenced by clsid_from_remote(), cState_aref(), cState_aset(), f_format(), foleparam_inspect(), folevariable_inspect(), Init_String(), insn_data_to_s_detail(), iseq_compile_each(), make_inspect(), nucomp_inspect(), nurat_inspect(), ole_typedesc2val(), oletypelib_path(), pruby_eval(), rb_iseq_disasm(), rb_iseq_disasm_insn(), rb_mod_to_s(), and strio_ungetc().

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

Definition at line 680 of file string.c.

References Qnil, and rb_str_conv_enc_opts().

Referenced by append_fspath(), env_fetch(), env_str_new(), file_path_convert(), rb_external_str_with_enc(), rb_f_getenv(), rb_gzreader_ungetc(), rb_gzwriter_write(), rb_str_encode_ospath(), rb_str_export(), rb_str_export_locale(), rb_str_export_to_enc(), realpath_rec(), strio_ungetc(), and strio_write().

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

Definition at line 607 of file string.c.

References DATA_PTR, dp, econv_destination_buffer_full, econv_finished, is_ascii_string, len, LONG_MAX, OnigEncodingTypeST::name, OBJ_INFECT, rb_ascii8bit_encoding(), rb_cEncodingConverter, rb_econv_close(), rb_econv_convert(), rb_econv_open_opts(), rb_enc_asciicompat, rb_enc_associate(), rb_enc_get(), rb_gc_force_recycle(), rb_obj_alloc(), rb_str_dup(), rb_str_new(), rb_str_resize(), rb_str_set_len(), RBASIC_CLEAR_CLASS, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, and VALUE.

Referenced by gzfile_newstr(), rb_str_conv_enc(), rb_strftime_with_timespec(), rb_w32_conv_from_wchar(), rb_w32_write_console(), and ruby__sfvextra().

static VALUE rb_str_count ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 6058 of file string.c.

References FALSE, INT2FIX, INT2NUM, is_broken_string, ONIGENC_IS_ALLOWED_REVERSE_MATCH, rb_check_arity, rb_enc_asciicompat, rb_enc_check(), rb_enc_codepoint_len(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, StringValue, tr_find(), tr_setup_table(), TR_TABLE_SIZE, TRUE, and UNLIMITED_ARGUMENTS.

Referenced by Init_String().

static VALUE rb_str_crypt ( VALUE  str,
VALUE  salt 
) [static]

Definition at line 7410 of file string.c.

References crypt(), ISASCII, OBJ_INFECT, rb_eArgError, rb_raise(), rb_str_new2, rb_sys_fail(), result, RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_String().

static VALUE rb_str_delete ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 5878 of file string.c.

References rb_str_delete_bang(), and rb_str_dup().

Referenced by Init_String().

static VALUE rb_str_delete_bang ( int  ,
VALUE *  ,
VALUE   
) [static]

Definition at line 5802 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, Qnil, rb_check_arity, rb_enc_asciicompat, rb_enc_check(), rb_enc_codepoint_len(), rb_enc_mbcput, RSTRING_END, RSTRING_LEN, RSTRING_PTR, str_modify_keep_cr(), STR_SET_LEN, StringValue, tr_find(), tr_setup_table(), TR_TABLE_SIZE, and UNLIMITED_ARGUMENTS.

Referenced by Init_String(), rb_str_delete(), and tr_trans().

static VALUE rb_str_downcase ( VALUE  str  )  [static]

Definition at line 5197 of file string.c.

References rb_str_downcase_bang(), and rb_str_dup().

Referenced by Init_String(), and sym_downcase().

static VALUE rb_str_downcase_bang ( VALUE  str  )  [static]

Definition at line 5132 of file string.c.

References Qnil, rb_enc_asciicompat, rb_enc_codepoint_len(), rb_enc_isascii, rb_enc_isupper, rb_enc_mbcput, rb_enc_tolower(), rb_str_check_dummy_enc(), RSTRING_END, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, and str_modify_keep_cr().

Referenced by Init_String(), and rb_str_downcase().

VALUE rb_str_drop_bytes ( VALUE  str,
long  len 
)

Definition at line 3635 of file string.c.

References ELTS_SHARED, ENC_CODERANGE_CLEAR, memmove(), rb_str_new4, RBASIC, RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_LEN, RSTRING_PTR, str_modifiable(), STR_NOEMBED, STR_SET_EMBED, STR_SET_EMBED_LEN, STR_SHARED_P, and xfree.

Referenced by econv_primitive_convert(), rb_str_splice_0(), and rb_str_subseq().

VALUE rb_str_dump ( VALUE  str  ) 

Definition at line 4899 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, IS_EVSTR, ISPRINT, len, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, OnigEncodingTypeST::name, OBJ_INFECT, rb_ascii8bit_encoding(), rb_enc_asciicompat, rb_enc_associate(), rb_enc_get(), rb_enc_mbc_to_codepoint, rb_enc_precise_mbclen(), rb_str_new5, rb_utf8_encoding(), result, RSTRING_LEN, RSTRING_PTR, snprintf, and strlen().

Referenced by Init_String(), inspect1(), inspect2(), make_econv_exception(), rb_econv_prepare_options(), and sockopt_inspect().

VALUE rb_str_dup ( VALUE  str  ) 

Definition at line 1062 of file string.c.

References rb_obj_class(), and str_duplicate().

Referenced by cannot_be_coerced_into_BigDecimal(), convert_encoding(), cParser_source(), cState_aset(), dir_path(), econv_convert(), encoded_dup(), eval_string_with_cref(), exc_inspect(), fc_path(), fdbm_delete_if(), fgdbm_delete_if(), fsdbm_delete_if(), gettable_gen(), inspect_range(), make_inspectname(), name_err_mesg_to_str(), process_options(), range_to_s(), rb_class_path(), rb_class_path_no_cache(), rb_deflate_init_copy(), rb_file_path(), rb_find_file_ext_safe(), rb_gzfile_comment(), rb_gzfile_orig_name(), rb_gzfile_set_comment(), rb_gzfile_set_orig_name(), rb_id2str(), rb_insn_operand_intern(), rb_intern_str(), rb_mod_name(), rb_mod_to_s(), rb_set_class_path(), rb_set_class_path_string(), rb_str_aref(), rb_str_capitalize(), rb_str_chomp(), rb_str_conv_enc_opts(), rb_str_delete(), rb_str_downcase(), rb_str_justify(), rb_str_lstrip(), rb_str_reverse(), rb_str_rstrip(), rb_str_squeeze(), rb_str_strip(), rb_str_sub(), rb_str_swapcase(), rb_str_tr(), rb_str_tr_s(), rb_str_upcase(), rb_str_upto(), realpath_rec(), rsock_ipaddr(), ruby_set_script_name(), str_gsub(), and str_scrub().

static VALUE rb_str_each_byte ( VALUE  str  )  [static]

Definition at line 6652 of file string.c.

References rb_str_enumerate_bytes().

Referenced by Init_String().

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

Definition at line 6595 of file string.c.

References LONG2FIX, and RSTRING_LEN.

Referenced by rb_str_enumerate_bytes().

static VALUE rb_str_each_char ( VALUE  str  )  [static]

Definition at line 6758 of file string.c.

References rb_str_enumerate_chars().

Referenced by Init_String().

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

Definition at line 6675 of file string.c.

References rb_str_length().

Referenced by rb_str_enumerate_chars(), and rb_str_enumerate_codepoints().

static VALUE rb_str_each_codepoint ( VALUE  str  )  [static]

Definition at line 6851 of file string.c.

References rb_str_enumerate_codepoints().

Referenced by Init_String().

static VALUE rb_str_each_line ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 6571 of file string.c.

References rb_str_enumerate_lines().

Referenced by Init_String().

VALUE rb_str_ellipsize ( VALUE  str,
long  len 
)

Shortens _str_ and adds three dots, an ellipsis, if it is longer than _len_ characters.

Parameters:
str the string to ellipsize.
len the 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 7969 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 rb_hash_fetch_m(), and sys_fail2().

static VALUE rb_str_empty ( VALUE  str  )  [static]

Definition at line 1334 of file string.c.

References Qfalse, Qtrue, and RSTRING_LEN.

Referenced by Init_String(), and sym_empty().

static VALUE rb_str_end_with ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7852 of file string.c.

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

Referenced by Init_String().

static VALUE rb_str_enumerate_bytes ( VALUE  str,
int  wantarray 
) [static]

Definition at line 6601 of file string.c.

References INT2FIX, rb_ary_new(), rb_ary_new2, rb_ary_push(), rb_block_given_p(), rb_str_each_byte_size(), rb_warn(), rb_warning(), rb_yield(), RETURN_SIZED_ENUMERATOR, RSTRING_LEN, RSTRING_PTR, and UNINITIALIZED_VAR.

Referenced by rb_str_bytes(), rb_str_each_byte(), and rb_str_enumerate_codepoints().

static VALUE rb_str_enumerate_chars ( VALUE  str,
int  wantarray 
) [static]

Definition at line 6681 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_VALID, len, rb_ary_new_capa(), rb_ary_push(), rb_block_given_p(), rb_enc_fast_mbclen(), rb_enc_get(), rb_enc_mbclen(), RB_GC_GUARD, rb_str_each_char_size(), rb_str_new4, rb_str_subseq(), rb_warn(), rb_warning(), rb_yield(), RETURN_SIZED_ENUMERATOR, RSTRING_LEN, RSTRING_PTR, str_strlen(), and UNINITIALIZED_VAR.

Referenced by rb_str_chars(), and rb_str_each_char().

static VALUE rb_str_enumerate_codepoints ( VALUE  str,
int  wantarray 
) [static]

Definition at line 6782 of file string.c.

References re_registers::end, rb_ary_new_capa(), rb_ary_push(), rb_block_given_p(), rb_enc_codepoint_len(), RB_GC_GUARD, rb_str_each_char_size(), rb_str_enumerate_bytes(), rb_str_new4, rb_warn(), rb_warning(), rb_yield(), RETURN_SIZED_ENUMERATOR, RSTRING_END, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, str_strlen(), UINT2NUM, and UNINITIALIZED_VAR.

Referenced by rb_str_codepoints(), and rb_str_each_codepoint().

static VALUE rb_str_enumerate_lines ( int  argc,
VALUE *  argv,
VALUE  str,
int  wantarray 
) [static]

Definition at line 6422 of file string.c.

References len, NIL_P, Qnil, rb_ary_new(), rb_ary_push(), rb_block_given_p(), rb_default_rs, rb_enc_asciicompat, rb_enc_check(), rb_enc_from_encoding(), rb_enc_get(), rb_enc_is_newline, rb_enc_mbclen(), rb_enc_right_char_head, RB_GC_GUARD, rb_memsearch(), rb_rs, rb_scan_args(), rb_str_encode(), rb_str_new(), rb_str_new4, rb_str_subseq(), rb_warn(), rb_warning(), rb_yield(), RETURN_ENUMERATOR, RSTRING_END, RSTRING_LEN, RSTRING_PTR, str_mod_check(), StringValue, and UNINITIALIZED_VAR.

Referenced by rb_str_each_line(), and rb_str_lines().

static VALUE rb_str_eql ( VALUE  str1,
VALUE  str2 
) [static]

Definition at line 2563 of file string.c.

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

Referenced by Init_String().

VALUE rb_str_equal ( VALUE  str1,
VALUE  str2 
)

Definition at line 2543 of file string.c.

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

Referenced by init_addrinfo_getaddrinfo(), Init_String(), match_equal(), opt_eq_func(), path_eq(), rb_get_expanded_load_path(), and rb_str_upto().

VALUE rb_str_export ( VALUE  str  ) 

Definition at line 743 of file string.c.

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

VALUE rb_str_export_locale ( VALUE  str  ) 

Definition at line 749 of file string.c.

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

VALUE rb_str_export_to_enc ( VALUE  str,
rb_encoding enc 
)

Definition at line 755 of file string.c.

References rb_str_conv_enc(), and STR_ENC_GET.

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

void rb_str_fill_terminator ( VALUE  str,
const int  newminlen 
)

Definition at line 1670 of file string.c.

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

Referenced by rb_enc_associate_index().

static VALUE rb_str_force_encoding ( VALUE  str,
VALUE  enc 
) [static]

Definition at line 7892 of file string.c.

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

Referenced by Init_String().

static VALUE rb_str_format_m ( VALUE  str,
VALUE  arg 
) [static]

Definition at line 1432 of file string.c.

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

Referenced by Init_String().

void rb_str_free ( VALUE  str  ) 

Definition at line 941 of file string.c.

References FL_TEST, frozen_strings, NULL, RSTRING_FSTR, ruby_sized_xfree(), st_data_t, st_delete(), STR_EMBED_P, STR_HEAP_PTR, STR_HEAP_SIZE, and STR_SHARED_P.

Referenced by dispose_string(), and obj_free().

VALUE rb_str_freeze ( VALUE  str  ) 

Definition at line 1968 of file string.c.

References OBJ_FREEZE, rb_obj_freeze(), RSTRING, and STR_ASSOC_P.

Referenced by get_loaded_features_index(), path_freeze(), rb_construct_expanded_load_path(), rb_provide_feature(), and ruby_init_loadpath_safe().

static VALUE rb_str_getbyte ( VALUE  str,
VALUE  index 
) [static]

Definition at line 4371 of file string.c.

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

Referenced by Init_String().

static VALUE rb_str_gsub ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 4296 of file string.c.

References str_gsub().

Referenced by Init_String().

static VALUE rb_str_gsub_bang ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 4245 of file string.c.

References str_gsub(), and str_modify_keep_cr().

Referenced by Init_String().

st_index_t rb_str_hash ( VALUE  str  ) 

Definition at line 2422 of file string.c.

References ENC_CODERANGE_7BIT, ENCODING_GET, rb_enc_str_coderange(), rb_memhash(), RSTRING_LEN, and RSTRING_PTR.

Referenced by cdhash_hash(), match_hash(), path_hash(), rb_any_hash(), and rb_str_hash_m().

int rb_str_hash_cmp ( VALUE  str1,
VALUE  str2 
)

Definition at line 2432 of file string.c.

References len, memcmp(), rb_str_comparable(), RSTRING_LEN, and RSTRING_PTR.

Referenced by cdhash_cmp(), fstring_cmp(), and rb_any_cmp().

static VALUE rb_str_hash_m ( VALUE  str  )  [static]

Definition at line 2452 of file string.c.

References INT2FIX, and rb_str_hash().

Referenced by Init_String().

static VALUE rb_str_hex ( VALUE  str  )  [static]

Definition at line 7365 of file string.c.

References FALSE, and rb_str_to_inum().

Referenced by Init_String().

static VALUE rb_str_include ( VALUE  str,
VALUE  arg 
) [static]

Definition at line 4642 of file string.c.

References Qfalse, Qtrue, rb_str_index(), and StringValue.

Referenced by Init_String().

static long rb_str_index ( VALUE  str,
VALUE  sub,
long  offset 
) [static]

Definition at line 2686 of file string.c.

References is_broken_string, len, rb_enc_check(), rb_enc_right_char_head, rb_memsearch(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), str_offset(), and str_strlen().

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

static VALUE rb_str_index_m ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 2748 of file string.c.

References BUILTIN_TYPE, LONG2NUM, NIL_P, NUM2LONG, Qnil, rb_backref_set(), rb_check_string_type(), rb_enc_check(), rb_eTypeError, rb_obj_classname(), rb_raise(), rb_reg_search(), rb_scan_args(), rb_str_index(), rb_str_sublen(), RB_TYPE_P, RSTRING_END, RSTRING_PTR, single_byte_optimizable(), SPECIAL_CONST_P, STR_ENC_GET, str_offset(), str_strlen(), sub, T_REGEXP, and T_STRING.

Referenced by Init_String().

static VALUE rb_str_init ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 1085 of file string.c.

References rb_scan_args(), rb_str_replace(), and VALUE.

Referenced by Init_String().

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

Definition at line 3883 of file string.c.

References NUM2LONG, rb_str_append(), and rb_str_splice().

Referenced by Init_String().

VALUE rb_str_inspect ( VALUE  str  ) 

Definition at line 4792 of file string.c.

References buf, CHAR_ESC_LEN, ENCODING_GET, get_actual_encoding(), ISPRINT, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, NULL, OBJ_INFECT, prev, rb_default_external_encoding(), rb_default_internal_encoding(), rb_enc_asciicompat, rb_enc_associate(), rb_enc_codepoint, rb_enc_from_index(), rb_enc_isascii, rb_enc_isprint, rb_enc_mbc_to_codepoint, rb_enc_mbminlen, rb_enc_precise_mbclen(), rb_enc_unicode_p(), rb_str_buf_cat_escaped_char(), rb_str_buf_new(), rb_usascii_encoding(), result, RSTRING_END, RSTRING_PTR, snprintf, str_buf_cat(), str_buf_cat2, and strlen().

Referenced by check_path_encoding(), gzfile_error_inspect(), id_to_name(), Init_String(), location_inspect_m(), match_inspect(), rb_str_quote_unprintable(), rsock_syserr_fail_path(), and sym_inspect().

VALUE rb_str_intern ( VALUE  s  ) 

Definition at line 7467 of file string.c.

References id, ID2SYM, RB_GC_GUARD, and rb_intern_str.

Referenced by hash2ptr_dispparams(), hash2result(), Init_String(), JSON_parse_string(), set_state_ivars(), sym_capitalize(), sym_downcase(), sym_each_i(), sym_step_i(), sym_succ(), sym_swapcase(), and sym_upcase().

static VALUE rb_str_is_ascii_only_p ( VALUE  str  )  [static]

Definition at line 7947 of file string.c.

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

Referenced by Init_String(), rb_str_quote_unprintable(), and rb_str_symname_p().

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

Definition at line 7564 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_AND, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, f, len, LONG_MAX, NIL_P, NUM2LONG, OBJ_INFECT, rb_eArgError, rb_enc_associate(), rb_enc_check(), rb_raise(), rb_scan_args(), rb_str_dup(), rb_str_new5, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), size, STR_ENC_GET, str_offset(), STR_SET_LEN, str_strlen(), and StringValue.

Referenced by rb_str_center(), rb_str_ljust(), and rb_str_rjust().

VALUE rb_str_length ( VALUE  str  ) 

Definition at line 1298 of file string.c.

References len, LONG2NUM, STR_ENC_GET, and str_strlen().

Referenced by Init_String(), rb_str_each_char_size(), reg_match_pos(), strscan_get_charpos(), and sym_length().

static VALUE rb_str_lines ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 6589 of file string.c.

References rb_str_enumerate_lines().

Referenced by Init_String().

static VALUE rb_str_ljust ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7668 of file string.c.

References rb_str_justify().

Referenced by Init_String().

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

Definition at line 2001 of file string.c.

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

Referenced by io_fread(), and io_getpartial().

static VALUE rb_str_lstrip ( VALUE  str  )  [static]

Definition at line 7134 of file string.c.

References rb_str_dup(), and rb_str_lstrip_bang().

Referenced by Init_String().

static VALUE rb_str_lstrip_bang ( VALUE  str  )  [static]

Definition at line 7093 of file string.c.

References memmove(), Qnil, rb_enc_codepoint_len(), rb_isspace(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, str_modify_keep_cr(), and STR_SET_LEN.

Referenced by Init_String(), rb_str_lstrip(), and rb_str_strip_bang().

static VALUE rb_str_match ( VALUE  x,
VALUE  y 
) [static]

Definition at line 2990 of file string.c.

References BUILTIN_TYPE, rb_eTypeError, rb_funcall(), rb_intern, rb_raise(), rb_reg_match(), SPECIAL_CONST_P, T_REGEXP, and T_STRING.

Referenced by Init_String(), and sym_match().

static VALUE rb_str_match_m ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 3040 of file string.c.

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

Referenced by Init_String().

RUBY_FUNC_EXPORTED size_t rb_str_memsize ( VALUE  str  ) 

Definition at line 953 of file string.c.

References ELTS_SHARED, FL_TEST, STR_HEAP_SIZE, and STR_NOEMBED.

Referenced by obj_memsize_of().

void rb_str_modify ( VALUE  str  ) 

Definition at line 1484 of file string.c.

References ENC_CODERANGE_CLEAR, str_independent(), and str_make_independent.

Referenced by econv_primitive_convert(), io_set_read_length(), io_setstrbuf(), ossl_ssl_read_internal(), rb_file_expand_path_internal(), rb_str_setbyte(), rb_str_splice_0(), rb_str_sub_bang(), rb_str_vcatf(), rb_string_value_cstr(), setup_narg(), str_buf_cat(), string_to_c(), string_to_c_strict(), string_to_r(), string_to_r_strict(), strio_extend(), strio_read(), and strio_ungetbyte().

void rb_str_modify_expand ( VALUE  str,
long  expand 
)

Definition at line 1492 of file string.c.

References ENC_CODERANGE_CLEAR, len, rb_eArgError, rb_raise(), REALLOC_N, RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_LEN, STR_EMBED_P, str_independent(), str_make_independent_expand(), STR_UNSET_NOCAPA, and TERM_LEN.

Referenced by io_setstrbuf(), rb_str_append(), rb_str_cat(), read_all(), and str_fill_term().

VALUE rb_str_new ( const char *  ptr,
long  len 
)

Definition at line 534 of file string.c.

References rb_cString, and str_new().

Referenced by 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(), decode_bstr(), decode_eoc(), dir_s_home(), econv_convert(), econv_description(), econv_finish(), econv_primitive_errinfo(), econv_putback(), env_fetch(), env_str_new(), extract_user_token(), gzfile_getc(), gzfile_read(), gzfile_read_all(), gzfile_read_header(), gzfile_readpartial(), gzreader_gets(), infected_str_new(), inspect1(), inspect2(), int_chr(), int_ossl_asn1_decode0_prim(), io_getc(), io_setstrbuf(), io_shift_cbuf(), join_der(), lib_conv_listelement(), lib_fromUTF8_core(), lib_merge_tklist(), lib_toUTF8_core(), lib_UTF_backslash_core(), load_file_internal(), load_file_read_contents(), load_transcoder_entry(), make_econv_exception(), match_to_s(), Messaging_HandleMessage(), name_to_backref_number(), ossl_asn1cons_to_der(), ossl_asn1data_to_der(), ossl_asn1eoc_initialize(), ossl_bn_to_s(), ossl_cipher_final(), ossl_cipher_update(), ossl_dh_compute_key(), ossl_dh_to_der(), ossl_digest_finish(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_hmac_s_digest(), ossl_make_error(), ossl_membio2str0(), ossl_pkcs12_to_der(), ossl_pkcs7_to_der(), ossl_pkey_sign(), ossl_rand_bytes(), ossl_rand_pseudo_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_print(), ossl_spki_to_der(), ossl_ssl_read_internal(), ossl_ssl_session_to_der(), ossl_ssl_session_to_pem(), ossl_ssl_session_to_text(), 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_x509crl_get_signature_algorithm(), ossl_x509crl_to_der(), ossl_x509crl_to_pem(), ossl_x509crl_to_text(), ossl_x509ext_to_der(), ossl_x509name_to_a(), ossl_x509name_to_der(), ossl_x509req_get_signature_algorithm(), ossl_x509req_to_der(), ossl_x509req_to_pem(), ossl_x509req_to_text(), parse(), proc_options(), r_bytes0(), r_bytes1_buffered(), rb_compile_cstr(), rb_digest_base_finish(), rb_enc_str_new(), rb_exc_new(), rb_execarg_fixup(), rb_execarg_run_options(), rb_f_backquote(), rb_f_getenv(), 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_path_check(), rb_random_bytes(), rb_reg_compile(), rb_reg_quote(), rb_str_conv_enc_opts(), rb_str_enumerate_lines(), rb_str_format(), rb_str_new_cstr(), rb_str_plus(), rb_str_slice_bang(), rb_tainted_str_new(), rb_usascii_str_new(), rb_write_error2(), reg_named_captures_iter(), reg_names_iter(), rsock_addrinfo_inspect_sockaddr(), ruby_init_loadpath_safe(), set_file_encoding(), set_option_encoding_once(), sock_s_gethostbyaddr(), sock_s_pack_sockaddr_in(), sock_sockaddr(), sockopt_s_bool(), sockopt_s_byte(), sockopt_s_int(), sockopt_s_ipv4_multicast_loop(), sockopt_s_ipv4_multicast_ttl(), sockopt_s_linger(), str_new(), strio_getline(), strio_putc(), strio_read(), strio_substr(), time_mdump(), time_strftime(), tkstr_to_str(), warn_print(), writer(), zstream_detach_buffer(), zstream_detach_input(), and zstream_expand_buffer_into().

VALUE rb_str_new_cstr ( const char *  ptr  ) 

Definition at line 560 of file string.c.

References rb_eArgError, rb_raise(), rb_str_new(), and strlen().

Referenced by addrinfo_mdump(), decorate_convpath(), dir_inspect(), dump_output(), econv_convpath(), finish_writeconv(), gc_profile_dump_on(), hist_to_s(), Init_readline(), inspect1(), load_file_internal(), opobj_inspect(), ossl_make_error(), prep_io(), process_options(), pty_getpty(), pty_open(), rand_random(), rb_econv_open_exc(), rb_file_open(), rb_io_inspect(), rb_io_s_binread(), rb_iseq_defined_string(), rb_load_file(), rb_parser_dump_tree(), rb_path2class(), rb_strftime_with_timespec(), ruby_eval_string_from_file(), ruby_eval_string_from_file_protect(), ruby_init_loadpath_safe(), search_convpath_i(), sig_signame(), and sys_fail2().

VALUE rb_str_new_frozen ( VALUE  orig  ) 

Definition at line 833 of file string.c.

References assert, ENCODING_GET, FL_SET, FL_TAINT, FL_UNSET, OBJ_FREEZE, OBJ_FROZEN, OBJ_INFECT, rb_enc_cr_str_exact_copy(), rb_obj_class(), RB_OBJ_WRITE, RBASIC, RSTRING, RSTRING_LEN, RSTRING_PTR, STR_ASSOC, STR_ASSOC_P, STR_EMBED_P, str_new(), str_new3(), str_new4(), STR_SHARED_P, and VALUE.

Referenced by fstr_update_callback(), hash_aset_str(), io_write(), rb_check_argv(), rb_econv_prepare_options(), rb_econv_substr_append(), rb_file_open_generic(), rb_io_reopen(), rb_io_syswrite(), rb_set_class_path_string(), rb_str_subseq(), set_arg0(), str_replace_shared_without_enc(), time_mload(), and yycompile().

VALUE rb_str_new_shared ( VALUE  str  ) 

Definition at line 799 of file string.c.

References OBJ_INFECT, rb_obj_class(), str_new3(), and VALUE.

Referenced by rb_file_s_basename(), and rb_str_subseq().

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

Definition at line 874 of file string.c.

References rb_obj_class(), and str_new().

Referenced by rb_str_ellipsize().

static VALUE rb_str_oct ( VALUE  str  )  [static]

Definition at line 7386 of file string.c.

References FALSE, and rb_str_to_inum().

Referenced by Init_String().

long rb_str_offset ( VALUE  str,
long  pos 
)

Definition at line 1781 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().

VALUE rb_str_ord ( VALUE  s  ) 

Definition at line 7487 of file string.c.

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

Referenced by Init_String().

static VALUE rb_str_partition ( VALUE  str,
VALUE  sep 
) [static]

Definition at line 7729 of file string.c.

References FALSE, INT2FIX, NIL_P, rb_ary_new3, rb_check_string_type(), rb_eTypeError, rb_obj_classname(), rb_raise(), rb_reg_search(), rb_str_index(), rb_str_subpat(), rb_str_subseq(), RB_TYPE_P, RSTRING_LEN, str_new_empty(), T_REGEXP, and TRUE.

Referenced by Init_String().

VALUE rb_str_plus ( VALUE  str1,
VALUE  str2 
)

Definition at line 1352 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_AND, ENCODING_CODERANGE_SET, OBJ_TAINT, OBJ_TAINTED, rb_enc_check(), rb_enc_to_index, rb_str_new(), RSTRING_LEN, RSTRING_PTR, StringValue, and VALUE.

Referenced by Init_String().

static VALUE rb_str_prepend ( VALUE  str,
VALUE  str2 
) [static]

Definition at line 2413 of file string.c.

References rb_str_update(), and StringValue.

Referenced by Init_String().

VALUE rb_str_quote_unprintable ( VALUE  str  ) 

Definition at line 8400 of file string.c.

References Check_Type, len, NULL, rb_default_external_encoding(), rb_default_internal_encoding(), rb_str_inspect(), rb_str_is_ascii_only_p(), RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, sym_printable(), and T_STRING.

Referenced by rb_id_quote_unprintable().

VALUE rb_str_replace ( VALUE  str,
VALUE  str2 
)

Definition at line 4314 of file string.c.

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

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

VALUE rb_str_resize ( VALUE  str,
long  len 
)

Definition at line 2025 of file string.c.

References ENC_CODERANGE_CLEAR, MEMCPY, rb_eArgError, rb_raise(), REALLOC_N, RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_LEN, ruby_xfree(), STR_EMBED_P, STR_HEAP_PTR, str_independent(), str_make_independent_expand(), STR_SET_EMBED, STR_SET_EMBED_LEN, STR_SET_NOEMBED, 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(), copy_home_path(), copy_stream_body(), copy_stream_fallback_body(), econv_primitive_convert(), flo_to_s(), get_user_from_path(), gzfile_error_inspect(), gzfile_readpartial(), lib_conv_listelement(), literal_concat0(), marshal_dump(), moreswitches(), ossl_cipher_update(), ossl_digest_finish(), ossl_ssl_read_internal(), r_object0(), rb_big2str0(), rb_econv_append(), rb_enc_vsprintf(), rb_feature_p(), rb_file_expand_path_internal(), rb_gzfile_set_comment(), rb_gzfile_set_orig_name(), rb_io_getline_fast(), rb_iseq_disasm(), rb_nkf_putchar(), rb_reg_quote(), rb_reg_to_s(), rb_str_concat(), rb_str_conv_enc_opts(), rb_str_format(), rb_str_vcatf(), realpath_rec(), ruby_init_loadpath_safe(), ruby_setenv(), set_file_encoding(), setup_narg(), str_shrink(), str_transcoding_resize(), strio_extend(), strio_init(), strio_read(), strio_truncate(), strio_ungetbyte(), strio_ungetc(), sym_inspect(), VpAlloc(), w_nbyte(), yyparse(), zstream_append_buffer(), zstream_detach_buffer(), zstream_discard_input(), zstream_expand_buffer(), and zstream_expand_buffer_into().

VALUE rb_str_resurrect ( VALUE  str  ) 

Definition at line 1068 of file string.c.

References rb_cString, rb_sourcefile, rb_sourceline(), RSTRING_LEN, RUBY_DTRACE_STRING_CREATE, RUBY_DTRACE_STRING_CREATE_ENABLED, and str_duplicate().

Referenced by gzfile_raise(), gzfile_reader_get_unused(), and obj_resurrect().

static VALUE rb_str_reverse ( VALUE  str  )  [static]

Definition at line 4539 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_UNKNOWN, ENC_CODERANGE_VALID, OBJ_INFECT, rb_enc_cr_str_copy_for_substr(), rb_enc_fast_mbclen(), rb_enc_mbclen(), rb_str_dup(), rb_str_new5, RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, and STR_SET_LEN.

Referenced by Init_String(), and rb_str_reverse_bang().

static VALUE rb_str_reverse_bang ( VALUE  str  )  [static]

Definition at line 4603 of file string.c.

References rb_str_reverse(), rb_str_shared_replace(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), and str_modify_keep_cr().

Referenced by Init_String().

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

Definition at line 2862 of file string.c.

References is_broken_string, len, memcmp(), rb_enc_check(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), str_nth(), str_rindex(), and str_strlen().

Referenced by rb_str_rindex_m(), and rb_str_rpartition().

static VALUE rb_str_rindex_m ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 2913 of file string.c.

References BUILTIN_TYPE, len, LONG2NUM, NIL_P, NUM2LONG, Qnil, rb_backref_set(), rb_check_string_type(), rb_eTypeError, rb_obj_classname(), rb_raise(), rb_reg_search(), rb_scan_args(), rb_str_rindex(), rb_str_sublen(), RB_TYPE_P, RREGEXP, RREGEXP_SRC_LEN, RSTRING_END, RSTRING_PTR, single_byte_optimizable(), SPECIAL_CONST_P, STR_ENC_GET, str_offset(), str_strlen(), T_REGEXP, and T_STRING.

Referenced by Init_String().

static VALUE rb_str_rjust ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7688 of file string.c.

References rb_str_justify().

Referenced by Init_String().

static VALUE rb_str_rpartition ( VALUE  str,
VALUE  sep 
) [static]

Definition at line 7779 of file string.c.

References FALSE, NIL_P, rb_ary_new3, rb_backref_get(), rb_check_string_type(), rb_eTypeError, rb_obj_classname(), rb_raise(), rb_reg_nth_match(), rb_reg_search(), rb_str_offset(), rb_str_rindex(), rb_str_sublen(), rb_str_subseq(), RB_TYPE_P, RSTRING_LEN, str_new_empty(), T_REGEXP, and TRUE.

Referenced by Init_String().

static VALUE rb_str_rstrip ( VALUE  str  )  [static]

Definition at line 7204 of file string.c.

References rb_str_dup(), and rb_str_rstrip_bang().

Referenced by Init_String().

static VALUE rb_str_rstrip_bang ( VALUE  str  )  [static]

Definition at line 7155 of file string.c.

References ascii_isspace, len, NULL, Qnil, rb_enc_codepoint, rb_enc_prev_char, rb_isspace(), rb_str_check_dummy_enc(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, str_modify_keep_cr(), and STR_SET_LEN.

Referenced by Init_String(), rb_str_rstrip(), and rb_str_strip_bang().

static VALUE rb_str_s_try_convert ( VALUE  dummy,
VALUE  str 
) [static]

Definition at line 1697 of file string.c.

References rb_check_string_type().

Referenced by Init_String().

static VALUE rb_str_scan ( VALUE  str,
VALUE  pat 
) [static]

Definition at line 7319 of file string.c.

References get_pat(), last, len, NIL_P, prev, rb_ary_new(), rb_ary_push(), rb_block_given_p(), rb_reg_search(), rb_yield(), result, RSTRING_LEN, RSTRING_PTR, scan_once(), and str_mod_check().

Referenced by Init_String().

VALUE rb_str_scrub ( VALUE  str,
VALUE  repl 
)

Parameters:
str the string to be scrubbed
repl the replacement character
Returns:
If given string is invalid, returns a new string. Otherwise, returns Qnil.

Definition at line 8037 of file string.c.

References buf, DEFAULT_REPLACE_CHAR, ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, ENCODING_CODERANGE_SET, FALSE, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, MBCLEN_NEEDMORE_P, NIL_P, NULL, Qnil, rb_block_given_p(), rb_enc_asciicompat, rb_enc_dummy_p(), rb_enc_mbmaxlen, rb_enc_mbminlen, rb_enc_precise_mbclen(), rb_enc_str_new(), rb_enc_to_index, rb_str_buf_cat(), rb_str_buf_new(), rb_utf8_encindex, rb_yield(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, search_nonascii(), str_compat_and_valid(), STR_ENC_GET, TRUE, and UNREACHABLE.

Referenced by str_scrub(), str_scrub_bang(), and str_transcode0().

void rb_str_set_len ( VALUE  str,
long  len 
)

Definition at line 2008 of file string.c.

References rb_bug(), rb_eRuntimeError, rb_raise(), rb_str_capacity(), RSTRING_PTR, str_modifiable(), STR_SET_LEN, STR_SHARED_P, TERM_FILL, and TERM_LEN.

Referenced by appendline(), econv_primitive_convert(), io_set_read_length(), load_transcoder_entry(), ole_wc2vstr(), ossl_cipher_final(), ossl_cipher_update(), ossl_dh_compute_key(), ossl_dsa_sign(), ossl_pkey_sign(), ossl_rsa_private_decrypt(), ossl_rsa_private_encrypt(), ossl_rsa_public_decrypt(), ossl_rsa_public_encrypt(), ossl_ssl_read_internal(), ossl_x509attr_to_der(), pack_unpack(), r_object0(), rb_econv_append(), rb_execarg_fixup(), rb_execarg_run_options(), rb_file_expand_path_internal(), rb_file_join(), rb_find_file_ext_safe(), rb_nkf_convert(), rb_realpath_internal(), rb_str_conv_enc_opts(), rb_str_format(), read_all(), rsock_s_recvfrom(), rsock_s_recvfrom_nonblock(), ruby__sfvwrite(), and str_transcode0().

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

Definition at line 4390 of file string.c.

References NUM2INT, NUM2LONG, rb_eIndexError, rb_raise(), rb_str_modify(), RSTRING_LEN, and RSTRING_PTR.

Referenced by Init_String().

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

Definition at line 7875 of file string.c.

References NIL_P, rb_eTypeError, rb_id2name(), rb_raise(), RB_TYPE_P, and T_STRING.

Referenced by Init_IO().

void rb_str_shared_replace ( VALUE  str,
VALUE  str2 
)

Definition at line 972 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, FL_SET, OBJ_INFECT, rb_enc_associate(), RB_OBJ_WRITE, RBASIC, RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_LEN, RSTRING_PTR, str_discard(), STR_ENC_GET, STR_NOCAPA, STR_NOCAPA_P, STR_SET_EMBED, STR_SET_EMBED_LEN, STR_SET_NOEMBED, STR_UNSET_NOCAPA, and VALUE.

Referenced by rb_str_reverse_bang(), rb_str_succ_bang(), str_encode_bang(), and str_gsub().

static VALUE rb_str_slice_bang ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 3918 of file string.c.

References 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().

static void rb_str_splice ( VALUE  str,
long  beg,
long  len,
VALUE  val 
) [static]

Definition at line 3696 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_AND, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, rb_eIndexError, rb_enc_associate(), rb_enc_check(), rb_raise(), rb_str_splice_0(), RSTRING_END, RSTRING_PTR, single_byte_optimizable(), str_modify_keep_cr(), str_nth(), str_strlen(), and StringValue.

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

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

Definition at line 3663 of file string.c.

References memmove(), MEMZERO, OBJ_INFECT, rb_str_drop_bytes(), rb_str_modify(), RESIZE_CAPA, RSTRING_LEN, RSTRING_PTR, STR_SET_LEN, and TERM_LEN.

Referenced by rb_str_splice(), and rb_str_subpat_set().

VALUE rb_str_split ( VALUE  str,
const char *  sep0 
)

Definition at line 6411 of file string.c.

References rb_str_new2, rb_str_split_m(), and StringValue.

static VALUE rb_str_split_m ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 6196 of file string.c.

References ascii_isspace, BEG, END, get_pat(), is_ascii_string, is_broken_string, len, NIL_P, NUM2INT, re_registers::num_regs, Qnil, RARRAY_AREF, RARRAY_LEN, rb_ary_new(), rb_ary_new2, rb_ary_new3, rb_ary_pop(), rb_ary_push(), rb_backref_get(), rb_eArgError, rb_enc_ascget(), rb_enc_asciicompat, rb_enc_check(), rb_enc_codepoint_len(), rb_enc_fast_mbclen(), rb_enc_name, rb_enc_right_char_head, rb_fs, rb_isspace(), rb_memsearch(), rb_raise(), rb_reg_regcomp(), rb_reg_search(), rb_scan_args(), rb_str_subseq(), RB_TYPE_P, regexp, result, RMATCH_REGS, RSTRING_END, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, str_new_empty(), and T_STRING.

Referenced by Init_String(), and rb_str_split().

static VALUE rb_str_squeeze ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 5985 of file string.c.

References rb_str_dup(), and rb_str_squeeze_bang().

Referenced by Init_String().

static VALUE rb_str_squeeze_bang ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 5895 of file string.c.

References Qnil, rb_enc_asciicompat, rb_enc_check(), rb_enc_codepoint_len(), rb_enc_mbcput, RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, str_modify_keep_cr(), STR_SET_LEN, StringValue, tr_find(), tr_setup_table(), and TR_TABLE_SIZE.

Referenced by Init_String(), and rb_str_squeeze().

static VALUE rb_str_start_with ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7829 of file string.c.

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

Referenced by Init_String().

static VALUE rb_str_strip ( VALUE  str  )  [static]

Definition at line 7242 of file string.c.

References rb_str_dup(), and rb_str_strip_bang().

Referenced by Init_String().

static VALUE rb_str_strip_bang ( VALUE  str  )  [static]

Definition at line 7221 of file string.c.

References NIL_P, Qnil, rb_str_lstrip_bang(), and rb_str_rstrip_bang().

Referenced by Init_String(), and rb_str_strip().

long rb_str_strlen ( VALUE  str  ) 

Definition at line 1284 of file string.c.

References STR_ENC_GET, and str_strlen().

static VALUE rb_str_sub ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 4112 of file string.c.

References rb_str_dup(), and rb_str_sub_bang().

Referenced by Init_String().

static VALUE rb_str_sub_bang ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 3977 of file string.c.

References BEG, coderange_scan(), ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, ENC_CODERANGE_UNKNOWN, ENC_CODERANGE_VALID, END, get_pat(), hash(), len, match(), memmove(), NIL_P, OBJ_TAINT, OBJ_TAINTED, Qnil, rb_backref_get(), rb_block_given_p(), rb_check_arity, rb_check_frozen, rb_check_hash_type(), rb_eEncCompatError, rb_enc_associate(), rb_enc_compatible(), rb_enc_name, rb_hash_aref(), rb_obj_as_string(), rb_raise(), rb_reg_nth_match(), rb_reg_regsub(), rb_reg_search(), rb_str_modify(), rb_str_subseq(), rb_yield(), RESIZE_CAPA, RMATCH_REGS, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, str_mod_check(), str_modifiable(), STR_SET_LEN, and StringValue.

Referenced by Init_String(), and rb_str_sub().

long rb_str_sublen ( VALUE  str,
long  pos 
)

Definition at line 1828 of file string.c.

References ENC_CODERANGE, enc_strlen(), RSTRING_PTR, single_byte_optimizable(), and STR_ENC_GET.

Referenced by rb_reg_match(), rb_reg_match2(), rb_str_aset(), rb_str_index_m(), rb_str_rindex_m(), and rb_str_rpartition().

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

Definition at line 3492 of file string.c.

References match(), Qnil, rb_backref_get(), rb_reg_backref_number(), rb_reg_nth_match(), and rb_reg_search().

Referenced by rb_str_aref(), rb_str_aref_m(), and rb_str_partition().

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

Definition at line 3745 of file string.c.

References BEG, END, len, match(), re_registers::num_regs, rb_backref_get(), rb_eIndexError, rb_enc_associate(), rb_enc_check(), rb_raise(), rb_reg_backref_number(), rb_reg_search(), rb_str_splice_0(), RMATCH_REGS, and StringValue.

Referenced by rb_str_aset(), and rb_str_aset_m().

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

Definition at line 1860 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_VALID, len, rb_enc_mbmaxlen, rb_enc_mbminlen, rb_enc_prev_char, RB_GC_GUARD, rb_utf8_encoding(), RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, str_nth_len(), str_offset(), and str_strlen().

Referenced by rb_str_substr().

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

Definition at line 1839 of file string.c.

References OBJ_INFECT, rb_enc_cr_str_copy_for_substr(), RB_GC_GUARD, rb_str_drop_bytes(), rb_str_new5, rb_str_new_frozen(), rb_str_new_shared(), RSTRING_EMBED_LEN_MAX, RSTRING_LEN, and RSTRING_PTR.

Referenced by check_dirname(), features_index_add(), match_array(), path_sub_ext(), rb_file_s_extname(), rb_mod_const_defined(), rb_mod_const_get(), rb_realpath_internal(), rb_reg_match_post(), rb_reg_match_pre(), rb_reg_nth_match(), rb_reg_regsub(), rb_str_chop(), rb_str_ellipsize(), rb_str_enumerate_chars(), rb_str_enumerate_lines(), rb_str_partition(), rb_str_rpartition(), rb_str_split_m(), rb_str_sub_bang(), realpath_rec(), search_required(), str_gsub(), and zstream_shift_buffer().

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

Definition at line 1945 of file string.c.

References OBJ_INFECT, Qnil, rb_enc_cr_str_copy_for_substr(), RB_GC_GUARD, rb_obj_class(), rb_str_new4, rb_str_new5, rb_str_subpos(), RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_END, and str_new3().

Referenced by rb_io_putc(), rb_str_aref(), rb_str_aref_m(), rb_str_chr(), set_state_ivars(), and strio_putc().

VALUE rb_str_succ ( VALUE  orig  ) 

Definition at line 3257 of file string.c.

References enc_succ_alnum_char(), enc_succ_char(), ISALPHA, ISDIGIT, MEMCPY, memmove(), NEIGHBOR_FOUND, NEIGHBOR_NOT_CHAR, OBJ_INFECT, ONIGENC_CODE_TO_MBC_MAXLEN, ONIGENC_MBCLEN_CHARFOUND_LEN, ONIGENC_MBCLEN_CHARFOUND_P, rb_enc_asciicompat, rb_enc_cr_str_copy_for_substr(), rb_enc_precise_mbclen(), rb_enc_prev_char, rb_enc_str_coderange(), rb_str_new5, RESIZE_CAPA, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, and STR_SET_LEN.

Referenced by Init_String(), rb_str_succ_bang(), and sym_succ().

static VALUE rb_str_succ_bang ( VALUE  str  )  [static]

Definition at line 3355 of file string.c.

References rb_str_shared_replace(), and rb_str_succ().

Referenced by Init_String().

static VALUE rb_str_sum ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 7506 of file string.c.

References CHAR_BIT, FIXNUM_MAX, INT2FIX, len, LONG2FIX, mod, NUM2INT, rb_funcall(), rb_intern, rb_scan_args(), RSTRING_LEN, RSTRING_PTR, and str_mod_check().

Referenced by Init_String().

static VALUE rb_str_swapcase ( VALUE  str  )  [static]

Definition at line 5331 of file string.c.

References rb_str_dup(), and rb_str_swapcase_bang().

Referenced by Init_String(), and sym_swapcase().

static VALUE rb_str_swapcase_bang ( VALUE  str  )  [static]

Definition at line 5286 of file string.c.

References Qnil, rb_enc_codepoint_len(), rb_enc_islower, rb_enc_isupper, rb_enc_mbcput, rb_enc_tolower(), rb_enc_toupper(), rb_str_check_dummy_enc(), RSTRING_END, RSTRING_PTR, STR_ENC_GET, and str_modify_keep_cr().

Referenced by Init_String(), and rb_str_swapcase().

int rb_str_symname_p ( VALUE  sym  ) 

Definition at line 8381 of file string.c.

References FALSE, len, NULL, rb_default_external_encoding(), rb_default_internal_encoding(), rb_enc_symname_p(), rb_str_is_ascii_only_p(), RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, strlen(), sym_printable(), and TRUE.

Referenced by id_to_name(), and sym_inspect().

VALUE rb_str_times ( VALUE  str,
VALUE  times 
)

Definition at line 1384 of file string.c.

References len, LONG_MAX, NUM2LONG, OBJ_INFECT, rb_eArgError, rb_enc_cr_str_copy_for_substr(), rb_raise(), rb_str_new5, RSTRING_LEN, RSTRING_PTR, and VALUE.

Referenced by Init_String().

VALUE rb_str_tmp_new ( long  len  ) 

Definition at line 919 of file string.c.

References str_new().

Referenced by moreswitches(), rb_alloc_tmp_buffer(), rb_feature_p(), rb_find_file_ext_safe(), rb_find_file_safe(), str_transcode0(), and VpAlloc().

static VALUE rb_str_to_f ( VALUE  str  )  [static]

Definition at line 4709 of file string.c.

References DBL2NUM, FALSE, and rb_str_to_dbl().

Referenced by Init_String().

static VALUE rb_str_to_i ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 4676 of file string.c.

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

Referenced by Init_String().

static VALUE rb_str_to_s ( VALUE  str  )  [static]

Definition at line 4724 of file string.c.

References rb_cString, rb_obj_class(), and str_duplicate().

Referenced by Init_String().

VALUE rb_str_to_str ( VALUE  str  ) 

Definition at line 964 of file string.c.

References rb_convert_type(), and T_STRING.

Referenced by new_struct(), rb_gzfile_set_comment(), rb_gzfile_set_orig_name(), rb_string_value(), and reg_operand().

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

Definition at line 5699 of file string.c.

References rb_str_dup(), and tr_trans().

Referenced by Init_String().

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

Definition at line 5657 of file string.c.

References tr_trans().

Referenced by Init_String().

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

Definition at line 6022 of file string.c.

References rb_str_dup(), and tr_trans().

Referenced by Init_String().

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

Definition at line 6002 of file string.c.

References tr_trans().

Referenced by Init_String().

VALUE rb_str_unlocktmp ( VALUE  str  ) 

Definition at line 1991 of file string.c.

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

Referenced by rb_io_sysread(), rb_str_locktmp_ensure(), and readline_readline().

static VALUE rb_str_upcase ( VALUE  str  )  [static]

Definition at line 5114 of file string.c.

References rb_str_dup(), and rb_str_upcase_bang().

Referenced by Init_String(), and sym_upcase().

static VALUE rb_str_upcase_bang ( VALUE  str  )  [static]

Definition at line 5049 of file string.c.

References Qnil, rb_enc_asciicompat, rb_enc_codepoint_len(), rb_enc_isascii, rb_enc_islower, rb_enc_mbcput, rb_enc_toupper(), rb_str_check_dummy_enc(), RSTRING_END, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, and str_modify_keep_cr().

Referenced by Init_String(), and rb_str_upcase().

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

Definition at line 3739 of file string.c.

References rb_str_splice().

Referenced by eval_string_with_cref(), rb_str_prepend(), and strio_ungetc().

static VALUE rb_str_upto ( int  argc,
VALUE *  argv,
VALUE  beg 
) [static]

Definition at line 3396 of file string.c.

References args, CONST_ID, FALSE, FIX2LONG, FIXNUM_P, INT2FIX, is_ascii_string, ISDIGIT, NIL_P, no_digits, numberof, Qnil, rb_enc_check(), rb_enc_sprintf(), rb_enc_str_new(), rb_funcall(), rb_intern, rb_long2int, rb_obj_freeze(), rb_scan_args(), rb_str_cmp(), rb_str_dup(), rb_str_equal(), rb_str_format(), rb_str_to_inum(), rb_usascii_encoding(), rb_usascii_str_new_cstr(), rb_yield(), RETURN_ENUMERATOR, RSTRING_END, RSTRING_LEN, RSTRING_PTR, RTEST, and StringValue.

Referenced by Init_String().

static VALUE rb_str_valid_encoding_p ( VALUE  str  )  [static]

Definition at line 7929 of file string.c.

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

Referenced by Init_String().

VALUE rb_string_value ( volatile VALUE *  ptr  ) 

Definition at line 1589 of file string.c.

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

Referenced by rb_string_value_cstr(), and rb_string_value_ptr().

char* rb_string_value_cstr ( volatile VALUE *  ptr  ) 

Definition at line 1644 of file string.c.

References len, rb_eArgError, rb_enc_get(), rb_enc_mbminlen, rb_raise(), rb_str_modify(), rb_string_value(), RSTRING_LEN, RSTRING_PTR, str_fill_term(), str_null_char(), and VALUE.

char* rb_string_value_ptr ( volatile VALUE *  ptr  ) 

Definition at line 1600 of file string.c.

References rb_string_value(), RSTRING_PTR, and VALUE.

VALUE rb_sym_to_s ( VALUE  sym  ) 

Definition at line 8478 of file string.c.

References rb_cString, rb_id2str(), str_new3(), and SYM2ID.

Referenced by constant_arg(), ev_on_event(), fev_off_event(), fole_respond_to(), get_eval_string_core(), hash2named_arg(), Init_String(), location_base_label(), ole_invoke(), range_each(), range_step(), reg_operand(), sym_aref(), sym_casecmp(), sym_cmp(), sym_match(), and sym_succ().

VALUE rb_tainted_str_new ( const char *  ptr,
long  len 
)

Definition at line 589 of file string.c.

References OBJ_TAINT, rb_str_new(), and VALUE.

Referenced by env_rassoc(), fdbm_delete(), fdbm_delete_if(), fdbm_each_key(), fdbm_each_pair(), fdbm_each_value(), fdbm_fetch(), fdbm_invert(), fdbm_key(), fdbm_keys(), fdbm_select(), fdbm_shift(), fdbm_to_a(), fdbm_to_hash(), fdbm_values(), ip_ruby_cmd(), lib_fromUTF8_core(), pack_unpack(), rb_dlptr_aref(), rb_dlptr_to_s(), rb_dlptr_to_str(), rb_external_str_new_with_enc(), rb_fiddle_ptr_aref(), rb_fiddle_ptr_to_s(), rb_fiddle_ptr_to_str(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().

VALUE rb_tainted_str_new_cstr ( const char *  ptr  ) 

Definition at line 598 of file string.c.

References OBJ_TAINT, rb_str_new2, and VALUE.

Referenced by addrinfo_firstonly_new(), addrinfo_list_new(), and init_addrinfo_getaddrinfo().

ID rb_to_id ( VALUE  name  ) 

Definition at line 8730 of file string.c.

References NIL_P, PRIsVALUE, rb_check_string_type(), rb_eTypeError, rb_intern_str, rb_raise(), RB_TYPE_P, SYM2ID, SYMBOL_P, and T_STRING.

Referenced by check_setter_id(), enumerator_init(), fole_missing(), new_struct(), num_sadded(), obj_respond_to(), ole_search_handler_method(), rb_f_trace_var(), rb_mod_alias_method(), rb_mod_autoload(), rb_mod_const_missing(), rb_mod_define_method(), rb_mod_modfunc(), rb_struct_s_def(), rb_thread_aset(), rb_thread_variable_set(), send_internal(), and vm_call_opt_send().

VALUE rb_usascii_str_new ( const char *  ptr,
long  len 
)

Definition at line 540 of file string.c.

References ENC_CODERANGE_7BIT, ENCODING_CODERANGE_SET, rb_str_new(), rb_usascii_encindex, and VALUE.

Referenced by big2str_alloc(), big2str_base_poweroftwo(), flo_to_s(), hexencode_str_new(), int_chr(), nil_to_s(), pack_unpack(), rb_ary_join(), rb_id2str(), rb_io_getline_1(), and rb_str_ellipsize().

VALUE rb_usascii_str_new_cstr ( const char *  ptr  ) 

Definition at line 569 of file string.c.

References ENC_CODERANGE_7BIT, ENCODING_CODERANGE_SET, rb_str_new2, rb_usascii_encindex, and VALUE.

Referenced by eval_string_with_cref(), flo_to_s(), inspect_ary(), pruby_eval(), and rb_str_upto().

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

Definition at line 1977 of file string.c.

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

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

Definition at line 7250 of file string.c.

References BEG, END, match(), re_registers::num_regs, Qnil, rb_ary_new2, rb_ary_push(), rb_backref_get(), rb_enc_fast_mbclen(), rb_reg_nth_match(), rb_reg_search(), result, RMATCH_REGS, RSTRING_END, RSTRING_LEN, RSTRING_PTR, and STR_ENC_GET.

Referenced by rb_str_scan().

static const char* search_nonascii ( const char *  p,
const char *  e 
) [inline, static]

Definition at line 254 of file string.c.

References ISASCII, NULL, and VALUE.

Referenced by coderange_scan(), enc_strlen(), rb_enc_cr_str_copy_for_substr(), rb_enc_strlen_cr(), rb_str_coderange_scan_restartable(), rb_str_scrub(), and str_nth_len().

static int single_byte_optimizable ( VALUE  str  )  [inline, static]

Definition at line 234 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_7BIT, rb_enc_mbmaxlen, and STR_ENC_GET.

Referenced by rb_str_casecmp(), rb_str_downcase_bang(), rb_str_enumerate_codepoints(), rb_str_index(), rb_str_index_m(), rb_str_justify(), rb_str_offset(), rb_str_reverse(), rb_str_reverse_bang(), rb_str_rindex(), rb_str_rindex_m(), rb_str_rstrip_bang(), rb_str_splice(), rb_str_squeeze_bang(), rb_str_sublen(), rb_str_subpos(), rb_str_upcase_bang(), str_strlen(), and tr_trans().

static VALUE str_alloc ( VALUE  klass  )  [inline, static]

Definition at line 482 of file string.c.

References FL_WB_PROTECTED, NEWOBJ_OF, RGENGC_WB_PROTECTED_STRING, T_STRING, and VALUE.

Referenced by empty_str_alloc(), rb_str_b(), rb_str_buf_new(), str_duplicate(), str_new0(), str_new4(), and str_new_shared().

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

Definition at line 2077 of file string.c.

References FL_UNSET, LONG_MAX, rb_eArgError, rb_raise(), rb_str_modify(), RESIZE_CAPA, RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_END, RSTRING_LEN, RSTRING_PTR, STR_ASSOC, STR_ASSOC_P, STR_EMBED_P, STR_SET_LEN, and TERM_LEN.

Referenced by rb_enc_cr_str_buf_cat(), rb_str_buf_cat(), and rb_str_inspect().

static VALUE str_byte_aref ( VALUE  str,
VALUE  indx 
) [static]

Definition at line 4463 of file string.c.

References re_registers::beg, FIX2LONG, len, NIL_P, NUM2LONG, Qfalse, Qnil, rb_range_beg_len(), RSTRING_LEN, str_byte_substr(), T_FIXNUM, TYPE, and UNREACHABLE.

Referenced by rb_str_byteslice().

static VALUE str_byte_substr ( VALUE  str,
long  beg,
long  len 
) [static]

Definition at line 4408 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_UNKNOWN, ENC_CODERANGE_VALID, OBJ_INFECT, Qnil, rb_enc_asciicompat, rb_obj_class(), rb_str_new4, rb_str_new5, RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_LEN, RSTRING_PTR, str_enc_copy(), STR_ENC_GET, and str_new3().

Referenced by rb_str_byteslice(), and str_byte_aref().

static VALUE str_compat_and_valid ( VALUE  str,
rb_encoding enc 
) [static]

Definition at line 8006 of file string.c.

References ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, PRIsVALUE, rb_eArgError, rb_eEncCompatError, rb_enc_asciicompat, rb_enc_name, rb_enc_str_coderange(), rb_raise(), STR_ENC_GET, and StringValue.

Referenced by rb_str_scrub().

static void str_discard ( VALUE  str  )  [inline, static]

Definition at line 1528 of file string.c.

References RSTRING, ruby_sized_xfree(), STR_EMBED_P, STR_HEAP_PTR, STR_HEAP_SIZE, str_modifiable(), and STR_SHARED_P.

Referenced by rb_str_clear(), rb_str_replace(), and rb_str_shared_replace().

static VALUE str_duplicate ( VALUE  klass,
VALUE  str 
) [static]

Definition at line 1054 of file string.c.

References str_alloc(), str_replace(), and VALUE.

Referenced by rb_str_dup(), rb_str_resurrect(), and rb_str_to_s().

static void str_enc_copy ( VALUE  str1,
VALUE  str2 
) [inline, static]

Definition at line 392 of file string.c.

References ENCODING_GET, and rb_enc_set_index().

Referenced by rb_enc_cr_str_copy_for_substr(), rb_enc_cr_str_exact_copy(), and str_byte_substr().

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

Definition at line 2513 of file string.c.

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

Referenced by rb_str_eql(), and rb_str_equal().

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

Definition at line 1627 of file string.c.

References rb_str_capacity(), rb_str_modify_expand(), RSTRING_PTR, str_independent(), str_make_independent, TERM_FILL, and zero_filled().

Referenced by rb_str_fill_terminator(), and rb_string_value_cstr().

static VALUE str_gsub ( int  argc,
VALUE *  argv,
VALUE  str,
int  bang 
) [static]

Definition at line 4120 of file string.c.

References BEG, re_registers::beg, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, END, get_pat(), hash(), last, len, match(), NIL_P, OBJ_INFECT, OBJ_TAINT, OBJ_TAINTED, Qnil, rb_backref_get(), rb_check_arity, rb_check_hash_type(), rb_enc_asciicompat, rb_enc_associate(), rb_enc_fast_mbclen(), rb_enc_str_buf_cat(), rb_eRuntimeError, rb_hash_aref(), rb_obj_as_string(), rb_obj_class(), rb_raise(), rb_reg_nth_match(), rb_reg_regsub(), rb_reg_search(), rb_str_buf_append(), rb_str_buf_new(), rb_str_dup(), rb_str_shared_replace(), rb_str_subseq(), rb_yield(), RBASIC_SET_CLASS, RETURN_ENUMERATOR, RMATCH_REGS, RSTRING_END, RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, str_mod_check(), StringValue, and val.

Referenced by rb_str_gsub(), and rb_str_gsub_bang().

static int str_independent ( VALUE  str  )  [inline, static]

Definition at line 1452 of file string.c.

References STR_EMBED_P, str_modifiable(), and STR_SHARED_P.

Referenced by rb_str_modify(), rb_str_modify_expand(), rb_str_resize(), str_fill_term(), and str_modify_keep_cr().

static void str_make_independent_expand ( VALUE  str,
long  expand 
) [static]

Definition at line 1461 of file string.c.

References ALLOC_N, len, RSTRING, RSTRING_LEN, RSTRING_PTR, STR_SET_NOEMBED, STR_UNSET_NOCAPA, TERM_FILL, and TERM_LEN.

Referenced by rb_str_modify_expand(), and rb_str_resize().

static void str_mod_check ( VALUE  s,
const char *  p,
long  len 
) [inline, static]

Definition at line 460 of file string.c.

References rb_eRuntimeError, rb_raise(), RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_str_enumerate_lines(), rb_str_scan(), rb_str_sub_bang(), rb_str_sum(), and str_gsub().

static void str_modifiable ( VALUE  str  )  [inline, static]

Definition at line 1443 of file string.c.

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

Referenced by rb_str_drop_bytes(), rb_str_force_encoding(), rb_str_replace(), rb_str_set_len(), rb_str_sub_bang(), str_discard(), and str_independent().

static void str_modify_keep_cr ( VALUE  str  )  [static]

Definition at line 1518 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_BROKEN, ENC_CODERANGE_CLEAR, str_independent(), and str_make_independent.

Referenced by rb_str_capitalize_bang(), rb_str_chomp_bang(), rb_str_chop_bang(), rb_str_delete_bang(), rb_str_downcase_bang(), rb_str_gsub_bang(), rb_str_lstrip_bang(), rb_str_reverse_bang(), rb_str_rstrip_bang(), rb_str_slice_bang(), rb_str_splice(), rb_str_squeeze_bang(), rb_str_swapcase_bang(), rb_str_upcase_bang(), and tr_trans().

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

Definition at line 528 of file string.c.

References str_new0().

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

Definition at line 498 of file string.c.

References ALLOC_N, ENC_CODERANGE_7BIT, ENC_CODERANGE_SET, rb_eArgError, rb_raise(), rb_sourcefile, rb_sourceline(), RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_PTR, RUBY_DTRACE_STRING_CREATE, RUBY_DTRACE_STRING_CREATE_ENABLED, str_alloc(), STR_SET_LEN, STR_SET_NOEMBED, TERM_FILL, and VALUE.

Referenced by rb_enc_str_new(), and str_new().

static VALUE str_new3 ( VALUE  klass,
VALUE  str 
) [static]

Definition at line 793 of file string.c.

References str_new_shared().

Referenced by rb_str_new_frozen(), rb_str_new_shared(), rb_str_substr(), rb_sym_to_s(), and str_byte_substr().

static VALUE str_new4 ( VALUE  klass,
VALUE  str 
) [static]

Definition at line 808 of file string.c.

References assert, OBJ_FROZEN, OBJ_INFECT, rb_enc_cr_str_exact_copy(), RSTRING, RSTRING_LEN, RSTRING_PTR, str_alloc(), STR_ASSOC_P, STR_SET_NOEMBED, STR_SET_SHARED, STR_SHARED_P, and VALUE.

Referenced by rb_str_new_frozen().

static VALUE str_new_empty ( VALUE  str  )  [static]

Definition at line 880 of file string.c.

References OBJ_INFECT, rb_enc_copy(), rb_str_new5, and VALUE.

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

static VALUE str_new_shared ( VALUE  klass,
VALUE  str 
) [static]

Definition at line 787 of file string.c.

References str_alloc(), and str_replace_shared().

Referenced by str_new3().

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

Definition at line 1759 of file string.c.

References str_nth_len().

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

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

Definition at line 1703 of file string.c.

References ISASCII, rb_enc_asciicompat, rb_enc_mbclen(), rb_enc_mbmaxlen, rb_enc_mbminlen, and search_nonascii().

Referenced by rb_enc_nth(), rb_str_subpos(), and str_nth().

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

Definition at line 1616 of file string.c.

References rb_enc_mbclen(), and zero_filled().

Referenced by rb_string_value_cstr().

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

Definition at line 1773 of file string.c.

References str_nth().

Referenced by rb_str_index(), rb_str_index_m(), rb_str_justify(), rb_str_offset(), rb_str_rindex_m(), and rb_str_subpos().

static VALUE str_replace ( VALUE  str,
VALUE  str2 
) [static]

Definition at line 1026 of file string.c.

References assert, ELTS_SHARED, FL_SET, FL_UNSET, len, OBJ_FROZEN, OBJ_INFECT, rb_enc_cr_str_exact_copy(), rb_str_new4, RSTRING, RSTRING_LEN, RSTRING_PTR, STR_ASSOC, STR_ASSOC_P, str_replace_shared(), STR_SET_NOEMBED, STR_SET_SHARED, STR_SHARED_P, and VALUE.

Referenced by rb_str_replace(), and str_duplicate().

static VALUE str_replace_shared ( VALUE  str2,
VALUE  str 
) [static]

Definition at line 779 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().

static VALUE str_replace_shared_without_enc ( VALUE  str2,
VALUE  str 
) [static]

Definition at line 761 of file string.c.

References FL_SET, rb_str_new_frozen(), RSTRING, RSTRING_EMBED_LEN_MAX, RSTRING_LEN, RSTRING_PTR, STR_NOEMBED, STR_SET_EMBED, STR_SET_EMBED_LEN, and STR_SET_SHARED.

Referenced by rb_str_b(), and str_replace_shared().

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

Definition at line 2838 of file string.c.

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

Referenced by rb_str_rindex().

static VALUE str_scrub ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 8287 of file string.c.

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

Referenced by Init_String().

static VALUE str_scrub_bang ( int  argc,
VALUE *  argv,
VALUE  str 
) [static]

Definition at line 8309 of file string.c.

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

Referenced by Init_String().

static long str_strlen ( VALUE  str,
rb_encoding enc 
) [static]

Definition at line 1238 of file string.c.

References ENC_CODERANGE, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, len, rb_enc_strlen_cr(), rb_utf8_encoding(), RSTRING_END, RSTRING_LEN, RSTRING_PTR, single_byte_optimizable(), STR_ENC_GET, and VALUE.

Referenced by rb_str_aref(), rb_str_aset(), rb_str_enumerate_chars(), rb_str_enumerate_codepoints(), rb_str_index(), rb_str_index_m(), rb_str_justify(), rb_str_length(), rb_str_rindex(), rb_str_rindex_m(), rb_str_splice(), rb_str_strlen(), and rb_str_subpos().

static VALUE sym_aref ( int  argc,
VALUE *  argv,
VALUE  sym 
) [static]

Definition at line 8632 of file string.c.

References rb_str_aref_m(), and rb_sym_to_s().

static VALUE sym_call ( VALUE  args,
VALUE  sym,
int  argc,
VALUE *  argv,
VALUE  passed_proc 
) [static]

Definition at line 8503 of file string.c.

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

Referenced by sym_to_proc().

static VALUE sym_capitalize ( VALUE  sym  )  [static]

Definition at line 8698 of file string.c.

References rb_id2str(), rb_str_capitalize(), rb_str_intern(), and SYM2ID.

Referenced by Init_String().

static VALUE sym_casecmp ( VALUE  sym,
VALUE  other 
) [static]

Definition at line 8599 of file string.c.

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

Referenced by Init_String().

static VALUE sym_cmp ( VALUE  sym,
VALUE  other 
) [static]

Definition at line 8582 of file string.c.

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

Referenced by Init_String().

static VALUE sym_downcase ( VALUE  sym  )  [static]

Definition at line 8685 of file string.c.

References rb_id2str(), rb_str_downcase(), rb_str_intern(), and SYM2ID.

Referenced by Init_String().

static VALUE sym_empty ( VALUE  sym  )  [static]

Definition at line 8659 of file string.c.

References rb_id2str(), rb_str_empty(), and SYM2ID.

Referenced by Init_String().

static VALUE sym_encoding ( VALUE  sym  )  [static]

Definition at line 8724 of file string.c.

References rb_id2str(), rb_obj_encoding(), and SYM2ID.

static VALUE sym_equal ( VALUE  sym1,
VALUE  sym2 
) [static]

Definition at line 8360 of file string.c.

References Qfalse, and Qtrue.

Referenced by Init_String().

static VALUE sym_inspect ( VALUE  sym  )  [static]

Definition at line 8436 of file string.c.

References len, memmove(), rb_enc_str_new(), rb_id2str(), rb_str_inspect(), rb_str_resize(), rb_str_symname_p(), RSTRING_LEN, RSTRING_PTR, STR_ENC_GET, and SYM2ID.

Referenced by get_exception_sym2type(), and Init_String().

static VALUE sym_length ( VALUE  sym  )  [static]

Definition at line 8646 of file string.c.

References rb_id2str(), rb_str_length(), and SYM2ID.

Referenced by Init_String().

static VALUE sym_match ( VALUE  sym,
VALUE  other 
) [static]

Definition at line 8616 of file string.c.

References rb_str_match(), and rb_sym_to_s().

Referenced by Init_String().

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

Definition at line 8368 of file string.c.

References FALSE, rb_enc_codepoint_len(), rb_enc_isprint, and TRUE.

Referenced by rb_str_quote_unprintable(), and rb_str_symname_p().

static VALUE sym_succ ( VALUE  sym  )  [static]

Definition at line 8562 of file string.c.

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

Referenced by Init_String().

static VALUE sym_swapcase ( VALUE  sym  )  [static]

Definition at line 8711 of file string.c.

References rb_id2str(), rb_str_intern(), rb_str_swapcase(), and SYM2ID.

Referenced by Init_String().

static VALUE sym_to_proc ( VALUE  sym  )  [static]

Definition at line 8524 of file string.c.

References id, Qfalse, Qnil, RARRAY_PTR, rb_ary_store(), rb_ary_tmp_new(), rb_gc_register_mark_object(), rb_proc_new(), SYM2ID, and sym_call().

Referenced by Init_String().

static VALUE sym_to_sym ( VALUE  sym  )  [static]

Definition at line 8497 of file string.c.

Referenced by Init_String().

static VALUE sym_upcase ( VALUE  sym  )  [static]

Definition at line 8672 of file string.c.

References rb_id2str(), rb_str_intern(), rb_str_upcase(), and SYM2ID.

Referenced by Init_String().

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

Definition at line 5772 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().

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

Definition at line 5708 of file string.c.

References buf, tr::gen, key, tr::max, NIL_P, tr::now, tr::p, tr::pend, Qtrue, rb_enc_ascget(), rb_hash_aref(), rb_hash_aset(), rb_hash_new(), RSTRING_LEN, RSTRING_PTR, trnext(), and UINT2NUM.

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

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

Definition at line 5403 of file string.c.

References ALLOC_N, buf, CHECK_IF_ASCII, ENC_CODERANGE, ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, tr::gen, hash(), if(), last, max(), tr::max, memcmp(), NIL_P, tr::now, NUM2INT, tr::p, tr::pend, Qnil, Qtrue, rb_enc_ascget(), rb_enc_associate(), rb_enc_check(), rb_enc_codelen(), rb_enc_codepoint_len(), rb_enc_mbcput, rb_enc_mbmaxlen, rb_hash_aset(), rb_hash_lookup, rb_hash_new(), rb_str_delete_bang(), REALLOC_N, RSTRING, RSTRING_END, RSTRING_LEN, RSTRING_PTR, ruby_sized_xfree(), single_byte_optimizable(), STR_EMBED_P, STR_HEAP_PTR, STR_HEAP_SIZE, str_modify_keep_cr(), STR_SET_NOEMBED, StringValue, trans, trnext(), and UINT2NUM.

Referenced by rb_str_tr(), rb_str_tr_bang(), rb_str_tr_s(), and rb_str_tr_s_bang().

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

Definition at line 5347 of file string.c.

References tr::gen, if(), tr::max, tr::now, tr::p, tr::pend, rb_eArgError, rb_enc_ascget(), rb_enc_codepoint_len(), and rb_raise().

Referenced by tr_setup_table(), and tr_trans().

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

Definition at line 1607 of file string.c.

Referenced by str_fill_term(), and str_null_char().


Variable Documentation

st_table* frozen_strings [static]

Definition at line 166 of file string.c.

Referenced by Init_String(), rb_fstring(), and rb_str_free().

struct st_hash_type fstring_hash_type [static]

Initial value:

Definition at line 168 of file string.c.

Referenced by rb_fstring().

ID id_to_s [static]

Definition at line 1008 of file string.c.

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

VALUE rb_cString

Definition at line 47 of file string.c.

VALUE rb_cSymbol

Definition at line 48 of file string.c.

VALUE rb_fs

Definition at line 251 of file string.c.


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7