Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Enumerations | Functions | Variables
array.c File Reference
#include "internal.h"
#include "ruby/util.h"
#include "ruby/st.h"
#include "probes.h"
#include "id.h"
#include "debug_counter.h"
#include "ruby_assert.h"

Go to the source code of this file.

Data Structures

struct  ary_sort_data
 
struct  select_bang_arg
 

Macros

#define NDEBUG
 
#define id_cmp   idCmp
 
#define ARY_DEFAULT_SIZE   16
 
#define ARY_MAX_SIZE   (LONG_MAX / (int)sizeof(VALUE))
 
#define SMALL_ARRAY_LEN   16
 
#define ARY_SHARED_P(ary)
 
#define ARY_EMBED_P(ary)
 
#define ARY_HEAP_PTR(a)   (assert(!ARY_EMBED_P(a)), RARRAY(a)->as.heap.ptr)
 
#define ARY_HEAP_LEN(a)   (assert(!ARY_EMBED_P(a)), RARRAY(a)->as.heap.len)
 
#define ARY_EMBED_PTR(a)   (assert(ARY_EMBED_P(a)), RARRAY(a)->as.ary)
 
#define ARY_EMBED_LEN(a)
 
#define ARY_HEAP_SIZE(a)   (assert(!ARY_EMBED_P(a)), assert(ARY_OWNS_HEAP_P(a)), RARRAY(a)->as.heap.aux.capa * sizeof(VALUE))
 
#define ARY_OWNS_HEAP_P(a)   (!FL_TEST((a), ELTS_SHARED|RARRAY_EMBED_FLAG))
 
#define FL_SET_EMBED(a)
 
#define FL_UNSET_EMBED(ary)   FL_UNSET((ary), RARRAY_EMBED_FLAG|RARRAY_EMBED_LEN_MASK)
 
#define FL_SET_SHARED(ary)
 
#define FL_UNSET_SHARED(ary)   FL_UNSET((ary), ELTS_SHARED)
 
#define ARY_SET_PTR(ary, p)
 
#define ARY_SET_EMBED_LEN(ary, n)
 
#define ARY_SET_HEAP_LEN(ary, n)
 
#define ARY_SET_LEN(ary, n)
 
#define ARY_INCREASE_PTR(ary, n)
 
#define ARY_INCREASE_LEN(ary, n)
 
#define ARY_CAPA(ary)
 
#define ARY_SET_CAPA(ary, n)
 
#define ARY_SHARED(ary)   (assert(ARY_SHARED_P(ary)), RARRAY(ary)->as.heap.aux.shared)
 
#define ARY_SET_SHARED(ary, value)
 
#define RARRAY_SHARED_ROOT_FLAG   FL_USER5
 
#define ARY_SHARED_ROOT_P(ary)   (FL_TEST((ary), RARRAY_SHARED_ROOT_FLAG))
 
#define ARY_SHARED_NUM(ary)   (assert(ARY_SHARED_ROOT_P(ary)), RARRAY(ary)->as.heap.aux.capa)
 
#define ARY_SHARED_OCCUPIED(ary)   (ARY_SHARED_NUM(ary) == 1)
 
#define ARY_SET_SHARED_NUM(ary, value)
 
#define FL_SET_SHARED_ROOT(ary)
 
#define ARY_SET(a, i, v)   RARRAY_ASET((assert(!ARY_SHARED_P(a)), (a)), (i), (v))
 
#define OPTHASH_GIVEN_P(opts)   (argc > 0 && !NIL_P((opts) = rb_check_hash_type(argv[argc-1])) && (--argc, 1))
 
#define RAND_UPTO(max)   (long)rb_random_ulong_limited((randgen), (max)-1)
 
#define RUBY_UNTYPED_DATA_WARNING   0
 
#define tmpbuf(n, size)   rb_str_tmp_new((n)*(size))
 
#define tmpbuf_discard(s)   (rb_str_resize((s), 0L), RBASIC_SET_CLASS_RAW(s, rb_cString))
 
#define tmpary(n)   rb_ary_tmp_new(n)
 
#define tmpary_discard(a)   (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))
 
