Ruby: include/ruby/internal/intern/string.h Source File

Ruby 4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721)

string.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_STRING_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_STRING_H
23#include "ruby/internal/config.h"
24
25#ifdef STDC_HEADERS
26# include <stddef.h>
27#endif
28
29#ifdef HAVE_STRING_H
30# include <string.h>
31#endif
32
33#ifdef HAVE_STDINT_H
34# include <stdint.h>
35#endif
36
37#include "ruby/internal/attr/deprecated.h"
38#include "ruby/internal/attr/nonnull.h"
39#include "ruby/internal/attr/pure.h"
40#include "ruby/internal/constant_p.h"
41#include "ruby/internal/dllexport.h"
42#include "ruby/internal/value.h"
43#include "ruby/internal/variable.h" /* rb_gvar_setter_t */
44#include "ruby/st.h" /* st_index_t */
45
46 RBIMPL_SYMBOL_EXPORT_BEGIN()
47
48/* string.c */
49
50
63 VALUE rb_str_new(const char *ptr, long len);
64
76 VALUE rb_str_new_cstr(const char *ptr);
77
90 VALUE rb_str_new_shared(VALUE str);
91
102 VALUE rb_str_new_frozen(VALUE str);
103
123 VALUE rb_str_new_with_class(VALUE obj, const char *ptr, long len);
124
143 VALUE rb_external_str_new(const char *ptr, long len);
144
145 RBIMPL_ATTR_NONNULL(())
164 VALUE rb_external_str_new_cstr(const char *ptr);
165
186 VALUE rb_locale_str_new(const char *ptr, long len);
187
188 RBIMPL_ATTR_NONNULL(())
207 VALUE rb_locale_str_new_cstr(const char *ptr);
208
229 VALUE rb_filesystem_str_new(const char *ptr, long len);
230
231 RBIMPL_ATTR_NONNULL(())
250 VALUE rb_filesystem_str_new_cstr(const char *ptr);
251
261 VALUE rb_str_buf_new(long capa);
262
263 RBIMPL_ATTR_NONNULL(())
278 VALUE rb_str_buf_new_cstr(const char *ptr);
279
288 VALUE rb_str_tmp_new(long len);
289
303 VALUE rb_usascii_str_new(const char *ptr, long len);
304
318 VALUE rb_usascii_str_new_cstr(const char *ptr);
319
331 VALUE rb_utf8_str_new(const char *ptr, long len);
332
346 VALUE rb_utf8_str_new_cstr(const char *ptr);
347
357
375 VALUE rb_str_new_static(const char *ptr, long len);
376
392 VALUE rb_usascii_str_new_static(const char *ptr, long len);
393
409 VALUE rb_utf8_str_new_static(const char *ptr, long len);
410
412
431 VALUE rb_str_to_interned_str(VALUE str);
432
453 VALUE rb_interned_str(const char *ptr, long len);
454
455 RBIMPL_ATTR_NONNULL(())
470 VALUE rb_interned_str_cstr(const char *ptr);
471
487void rb_str_free(VALUE str);
488
505void rb_str_shared_replace(VALUE dst, VALUE src);
506
522 VALUE rb_str_buf_append(VALUE dst, VALUE src);
523
525 VALUE rb_str_buf_cat(VALUE, const char*, long);
526
528 VALUE rb_str_buf_cat2(VALUE, const char*);
529
530 RBIMPL_ATTR_NONNULL(())
544 VALUE rb_str_buf_cat_ascii(VALUE dst, const char *src);
545
554 VALUE rb_obj_as_string(VALUE obj);
555
568 VALUE rb_check_string_type(VALUE obj);
569
584void rb_must_asciicompat(VALUE obj);
585
593 VALUE rb_str_dup(VALUE str);
594
603 VALUE rb_str_resurrect(VALUE str);
604
616 VALUE rb_str_locktmp(VALUE str);
617
626 VALUE rb_str_unlocktmp(VALUE str);
627
629 VALUE rb_str_dup_frozen(VALUE);
630
632#define rb_str_dup_frozen rb_str_new_frozen
633
650 VALUE rb_str_plus(VALUE lhs, VALUE rhs);
651
660 VALUE rb_str_times(VALUE str, VALUE num);
661
673long rb_str_sublen(VALUE str, long pos);
674
725 VALUE rb_str_substr(VALUE str, long beg, long len);
726
738 VALUE rb_str_subseq(VALUE str, long beg, long len);
739
753char *rb_str_subpos(VALUE str, long beg, long *len);
754
766void rb_str_modify(VALUE str);
767
781void rb_str_modify_expand(VALUE str, long capa);
782
790 VALUE rb_str_freeze(VALUE str);
791
815void rb_str_set_len(VALUE str, long len);
816
831 VALUE rb_str_resize(VALUE str, long len);
832
844 VALUE rb_str_cat(VALUE dst, const char *src, long srclen);
845
859 VALUE rb_str_cat_cstr(VALUE dst, const char *src);
860
862 VALUE rb_str_cat2(VALUE, const char*);
863
877 VALUE rb_str_append(VALUE dst, VALUE src);
878
893 VALUE rb_str_concat(VALUE dst, VALUE src);
894
895/* random.c */
896
909st_index_t rb_memhash(const void *ptr, long len);
910
937st_index_t rb_hash_start(st_index_t i);
938
940#define rb_hash_uint32(h, i) st_hash_uint32((h), (i))
941
943#define rb_hash_uint(h, i) st_hash_uint((h), (i))
944
946#define rb_hash_end(h) st_hash_end(h)
947
948/* string.c */
949
966st_index_t rb_str_hash(VALUE str);
967
984int rb_str_hash_cmp(VALUE str1, VALUE str2);
985
1002int rb_str_comparable(VALUE str1, VALUE str2);
1003
1016int rb_str_cmp(VALUE lhs, VALUE rhs);
1017
1031 VALUE rb_str_equal(VALUE str1, VALUE str2);
1032
1049 VALUE rb_str_drop_bytes(VALUE str, long len);
1050
1069void rb_str_update(VALUE dst, long beg, long len, VALUE src);
1070
1085 VALUE rb_str_replace(VALUE dst, VALUE src);
1086
1108 VALUE rb_str_inspect(VALUE str);
1109
1122 VALUE rb_str_dump(VALUE str);
1123
1140 VALUE rb_str_split(VALUE str, const char *delim);
1141
1147 rb_gvar_setter_t rb_str_setter;
1148
1149/* symbol.c */
1150
1164 VALUE rb_str_intern(VALUE str);
1165
1166/* string.c */
1167
1179 VALUE rb_sym_to_s(VALUE sym);
1180
1190long rb_str_strlen(VALUE str);
1191
1198 VALUE rb_str_length(VALUE);
1199
1209long rb_str_offset(VALUE str, long pos);
1210
1211 RBIMPL_ATTR_PURE()
1219size_t rb_str_capacity(VALUE str);
1220
1235 VALUE rb_str_ellipsize(VALUE str, long len);
1236
1266 VALUE rb_str_scrub(VALUE str, VALUE repl);
1267
1338 VALUE rb_str_succ(VALUE orig);
1339
1340 RBIMPL_ATTR_NONNULL(())
1349static inline long
1350rbimpl_strlen(const char *str)
1351{
1352 return RBIMPL_CAST((long)strlen(str));
1353}
1354
1355 RBIMPL_ATTR_NONNULL(())
1364static inline VALUE
1365rbimpl_str_new_cstr(const char *str)
1366{
1367 long len = rbimpl_strlen(str);
1368 return rb_str_new_static(str, len);
1369}
1370
1371 RBIMPL_ATTR_NONNULL(())
1380static inline VALUE
1381rbimpl_usascii_str_new_cstr(const char *str)
1382{
1383 long len = rbimpl_strlen(str);
1384 return rb_usascii_str_new_static(str, len);
1385}
1386
1387 RBIMPL_ATTR_NONNULL(())
1396static inline VALUE
1397rbimpl_utf8_str_new_cstr(const char *str)
1398{
1399 long len = rbimpl_strlen(str);
1400 return rb_utf8_str_new_static(str, len);
1401}
1402
1403 RBIMPL_ATTR_NONNULL(())
1412static inline VALUE
1413rbimpl_external_str_new_cstr(const char *str)
1414{
1415 long len = rbimpl_strlen(str);
1416 return rb_external_str_new(str, len);
1417}
1418
1419 RBIMPL_ATTR_NONNULL(())
1428static inline VALUE
1429rbimpl_locale_str_new_cstr(const char *str)
1430{
1431 long len = rbimpl_strlen(str);
1432 return rb_locale_str_new(str, len);
1433}
1434
1435 RBIMPL_ATTR_NONNULL(())
1444static inline VALUE
1445rbimpl_str_buf_new_cstr(const char *str)
1446{
1447 long len = rbimpl_strlen(str);
1448 VALUE buf = rb_str_buf_new(len);
1449 return rb_str_buf_cat(buf, str, len);
1450}
1451
1452 RBIMPL_ATTR_NONNULL(())
1462static inline VALUE
1463rbimpl_str_cat_cstr(VALUE buf, const char *str)
1464{
1465 long len = rbimpl_strlen(str);
1466 return rb_str_cat(buf, str, len);
1467}
1468
1469 RBIMPL_ATTR_NONNULL(())
1479static inline VALUE
1480rbimpl_exc_new_cstr(VALUE exc, const char *str)
1481{
1482 long len = rbimpl_strlen(str);
1483 return rb_exc_new(exc, str, len);
1484}
1485
1499#define rb_str_new(str, len) \
1500 ((RBIMPL_CONSTANT_P(str) && \
1501 RBIMPL_CONSTANT_P(len) ? \
1502 rb_str_new_static : \
1503 rb_str_new) ((str), (len)))
1504
1515#define rb_str_new_cstr(str) \
1516 ((RBIMPL_CONSTANT_P(str) ? \
1517 rbimpl_str_new_cstr : \
1518 rb_str_new_cstr) (str))
1519
1533#define rb_usascii_str_new(str, len) \
1534 ((RBIMPL_CONSTANT_P(str) && \
1535 RBIMPL_CONSTANT_P(len) ? \
1536 rb_usascii_str_new_static : \
1537 rb_usascii_str_new) ((str), (len)))
1538
1550#define rb_utf8_str_new(str, len) \
1551 ((RBIMPL_CONSTANT_P(str) && \
1552 RBIMPL_CONSTANT_P(len) ? \
1553 rb_utf8_str_new_static : \
1554 rb_utf8_str_new) ((str), (len)))
1555
1568#define rb_usascii_str_new_cstr(str) \
1569 ((RBIMPL_CONSTANT_P(str) ? \
1570 rbimpl_usascii_str_new_cstr : \
1571 rb_usascii_str_new_cstr) (str))
1572
1584#define rb_utf8_str_new_cstr(str) \
1585 ((RBIMPL_CONSTANT_P(str) ? \
1586 rbimpl_utf8_str_new_cstr : \
1587 rb_utf8_str_new_cstr) (str))
1588
1605#define rb_external_str_new_cstr(str) \
1606 ((RBIMPL_CONSTANT_P(str) ? \
1607 rbimpl_external_str_new_cstr : \
1608 rb_external_str_new_cstr) (str))
1609
1626#define rb_locale_str_new_cstr(str) \
1627 ((RBIMPL_CONSTANT_P(str) ? \
1628 rbimpl_locale_str_new_cstr : \
1629 rb_locale_str_new_cstr) (str))
1630
1640#define rb_str_buf_new_cstr(str) \
1641 ((RBIMPL_CONSTANT_P(str) ? \
1642 rbimpl_str_buf_new_cstr : \
1643 rb_str_buf_new_cstr) (str))
1644
1657#define rb_str_cat_cstr(buf, str) \
1658 ((RBIMPL_CONSTANT_P(str) ? \
1659 rbimpl_str_cat_cstr : \
1660 rb_str_cat_cstr) ((buf), (str)))
1661
1671#define rb_exc_new_cstr(exc, str) \
1672 ((RBIMPL_CONSTANT_P(str) ? \
1673 rbimpl_exc_new_cstr : \
1674 rb_exc_new_cstr) ((exc), (str)))
1675
1676#define rb_str_new2 rb_str_new_cstr
1677#define rb_str_new3 rb_str_new_shared
1678#define rb_str_new4 rb_str_new_frozen
1679#define rb_str_new5 rb_str_new_with_class
1680#define rb_str_buf_new2 rb_str_buf_new_cstr
1681#define rb_usascii_str_new2 rb_usascii_str_new_cstr
1682#define rb_str_buf_cat rb_str_cat
1683#define rb_str_buf_cat2 rb_str_cat_cstr
1684#define rb_str_cat2 rb_str_cat_cstr
1685
1693#define rb_strlen_lit(str) ((sizeof(str "") / sizeof(str ""[0])) - 1)
1694
1706#define rb_str_new_lit(str) rb_str_new_static((str), rb_strlen_lit(str))
1707
1720#define rb_usascii_str_new_lit(str) rb_usascii_str_new_static((str), rb_strlen_lit(str))
1721
1734#define rb_utf8_str_new_lit(str) rb_utf8_str_new_static((str), rb_strlen_lit(str))
1735
1749#define rb_enc_str_new_lit(str, enc) rb_enc_str_new_static((str), rb_strlen_lit(str), (enc))
1750
1751#define rb_str_new_literal(str) rb_str_new_lit(str)
1752#define rb_usascii_str_new_literal(str) rb_usascii_str_new_lit(str)
1753#define rb_utf8_str_new_literal(str) rb_utf8_str_new_lit(str)
1754#define rb_enc_str_new_literal(str, enc) rb_enc_str_new_lit(str, enc)
1755
1756 RBIMPL_SYMBOL_EXPORT_END()
1757
1758#endif /* RBIMPL_INTERN_STRING_H */
constant_p.h
Defines RBIMPL_CONSTANT_P.
deprecated.h
Defines RBIMPL_ATTR_DEPRECATED.
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:74
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:65
rb_str_buf_cat2
#define rb_str_buf_cat2
Old name of rb_usascii_str_new_cstr.
Definition string.h:1683
rb_str_cat2
#define rb_str_cat2
Old name of rb_str_cat_cstr.
Definition string.h:1684
rb_exc_new
VALUE rb_exc_new(VALUE etype, const char *ptr, long len)
Creates an instance of the passed exception class.
Definition error.c:1469
string.h
Public APIs related to rb_cString.
rb_str_free
void rb_str_free(VALUE str)
Destroys the given string for no reason.
Definition string.c:1752
rb_str_new_shared
VALUE rb_str_new_shared(VALUE str)
Identical to rb_str_new_cstr(), except it takes a Ruby's string instead of C's.
Definition string.c:1512
rb_str_plus
VALUE rb_str_plus(VALUE lhs, VALUE rhs)
Generates a new string, concatenating the former to the latter.
Definition string.c:2487
rb_utf8_str_new_cstr
#define rb_utf8_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "UTF-8" encoding.
Definition string.h:1584
rb_str_append
VALUE rb_str_append(VALUE dst, VALUE src)
Identical to rb_str_buf_append(), except it converts the right hand side before concatenating.
Definition string.c:3799
rb_filesystem_str_new
VALUE rb_filesystem_str_new(const char *ptr, long len)
Identical to rb_str_new(), except it generates a string of "filesystem" encoding.
Definition string.c:1423
rb_sym_to_s
VALUE rb_sym_to_s(VALUE sym)
This is an rb_sym2str() + rb_str_dup() combo.
Definition string.c:12344
rb_str_times
VALUE rb_str_times(VALUE str, VALUE num)
Repetition of a string.
Definition string.c:2560
rb_external_str_new
VALUE rb_external_str_new(const char *ptr, long len)
Identical to rb_str_new(), except it generates a string of "defaultexternal" encoding.
Definition string.c:1399
rb_str_tmp_new
VALUE rb_str_tmp_new(long len)
Allocates a "temporary" string.
Definition string.c:1746
rb_str_offset
long rb_str_offset(VALUE str, long pos)
"Inverse" of rb_str_sublen().
Definition string.c:3058
rb_str_succ
VALUE rb_str_succ(VALUE orig)
Searches for the "successor" of a string.
Definition string.c:5341
rb_str_hash_cmp
int rb_str_hash_cmp(VALUE str1, VALUE str2)
Compares two strings.
Definition string.c:4162
rb_str_subseq
VALUE rb_str_subseq(VALUE str, long beg, long len)
Identical to rb_str_substr(), except the numbers are interpreted as byte offsets instead of character...
Definition string.c:3155
rb_str_ellipsize
VALUE rb_str_ellipsize(VALUE str, long len)
Shortens str and adds three dots, an ellipsis, if it is longer than len characters.
Definition string.c:11665
rb_memhash
st_index_t rb_memhash(const void *ptr, long len)
This is a universal hash function.
Definition random.c:1782
rb_str_new
#define rb_str_new(str, len)
Allocates an instance of rb_cString.
Definition string.h:1499
rb_str_shared_replace
void rb_str_shared_replace(VALUE dst, VALUE src)
Replaces the contents of the former with the latter.
Definition string.c:1788
rb_str_buf_cat
#define rb_str_buf_cat
Just another name of rb_str_cat.
Definition string.h:1682
rb_str_new_static
VALUE rb_str_new_static(const char *ptr, long len)
Identical to rb_str_new(), except it takes a C string literal.
Definition string.c:1189
rb_usascii_str_new
#define rb_usascii_str_new(str, len)
Identical to rb_str_new, except it generates a string of "US ASCII" encoding.
Definition string.h:1533
rb_str_capacity
size_t rb_str_capacity(VALUE str)
Queries the capacity of the given string.
Definition string.c:1001
rb_str_new_frozen
VALUE rb_str_new_frozen(VALUE str)
Creates a frozen copy of the string, if necessary.
Definition string.c:1518
rb_str_dup
VALUE rb_str_dup(VALUE str)
Duplicates a string.
Definition string.c:1996
rb_str_modify
void rb_str_modify(VALUE str)
Declares that the string is about to be modified.
Definition string.c:2738
rb_str_hash
st_index_t rb_str_hash(VALUE str)
Calculates a hash value of a string.
Definition string.c:4148
rb_str_cat
VALUE rb_str_cat(VALUE dst, const char *src, long srclen)
Destructively appends the passed contents to the string.
Definition string.c:3567
rb_str_locktmp
VALUE rb_str_locktmp(VALUE str)
Obtains a "temporary lock" of the string.
rb_str_strlen
long rb_str_strlen(VALUE str)
Counts the number of characters (not bytes) that are stored inside of the given string.
Definition string.c:2423
rb_str_resurrect
VALUE rb_str_resurrect(VALUE str)
Like rb_str_dup(), but always create an instance of rb_cString regardless of the given object's class...
Definition string.c:2014
rb_str_buf_new_cstr
#define rb_str_buf_new_cstr(str)
Identical to rb_str_new_cstr, except done differently.
Definition string.h:1640
rb_usascii_str_new_cstr
#define rb_usascii_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "US ASCII" encoding.
Definition string.h:1568
rb_str_replace
VALUE rb_str_replace(VALUE dst, VALUE src)
Replaces the contents of the former object with the stringised contents of the latter.
Definition string.c:6548
rb_str_subpos
char * rb_str_subpos(VALUE str, long beg, long *len)
Identical to rb_str_substr(), except it returns a C's string instead of Ruby's.
Definition string.c:3163
rb_str_setter
rb_gvar_setter_t rb_str_setter
This is a rb_gvar_setter_t that refutes non-string assignments.
Definition string.h:1147
rb_interned_str_cstr
VALUE rb_interned_str_cstr(const char *ptr)
Identical to rb_interned_str(), except it assumes the passed pointer is a pointer to a C's string.
Definition string.c:12722
rb_filesystem_str_new_cstr
VALUE rb_filesystem_str_new_cstr(const char *ptr)
Identical to rb_filesystem_str_new(), except it assumes the passed pointer is a pointer to a C string...
Definition string.c:1429
rb_external_str_new_cstr
#define rb_external_str_new_cstr(str)
Identical to rb_str_new_cstr, except it generates a string of "defaultexternal" encoding.
Definition string.h:1605
rb_str_buf_append
VALUE rb_str_buf_append(VALUE dst, VALUE src)
Identical to rb_str_cat_cstr(), except it takes Ruby's string instead of C's.
Definition string.c:3765
rb_str_sublen
long rb_str_sublen(VALUE str, long pos)
Byte offset to character offset conversion.
Definition string.c:3105
rb_str_equal
VALUE rb_str_equal(VALUE str1, VALUE str2)
Equality of two strings.
Definition string.c:4269
rb_str_set_len
void rb_str_set_len(VALUE str, long len)
Overwrites the length of the string.
Definition string.c:3389
rb_hash_start
st_index_t rb_hash_start(st_index_t i)
Starts a series of hashing.
Definition random.c:1776
rb_str_inspect
VALUE rb_str_inspect(VALUE str)
Generates a "readable" version of the receiver.
Definition string.c:7227
rb_must_asciicompat
void rb_must_asciicompat(VALUE obj)
Asserts that the given string's encoding is (Ruby's definition of) ASCII compatible.
Definition string.c:2792
rb_interned_str
VALUE rb_interned_str(const char *ptr, long len)
Identical to rb_str_new(), except it returns an infamous "f"string.
Definition string.c:12707
rb_str_cmp
int rb_str_cmp(VALUE lhs, VALUE rhs)
Compares two strings, as in strcmp(3).
Definition string.c:4216
rb_str_concat
VALUE rb_str_concat(VALUE dst, VALUE src)
Identical to rb_str_append(), except it also accepts an integer as a codepoint.
Definition string.c:4036
rb_str_comparable
int rb_str_comparable(VALUE str1, VALUE str2)
Checks if two strings are comparable each other or not.
Definition string.c:4191
rb_str_buf_cat_ascii
VALUE rb_str_buf_cat_ascii(VALUE dst, const char *src)
Identical to rb_str_cat_cstr(), except it additionally assumes the source string be a NUL terminated ...
Definition string.c:3741
rb_str_freeze
VALUE rb_str_freeze(VALUE str)
This is the implementation of String#freeze.
Definition string.c:3280
rb_str_update
void rb_str_update(VALUE dst, long beg, long len, VALUE src)
Replaces some (or all) of the contents of the given string.
Definition string.c:5825
rb_str_scrub
VALUE rb_str_scrub(VALUE str, VALUE repl)
"Cleanses" the string.
Definition string.c:11723
rb_locale_str_new_cstr
#define rb_locale_str_new_cstr(str)
Identical to rb_external_str_new_cstr, except it generates a string of "locale" encoding instead of "...
Definition string.h:1626
rb_str_new_with_class
VALUE rb_str_new_with_class(VALUE obj, const char *ptr, long len)
Identical to rb_str_new(), except it takes the class of the allocating object.
Definition string.c:1702
rb_str_dup_frozen
#define rb_str_dup_frozen
Just another name of rb_str_new_frozen.
Definition string.h:632
rb_check_string_type
VALUE rb_check_string_type(VALUE obj)
Try converting an object to its stringised representation using its to_str method,...
Definition string.c:2952
rb_str_substr
VALUE rb_str_substr(VALUE str, long beg, long len)
This is the implementation of two-argumented String#slice.
Definition string.c:3252
rb_str_cat_cstr
#define rb_str_cat_cstr(buf, str)
Identical to rb_str_cat(), except it assumes the passed pointer is a pointer to a C string.
Definition string.h:1657
rb_str_unlocktmp
VALUE rb_str_unlocktmp(VALUE str)
Releases a lock formerly obtained by rb_str_locktmp().
Definition string.c:3371
rb_str_resize
VALUE rb_str_resize(VALUE str, long len)
Overwrites the length of the string.
Definition string.c:3439
rb_utf8_str_new_static
VALUE rb_utf8_str_new_static(const char *ptr, long len)
Identical to rb_str_new_static(), except it generates a string of "UTF-8" encoding instead of "binary...
Definition string.c:1201
rb_utf8_str_new
#define rb_utf8_str_new(str, len)
Identical to rb_str_new, except it generates a string of "UTF-8" encoding.
Definition string.h:1550
rb_str_modify_expand
void rb_str_modify_expand(VALUE str, long capa)
Identical to rb_str_modify(), except it additionally expands the capacity of the receiver.
Definition string.c:2746
rb_str_dump
VALUE rb_str_dump(VALUE str)
"Inverse" of rb_eval_string().
Definition string.c:7334
rb_locale_str_new
VALUE rb_locale_str_new(const char *ptr, long len)
Identical to rb_str_new(), except it generates a string of "locale" encoding.
Definition string.c:1411
rb_str_buf_new
VALUE rb_str_buf_new(long capa)
Allocates a "string buffer".
Definition string.c:1718
rb_str_length
VALUE rb_str_length(VALUE)
Identical to rb_str_strlen(), except it returns the value in rb_cInteger.
Definition string.c:2437
rb_str_new_cstr
#define rb_str_new_cstr(str)
Identical to rb_str_new, except it assumes the passed pointer is a pointer to a C string.
Definition string.h:1515
rb_str_drop_bytes
VALUE rb_str_drop_bytes(VALUE str, long len)
Shrinks the given string for the given number of bytes.
Definition string.c:5743
rb_str_split
VALUE rb_str_split(VALUE str, const char *delim)
Divides the given string based on the given delimiter.
Definition string.c:9341
rb_usascii_str_new_static
VALUE rb_usascii_str_new_static(const char *ptr, long len)
Identical to rb_str_new_static(), except it generates a string of "US ASCII" encoding instead of "bin...
Definition string.c:1195
rb_str_intern
VALUE rb_str_intern(VALUE str)
Identical to rb_to_symbol(), except it assumes the receiver being an instance of RString.
Definition symbol.c:937
rb_obj_as_string
VALUE rb_obj_as_string(VALUE obj)
Try converting an object to its stringised representation using its to_s method, if any.
Definition string.c:1850
variable.h
Declares rb_define_variable().
rb_gvar_setter_t
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Type that represents a global variable setter function.
Definition variable.h:46
capa
int capa
Designed capacity of the buffer.
Definition io.h:11
len
int len
Length of the buffer.
Definition io.h:8
nonnull.h
Defines RBIMPL_ATTR_NONNULL.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull)).
Definition nonnull.h:30
inline
#define inline
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Definition defines.h:91
pure.h
Defines RBIMPL_ATTR_PURE.
RBIMPL_ATTR_PURE
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure)).
Definition pure.h:33
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40