#define rb_intern(str)   rb_intern_const(str)
 

Enumerations

enum  ary_take_pos_flags { ARY_TAKE_FIRST = 0, ARY_TAKE_LAST = 1 }
 

Functions

void rb_mem_clear (register VALUE *mem, register long size)
 
void rb_ary_modify (VALUE ary)
 
VALUE rb_ary_freeze (VALUE ary)
 
VALUE rb_ary_shared_with_p (VALUE ary1, VALUE ary2)
 
VALUE rb_ary_new_capa (long capa)
 
VALUE rb_ary_new (void)
 
VALUE() rb_ary_new_from_args (long n,...)
 
VALUE rb_ary_tmp_new_from_values (VALUE klass, long n, const VALUE *elts)
 
VALUE rb_ary_new_from_values (long n, const VALUE *elts)
 
VALUE rb_ary_tmp_new (long capa)
 
VALUE rb_ary_tmp_new_fill (long capa)
 
void rb_ary_free (VALUE ary)
 
RUBY_FUNC_EXPORTED size_t rb_ary_memsize (VALUE ary)
 
VALUE rb_assoc_new (VALUE car, VALUE cdr)
 
VALUE rb_check_array_type (VALUE ary)
 
void rb_ary_store (VALUE ary, long idx, VALUE val)
 
VALUE rb_ary_push (VALUE ary, VALUE item)
 
VALUE rb_ary_cat (VALUE ary, const VALUE *argv, long len)
 
VALUE rb_ary_pop (VALUE ary)
 
VALUE rb_ary_shift (VALUE ary)
 
VALUE rb_ary_unshift (VALUE ary, VALUE item)
 
VALUE rb_ary_entry (VALUE ary, long offset)
 
VALUE rb_ary_subseq (VALUE ary, long beg, long len)
 
VALUE rb_ary_aref (int argc, const VALUE *argv, VALUE ary)
 
VALUE rb_ary_at (VALUE ary, VALUE pos)
 
VALUE rb_ary_last (int argc, const VALUE *argv, VALUE ary)
 
VALUE rb_ary_to_ary (VALUE obj)
 
void rb_ary_set_len (VALUE ary, long len)
 
VALUE rb_ary_resize (VALUE ary, long len)
 expands or shrinks ary to len elements. More...
 
VALUE rb_ary_each (VALUE ary)
 
VALUE rb_ary_dup (VALUE ary)
 
VALUE rb_ary_resurrect (VALUE ary)
 
VALUE rb_ary_join (VALUE ary, VALUE sep)
 
VALUE rb_ary_to_s (VALUE ary)
 
VALUE rb_ary_reverse (VALUE ary)
 
VALUE rb_ary_rotate (VALUE ary, long cnt)
 
VALUE rb_ary_sort_bang (VALUE ary)
 
VALUE rb_ary_sort (VALUE ary)
 
VALUE rb_get_values_at (VALUE obj, long olen, int argc, const VALUE *argv, VALUE(*func)(VALUE, long))
 
VALUE rb_ary_delete (VALUE ary, VALUE item)
 
void rb_ary_delete_same (VALUE ary, VALUE item)
 
VALUE rb_ary_delete_at (VALUE ary, long pos)
 
VALUE rb_ary_replace (VALUE copy, VALUE orig)
 
VALUE rb_ary_clear (VALUE ary)
 
VALUE rb_ary_plus (VALUE x, VALUE y)
 
VALUE rb_ary_concat (VALUE x, VALUE y)
 
VALUE rb_ary_assoc (VALUE ary, VALUE key)
 
VALUE rb_ary_rassoc (VALUE ary, VALUE value)
 
VALUE rb_ary_includes (VALUE ary, VALUE item)
 
VALUE rb_ary_cmp (VALUE ary1, VALUE ary2)
 
VALUE rb_ary_dig (int argc, VALUE *argv, VALUE self)
 
void Init_Array (void)
 

Variables

VALUE rb_cArray
 
VALUE rb_output_fs
 

Macro Definition Documentation

◆ ARY_CAPA

#define ARY_CAPA (   ary)
Value:
ARY_SHARED_ROOT_P(ary) ? RARRAY_LEN(ary) : RARRAY(ary)->as.heap.aux.capa)
#define RARRAY_LEN(a)
Definition: ruby.h:1019
#define RARRAY(obj)
Definition: ruby.h:1203
#define ARY_EMBED_P(ary)
Definition: array.c:38

Definition at line 103 of file array.c.

Referenced by rb_ary_memsize(), rb_ary_resize(), and rb_ary_store().

◆ ARY_DEFAULT_SIZE

#define ARY_DEFAULT_SIZE   16

Definition at line 31 of file array.c.

◆ ARY_EMBED_LEN

#define ARY_EMBED_LEN (   a)
Value:
(long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
#define RBASIC(obj)
Definition: ruby.h:1197
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define assert
Definition: ruby_assert.h:37

Definition at line 45 of file array.c.

◆ ARY_EMBED_P

#define ARY_EMBED_P (   ary)
Value:
FL_TEST((ary), RARRAY_EMBED_FLAG)!=0)
#define ELTS_SHARED
Definition: ruby.h:937
#define FL_TEST(x, f)
Definition: ruby.h:1282
#define assert
Definition: ruby_assert.h:37

Definition at line 38 of file array.c.

Referenced by rb_ary_shared_with_p().

◆ ARY_EMBED_PTR

#define ARY_EMBED_PTR (   a)    (assert(ARY_EMBED_P(a)), RARRAY(a)->as.ary)

Definition at line 44 of file array.c.

◆ ARY_HEAP_LEN

#define ARY_HEAP_LEN (   a)    (assert(!ARY_EMBED_P(a)), RARRAY(a)->as.heap.len)

Definition at line 43 of file array.c.

◆ ARY_HEAP_PTR

#define ARY_HEAP_PTR (   a)    (assert(!ARY_EMBED_P(a)), RARRAY(a)->as.heap.ptr)

Definition at line 42 of file array.c.

Referenced by rb_ary_free().

◆ ARY_HEAP_SIZE

#define ARY_HEAP_SIZE (   a)    (assert(!ARY_EMBED_P(a)), assert(ARY_OWNS_HEAP_P(a)), RARRAY(a)->as.heap.aux.capa * sizeof(VALUE))

Definition at line 49 of file array.c.

Referenced by rb_ary_free().

◆ ARY_INCREASE_LEN

#define ARY_INCREASE_LEN (   ary,
 
)
Value:
do { \
assert(!OBJ_FROZEN(ary)); \
if (ARY_EMBED_P(ary)) { \
ARY_SET_EMBED_LEN((ary), RARRAY_LEN(ary)+(n)); \
} \
else { \
RARRAY(ary)->as.heap.len += (n); \
} \
} while (0)
#define RARRAY_LEN(a)
Definition: ruby.h:1019
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define OBJ_FROZEN(x)
Definition: ruby.h:1304

Definition at line 93 of file array.c.

Referenced by rb_ary_delete_at().

◆ ARY_INCREASE_PTR

#define ARY_INCREASE_PTR (   ary,
 
)
Value:
do { \
assert(!ARY_EMBED_P(ary)); \
assert(!OBJ_FROZEN(ary)); \
RARRAY(ary)->as.heap.ptr += (n); \
} while (0)
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define OBJ_FROZEN(x)
Definition: ruby.h:1304

Definition at line 88 of file array.c.

◆ ARY_MAX_SIZE

#define ARY_MAX_SIZE   (LONG_MAX / (int)sizeof(VALUE))

Definition at line 32 of file array.c.

Referenced by rb_ary_resize(), and rb_ary_store().

◆ ARY_OWNS_HEAP_P

#define ARY_OWNS_HEAP_P (   a)    (!FL_TEST((a), ELTS_SHARED|RARRAY_EMBED_FLAG))

Definition at line 51 of file array.c.

Referenced by rb_ary_free(), and rb_ary_memsize().

◆ ARY_SET

#define ARY_SET (   a,
  i,
 
)    RARRAY_ASET((assert(!ARY_SHARED_P(a)), (a)), (i), (v))

Definition at line 135 of file array.c.

Referenced by rb_ary_new_from_args().

◆ ARY_SET_CAPA

#define ARY_SET_CAPA (   ary,
 
)
Value:
do { \
assert(!ARY_EMBED_P(ary)); \
assert(!ARY_SHARED_P(ary)); \
assert(!OBJ_FROZEN(ary)); \
RARRAY(ary)->as.heap.aux.capa = (n); \
} while (0)
#define ARY_SHARED_P(ary)
Definition: array.c:35
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define OBJ_FROZEN(x)
Definition: ruby.h:1304

Definition at line 105 of file array.c.

◆ ARY_SET_EMBED_LEN

#define ARY_SET_EMBED_LEN (   ary,
 
)
Value:
do { \
long tmp_n = (n); \
assert(ARY_EMBED_P(ary)); \
assert(!OBJ_FROZEN(ary)); \
RBASIC(ary)->flags &= ~RARRAY_EMBED_LEN_MASK; \
RBASIC(ary)->flags |= (tmp_n) << RARRAY_EMBED_LEN_SHIFT; \
} while (0)
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define OBJ_FROZEN(x)
Definition: ruby.h:1304

Definition at line 68 of file array.c.

◆ ARY_SET_HEAP_LEN

#define ARY_SET_HEAP_LEN (   ary,
 
)
Value:
do { \
assert(!ARY_EMBED_P(ary)); \
RARRAY(ary)->as.heap.len = (n); \
} while (0)
#define ARY_EMBED_P(ary)
Definition: array.c:38

Definition at line 75 of file array.c.

◆ ARY_SET_LEN

#define ARY_SET_LEN (   ary,
 
)
Value:
do { \
if (ARY_EMBED_P(ary)) { \
ARY_SET_EMBED_LEN((ary), (n)); \
} \
else { \
ARY_SET_HEAP_LEN((ary), (n)); \
} \
assert(RARRAY_LEN(ary) == (n)); \
} while (0)
#define RARRAY_LEN(a)
Definition: ruby.h:1019
#define ARY_EMBED_P(ary)
Definition: array.c:38

Definition at line 79 of file array.c.

Referenced by rb_ary_new_from_args().

◆ ARY_SET_PTR

#define ARY_SET_PTR (   ary,
 
)
Value:
do { \
assert(!ARY_EMBED_P(ary)); \
assert(!OBJ_FROZEN(ary)); \
RARRAY(ary)->as.heap.ptr = (p); \
} while (0)
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define OBJ_FROZEN(x)
Definition: ruby.h:1304

Definition at line 63 of file array.c.

◆ ARY_SET_SHARED

#define ARY_SET_SHARED (   ary,
  value 
)
Value:
do { \
const VALUE _ary_ = (ary); \
const VALUE _value_ = (value); \
assert(!ARY_EMBED_P(_ary_)); \
assert(ARY_SHARED_P(_ary_)); \
assert(ARY_SHARED_ROOT_P(_value_)); \
RB_OBJ_WRITE(_ary_, &RARRAY(_ary_)->as.heap.aux.shared, _value_); \
} while (0)
#define ARY_SHARED_ROOT_P(ary)
Definition: array.c:122
#define ARY_SHARED_P(ary)
Definition: array.c:35
#define RARRAY(obj)
Definition: ruby.h:1203
unsigned long VALUE
Definition: ruby.h:85
#define ARY_EMBED_P(ary)
Definition: array.c:38

Definition at line 113 of file array.c.

◆ ARY_SET_SHARED_NUM

#define ARY_SET_SHARED_NUM (   ary,
  value 
)
Value:
do { \
assert(ARY_SHARED_ROOT_P(ary)); \
RARRAY(ary)->as.heap.aux.capa = (value); \
} while (0)
#define ARY_SHARED_ROOT_P(ary)
Definition: array.c:122

Definition at line 126 of file array.c.

◆ ARY_SHARED

#define ARY_SHARED (   ary)    (assert(ARY_SHARED_P(ary)), RARRAY(ary)->as.heap.aux.shared)

Definition at line 112 of file array.c.

◆ ARY_SHARED_NUM

#define ARY_SHARED_NUM (   ary)    (assert(ARY_SHARED_ROOT_P(ary)), RARRAY(ary)->as.heap.aux.capa)

Definition at line 123 of file array.c.

◆ ARY_SHARED_OCCUPIED

#define ARY_SHARED_OCCUPIED (   ary)    (ARY_SHARED_NUM(ary) == 1)

Definition at line 125 of file array.c.

◆ ARY_SHARED_P

#define ARY_SHARED_P (   ary)
Value:
FL_TEST((ary),ELTS_SHARED)!=0)
#define ELTS_SHARED
Definition: ruby.h:937
#define FL_TEST(x, f)
Definition: ruby.h:1282
#define assert
Definition: ruby_assert.h:37

Definition at line 35 of file array.c.

Referenced by rb_ary_shared_with_p(), and rb_ary_sort_bang().

◆ ARY_SHARED_ROOT_P

#define ARY_SHARED_ROOT_P (   ary)    (FL_TEST((ary), RARRAY_SHARED_ROOT_FLAG))

Definition at line 122 of file array.c.

◆ FL_SET_EMBED

#define FL_SET_EMBED (   a)
Value:
do { \
assert(!ARY_SHARED_P(a)); \
FL_SET((a), RARRAY_EMBED_FLAG); \
} while (0)
#define ARY_SHARED_P(ary)
Definition: array.c:35

Definition at line 52 of file array.c.

◆ FL_SET_SHARED

#define FL_SET_SHARED (   ary)
Value:
do { \
assert(!ARY_EMBED_P(ary)); \
FL_SET((ary), ELTS_SHARED); \
} while (0)
#define ELTS_SHARED
Definition: ruby.h:937
#define ARY_EMBED_P(ary)
Definition: array.c:38

Definition at line 57 of file array.c.

◆ FL_SET_SHARED_ROOT

#define FL_SET_SHARED_ROOT (   ary)
Value:
do { \
assert(!ARY_EMBED_P(ary)); \
FL_SET((ary), RARRAY_SHARED_ROOT_FLAG); \
} while (0)
#define ARY_EMBED_P(ary)
Definition: array.c:38
#define RARRAY_SHARED_ROOT_FLAG
Definition: array.c:121

Definition at line 130 of file array.c.

◆ FL_UNSET_EMBED

#define FL_UNSET_EMBED (   ary)    FL_UNSET((ary), RARRAY_EMBED_FLAG|RARRAY_EMBED_LEN_MASK)

Definition at line 56 of file array.c.

◆ FL_UNSET_SHARED

#define FL_UNSET_SHARED (   ary)    FL_UNSET((ary), ELTS_SHARED)

Definition at line 61 of file array.c.

◆ id_cmp

#define id_cmp   idCmp

Definition at line 29 of file array.c.

◆ NDEBUG

#define NDEBUG

Definition at line 22 of file array.c.

◆ OPTHASH_GIVEN_P

#define OPTHASH_GIVEN_P (   opts)    (argc > 0 && !NIL_P((opts) = rb_check_hash_type(argv[argc-1])) && (--argc, 1))

Definition at line 4746 of file array.c.

◆ RAND_UPTO

#define RAND_UPTO (   max)    (long)rb_random_ulong_limited((randgen), (max)-1)

Definition at line 4750 of file array.c.

◆ RARRAY_SHARED_ROOT_FLAG

#define RARRAY_SHARED_ROOT_FLAG   FL_USER5

Definition at line 121 of file array.c.

◆ rb_intern

#define rb_intern (   str)    rb_intern_const(str)

◆ RUBY_UNTYPED_DATA_WARNING

#define RUBY_UNTYPED_DATA_WARNING   0

◆ SMALL_ARRAY_LEN

#define SMALL_ARRAY_LEN   16

Definition at line 33 of file array.c.

◆ tmpary

#define tmpary (   n)    rb_ary_tmp_new(n)

Definition at line 5057 of file array.c.

◆ tmpary_discard

#define tmpary_discard (   a)    (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))

Definition at line 5058 of file array.c.

◆ tmpbuf

#define tmpbuf (   n,
  size 
)    rb_str_tmp_new((n)*(size))

Definition at line 5055 of file array.c.

◆ tmpbuf_discard

#define tmpbuf_discard (   s)    (rb_str_resize((s), 0L), RBASIC_SET_CLASS_RAW(s, rb_cString))

Definition at line 5056 of file array.c.

Enumeration Type Documentation

◆ ary_take_pos_flags

Enumerator
ARY_TAKE_FIRST 
ARY_TAKE_LAST 

Definition at line 878 of file array.c.

Function Documentation

◆ Init_Array()

void Init_Array ( void  )

◆ rb_ary_aref()

VALUE rb_ary_aref ( int  argc,
const VALUE argv,
VALUE  ary 
)

◆ rb_ary_assoc()

VALUE rb_ary_assoc ( VALUE  ary,
VALUE  key 
)

Definition at line 3792 of file array.c.

References NIL_P, Qnil, RARRAY_AREF, RARRAY_LEN, rb_check_array_type(), and rb_equal().

◆ rb_ary_at()

VALUE rb_ary_at ( VALUE  ary,
VALUE  pos 
)

Definition at line 1332 of file array.c.

References NUM2LONG, and rb_ary_entry().

Referenced by rb_ary_dig().

◆ rb_ary_cat()

VALUE rb_ary_cat ( VALUE  ary,
const VALUE argv,
long  len 
)

Definition at line 936 of file array.c.

References RARRAY_LEN.

◆ rb_ary_clear()

VALUE rb_ary_clear ( VALUE  ary)

Definition at line 3501 of file array.c.

Referenced by rb_threadptr_pending_interrupt_clear().

◆ rb_ary_cmp()

VALUE rb_ary_cmp ( VALUE  ary1,
VALUE  ary2 
)

Definition at line 4055 of file array.c.

References INT2FIX, len, NIL_P, Qnil, rb_check_array_type(), and rb_exec_recursive_paired().

◆ rb_ary_concat()

VALUE rb_ary_concat ( VALUE  x,
VALUE  y 
)

Definition at line 3703 of file array.c.

◆ rb_ary_delete()

VALUE rb_ary_delete ( VALUE  ary,
VALUE  item 
)

Definition at line 3006 of file array.c.

References Qnil, RARRAY_AREF, RARRAY_LEN, rb_ary_store(), rb_block_given_p(), rb_equal(), and rb_yield().

◆ rb_ary_delete_at()

VALUE rb_ary_delete_at ( VALUE  ary,
long  pos 
)

Definition at line 3059 of file array.c.

References ARY_INCREASE_LEN, len, MEMMOVE, Qnil, RARRAY_AREF, RARRAY_LEN, RARRAY_PTR_USE, and rb_ary_modify().

◆ rb_ary_delete_same()

void rb_ary_delete_same ( VALUE  ary,
VALUE  item 
)

Definition at line 3036 of file array.c.

References RARRAY_AREF, RARRAY_LEN, and rb_ary_store().

◆ rb_ary_dig()

VALUE rb_ary_dig ( int  argc,
VALUE argv,
VALUE  self 
)

Definition at line 5799 of file array.c.

References argv, Qnil, rb_ary_at(), rb_check_arity, rb_obj_dig(), and UNLIMITED_ARGUMENTS.

◆ rb_ary_dup()

VALUE rb_ary_dup ( VALUE  ary)

Definition at line 1930 of file array.c.

References RARRAY_LEN, and rb_ary_new2.

Referenced by rb_ary_sort().

◆ rb_ary_each()

VALUE rb_ary_each ( VALUE  ary)

Definition at line 1821 of file array.c.

References RETURN_SIZED_ENUMERATOR.

◆ rb_ary_entry()

VALUE rb_ary_entry ( VALUE  ary,
long  offset 
)

Definition at line 1215 of file array.c.

References len, Qnil, RARRAY_CONST_PTR, and RARRAY_LEN.

Referenced by rb_ary_aref(), rb_ary_at(), and rb_error_frozen_object().

◆ rb_ary_free()

void rb_ary_free ( VALUE  ary)

◆ rb_ary_freeze()

VALUE rb_ary_freeze ( VALUE  ary)

Definition at line 409 of file array.c.

References rb_obj_freeze().

◆ rb_ary_includes()

VALUE rb_ary_includes ( VALUE  ary,
VALUE  item 
)

Definition at line 3975 of file array.c.

References Qfalse, Qtrue, RARRAY_AREF, RARRAY_LEN, and rb_equal().

◆ rb_ary_join()

VALUE rb_ary_join ( VALUE  ary,
VALUE  sep 
)

Definition at line 2037 of file array.c.

References FALSE, and val.

◆ rb_ary_last()

VALUE rb_ary_last ( int  argc,
const VALUE argv,
VALUE  ary 
)

Definition at line 1380 of file array.c.

References Qnil, RARRAY_AREF, and RARRAY_LEN.

Referenced by rb_gc_register_mark_object().

◆ rb_ary_memsize()

RUBY_FUNC_EXPORTED size_t rb_ary_memsize ( VALUE  ary)

Definition at line 571 of file array.c.

References ARY_CAPA, and ARY_OWNS_HEAP_P.

◆ rb_ary_modify()

void rb_ary_modify ( VALUE  ary)

◆ rb_ary_new()

VALUE rb_ary_new ( void  )

◆ rb_ary_new_capa()

VALUE rb_ary_new_capa ( long  capa)

Definition at line 493 of file array.c.

Referenced by rb_hash_keys(), and rb_hash_values().

◆ rb_ary_new_from_args()

VALUE() rb_ary_new_from_args ( long  n,
  ... 
)

Definition at line 505 of file array.c.

References ARY_SET, ARY_SET_LEN, and rb_ary_new2.

Referenced by rb_iseq_pathobj_new().

◆ rb_ary_new_from_values()

VALUE rb_ary_new_from_values ( long  n,
const VALUE elts 
)

Definition at line 538 of file array.c.

References rb_ary_tmp_new_from_values(), and rb_cArray.

◆ rb_ary_plus()

VALUE rb_ary_plus ( VALUE  x,
VALUE  y 
)

Definition at line 3635 of file array.c.

References len.

◆ rb_ary_pop()

VALUE rb_ary_pop ( VALUE  ary)

Definition at line 968 of file array.c.

◆ rb_ary_push()

VALUE rb_ary_push ( VALUE  ary,
VALUE  item 
)

◆ rb_ary_rassoc()

VALUE rb_ary_rassoc ( VALUE  ary,
VALUE  value 
)

Definition at line 3825 of file array.c.

References Qnil, RARRAY_AREF, RARRAY_LEN, rb_equal(), RB_TYPE_P, and T_ARRAY.

◆ rb_ary_replace()

VALUE rb_ary_replace ( VALUE  copy,
VALUE  orig 
)

Definition at line 3451 of file array.c.

◆ rb_ary_resize()

VALUE rb_ary_resize ( VALUE  ary,
long  len 
)

expands or shrinks ary to len elements.

expanded region will be filled with Qnil.

Parameters
aryan array
lennew size
Returns
ary
Postcondition
the size of ary is len.

Definition at line 1648 of file array.c.

References ARY_CAPA, ARY_MAX_SIZE, RARRAY_LEN, rb_ary_modify(), rb_eIndexError, and rb_raise().

Referenced by rb_get_values_at().

◆ rb_ary_resurrect()

VALUE rb_ary_resurrect ( VALUE  ary)

Definition at line 1940 of file array.c.

References RARRAY_CONST_PTR, RARRAY_LEN, rb_ary_new4, and rb_output_fs.

◆ rb_ary_reverse()

VALUE rb_ary_reverse ( VALUE  ary)

Definition at line 2224 of file array.c.

References RARRAY_LEN, RARRAY_PTR_USE, and rb_ary_modify().

◆ rb_ary_rotate()

VALUE rb_ary_rotate ( VALUE  ary,
long  cnt 
)

Definition at line 2288 of file array.c.

References RARRAY_LEN, RARRAY_PTR, and rb_ary_modify().

◆ rb_ary_set_len()

void rb_ary_set_len ( VALUE  ary,
long  len 
)

Definition at line 1625 of file array.c.

Referenced by rb_hash_keys(), and rb_hash_values().

◆ rb_ary_shared_with_p()

VALUE rb_ary_shared_with_p ( VALUE  ary1,
VALUE  ary2 
)

Definition at line 437 of file array.c.

References ARY_EMBED_P, ARY_SHARED_P, Qfalse, Qtrue, and RARRAY.

Referenced by rb_get_expanded_load_path().

◆ rb_ary_shift()

VALUE rb_ary_shift ( VALUE  ary)

Definition at line 1019 of file array.c.

References RARRAY_LEN, and top.

◆ rb_ary_sort()

VALUE rb_ary_sort ( VALUE  ary)

Definition at line 2549 of file array.c.

References ary_sort_data::ary, rb_ary_dup(), and rb_ary_sort_bang().

◆ rb_ary_sort_bang()

VALUE rb_ary_sort_bang ( VALUE  ary)

Definition at line 2465 of file array.c.

References ARY_SHARED_P, assert, RARRAY_LEN, and rb_ary_modify().

Referenced by rb_ary_sort().

◆ rb_ary_store()

void rb_ary_store ( VALUE  ary,
long  idx,
VALUE  val 
)

◆ rb_ary_subseq()

VALUE rb_ary_subseq ( VALUE  ary,
long  beg,
long  len 
)

Definition at line 1231 of file array.c.

References Qnil, RARRAY_LEN, and rb_obj_class().

Referenced by rb_apply(), and rb_ary_aref().

◆ rb_ary_tmp_new()

VALUE rb_ary_tmp_new ( long  capa)

◆ rb_ary_tmp_new_fill()

VALUE rb_ary_tmp_new_fill ( long  capa)

Definition at line 550 of file array.c.

◆ rb_ary_tmp_new_from_values()

VALUE rb_ary_tmp_new_from_values ( VALUE  klass,
long  n,
const VALUE elts 
)

Definition at line 524 of file array.c.

Referenced by rb_ary_new_from_values().

◆ rb_ary_to_ary()

VALUE rb_ary_to_ary ( VALUE  obj)

Definition at line 1553 of file array.c.

References NIL_P, rb_ary_new3, and rb_check_array_type().

◆ rb_ary_to_s()

VALUE rb_ary_to_s ( VALUE  ary)

Definition at line 2143 of file array.c.

◆ rb_ary_unshift()

VALUE rb_ary_unshift ( VALUE  ary,
VALUE  item 
)

Definition at line 1197 of file array.c.

◆ rb_assoc_new()

VALUE rb_assoc_new ( VALUE  car,
VALUE  cdr 
)

Definition at line 639 of file array.c.

References rb_ary_new3.

Referenced by rb_big_divrem_normal(), and rsock_ipaddr().

◆ rb_check_array_type()

VALUE rb_check_array_type ( VALUE  ary)

Definition at line 651 of file array.c.

References rb_check_convert_type_with_id(), and T_ARRAY.

Referenced by rb_Array(), rb_ary_assoc(), rb_ary_cmp(), rb_ary_to_ary(), and rb_yield_splat().

◆ rb_get_values_at()

VALUE rb_get_values_at ( VALUE  obj,
long  olen,
int  argc,
const VALUE argv,
VALUE(*)(VALUE, long)  func 
)

◆ rb_mem_clear()

void rb_mem_clear ( register VALUE mem,
register long  size 
)

Definition at line 138 of file array.c.

References Qnil.

Variable Documentation

◆ rb_cArray

VALUE rb_cArray

Definition at line 26 of file array.c.

Referenced by Init_Array(), Init_pack(), and rb_ary_new_from_values().

◆ rb_output_fs

VALUE rb_output_fs

Definition at line 515 of file intern.h.

Referenced by rb_ary_resurrect(), and rb_io_print().