mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
90ac549fa6
commit
f926f799e9
5 changed files with 33 additions and 33 deletions
48
array.c
48
array.c
|
@ -108,7 +108,7 @@ VALUE rb_cArray;
|
|||
} while (0)
|
||||
|
||||
#define ARY_CAPA(ary) (ARY_EMBED_P(ary) ? RARRAY_EMBED_LEN_MAX : \
|
||||
ARY_SHARED_ROOT_P(ary) ? RARRAY_LEN(ary) : ARY_HEAP_CAPA(ary))
|
||||
ARY_SHARED_ROOT_P(ary) ? RARRAY_LEN(ary) : ARY_HEAP_CAPA(ary))
|
||||
#define ARY_SET_CAPA(ary, n) do { \
|
||||
assert(!ARY_EMBED_P(ary)); \
|
||||
assert(!ARY_SHARED_P(ary)); \
|
||||
|
@ -409,7 +409,7 @@ ary_resize_capa(VALUE ary, long capacity)
|
|||
if (!ARY_EMBED_P(ary)) {
|
||||
long len = ARY_HEAP_LEN(ary);
|
||||
long old_capa = ARY_HEAP_CAPA(ary);
|
||||
const VALUE *ptr = ARY_HEAP_PTR(ary);
|
||||
const VALUE *ptr = ARY_HEAP_PTR(ary);
|
||||
|
||||
if (len > capacity) len = capacity;
|
||||
MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len);
|
||||
|
@ -529,7 +529,7 @@ rb_ary_modify(VALUE ary)
|
|||
else if (ARY_SHARED_OCCUPIED(shared) && len > ((shared_len = RARRAY_LEN(shared))>>1)) {
|
||||
long shift = RARRAY_CONST_PTR_TRANSIENT(ary) - RARRAY_CONST_PTR_TRANSIENT(shared);
|
||||
FL_UNSET_SHARED(ary);
|
||||
ARY_SET_PTR(ary, RARRAY_CONST_PTR_TRANSIENT(shared));
|
||||
ARY_SET_PTR(ary, RARRAY_CONST_PTR_TRANSIENT(shared));
|
||||
ARY_SET_CAPA(ary, shared_len);
|
||||
RARRAY_PTR_USE(ary, ptr, {
|
||||
MEMMOVE(ptr, ptr+shift, VALUE, len);
|
||||
|
@ -564,7 +564,7 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
|
|||
if (new_len > RARRAY_EMBED_LEN_MAX) {
|
||||
VALUE shared = ARY_SHARED(ary);
|
||||
if (ARY_SHARED_OCCUPIED(shared)) {
|
||||
if (ARY_HEAP_PTR(ary) - RARRAY_CONST_PTR_TRANSIENT(shared) + new_len <= RARRAY_LEN(shared)) {
|
||||
if (ARY_HEAP_PTR(ary) - RARRAY_CONST_PTR_TRANSIENT(shared) + new_len <= RARRAY_LEN(shared)) {
|
||||
rb_ary_modify_check(ary);
|
||||
|
||||
ary_verify(ary);
|
||||
|
@ -811,7 +811,7 @@ ary_make_shared(VALUE ary)
|
|||
|
||||
FL_UNSET_EMBED(shared);
|
||||
ARY_SET_LEN((VALUE)shared, capa);
|
||||
ARY_SET_PTR((VALUE)shared, ptr);
|
||||
ARY_SET_PTR((VALUE)shared, ptr);
|
||||
ary_mem_clear((VALUE)shared, len, capa - len);
|
||||
FL_SET_SHARED_ROOT(shared);
|
||||
ARY_SET_SHARED_NUM((VALUE)shared, 1);
|
||||
|
@ -832,7 +832,7 @@ ary_make_substitution(VALUE ary)
|
|||
|
||||
if (len <= RARRAY_EMBED_LEN_MAX) {
|
||||
VALUE subst = rb_ary_new2(len);
|
||||
ary_memcpy(subst, 0, len, RARRAY_CONST_PTR_TRANSIENT(ary));
|
||||
ary_memcpy(subst, 0, len, RARRAY_CONST_PTR_TRANSIENT(ary));
|
||||
ARY_SET_EMBED_LEN(subst, len);
|
||||
return subst;
|
||||
}
|
||||
|
@ -1063,7 +1063,7 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
|
|||
|
||||
if (len <= RARRAY_EMBED_LEN_MAX) {
|
||||
VALUE result = ary_alloc(klass);
|
||||
ary_memcpy(result, 0, len, RARRAY_CONST_PTR_TRANSIENT(ary) + offset);
|
||||
ary_memcpy(result, 0, len, RARRAY_CONST_PTR_TRANSIENT(ary) + offset);
|
||||
ARY_SET_EMBED_LEN(result, len);
|
||||
return result;
|
||||
}
|
||||
|
@ -1356,8 +1356,8 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
|
|||
VALUE shared = ARY_SHARED(ary);
|
||||
capa = RARRAY_LEN(shared);
|
||||
if (ARY_SHARED_OCCUPIED(shared) && capa > new_len) {
|
||||
head = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
sharedp = RARRAY_CONST_PTR_TRANSIENT(shared);
|
||||
head = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
sharedp = RARRAY_CONST_PTR_TRANSIENT(shared);
|
||||
goto makeroom_if_need;
|
||||
}
|
||||
}
|
||||
|
@ -1376,7 +1376,7 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
|
|||
capa = ARY_CAPA(ary);
|
||||
ary_make_shared(ary);
|
||||
|
||||
head = sharedp = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
head = sharedp = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
goto makeroom;
|
||||
makeroom_if_need:
|
||||
if (head - sharedp < argc) {
|
||||
|
@ -1817,7 +1817,7 @@ rb_ary_splice(VALUE ary, long beg, long len, const VALUE *rptr, long rlen)
|
|||
}
|
||||
|
||||
{
|
||||
const VALUE *optr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
const VALUE *optr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
rofs = (rptr >= optr && rptr < optr + olen) ? rptr - optr : -1;
|
||||
}
|
||||
|
||||
|
@ -1830,7 +1830,7 @@ rb_ary_splice(VALUE ary, long beg, long len, const VALUE *rptr, long rlen)
|
|||
len = beg + rlen;
|
||||
ary_mem_clear(ary, olen, beg - olen);
|
||||
if (rlen > 0) {
|
||||
if (rofs != -1) rptr = RARRAY_CONST_PTR_TRANSIENT(ary) + rofs;
|
||||
if (rofs != -1) rptr = RARRAY_CONST_PTR_TRANSIENT(ary) + rofs;
|
||||
ary_memcpy0(ary, beg, rlen, rptr, target_ary);
|
||||
}
|
||||
ARY_SET_LEN(ary, len);
|
||||
|
@ -1854,7 +1854,7 @@ rb_ary_splice(VALUE ary, long beg, long len, const VALUE *rptr, long rlen)
|
|||
ARY_SET_LEN(ary, alen);
|
||||
}
|
||||
if (rlen > 0) {
|
||||
if (rofs != -1) rptr = RARRAY_CONST_PTR_TRANSIENT(ary) + rofs;
|
||||
if (rofs != -1) rptr = RARRAY_CONST_PTR_TRANSIENT(ary) + rofs;
|
||||
/* give up wb-protected ary */
|
||||
MEMMOVE(RARRAY_PTR(ary) + beg, rptr, VALUE, rlen);
|
||||
}
|
||||
|
@ -1980,7 +1980,7 @@ rb_ary_aset(int argc, VALUE *argv, VALUE ary)
|
|||
/* check if idx is Range */
|
||||
range:
|
||||
rpl = rb_ary_to_ary(argv[argc-1]);
|
||||
rb_ary_splice(ary, beg, len, RARRAY_CONST_PTR_TRANSIENT(rpl), RARRAY_LEN(rpl));
|
||||
rb_ary_splice(ary, beg, len, RARRAY_CONST_PTR_TRANSIENT(rpl), RARRAY_LEN(rpl));
|
||||
RB_GC_GUARD(rpl);
|
||||
return argv[argc-1];
|
||||
}
|
||||
|
@ -2524,8 +2524,8 @@ rb_ary_reverse_m(VALUE ary)
|
|||
VALUE dup = rb_ary_new2(len);
|
||||
|
||||
if (len > 0) {
|
||||
const VALUE *p1 = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
VALUE *p2 = (VALUE *)RARRAY_CONST_PTR_TRANSIENT(dup) + len - 1;
|
||||
const VALUE *p1 = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
VALUE *p2 = (VALUE *)RARRAY_CONST_PTR_TRANSIENT(dup) + len - 1;
|
||||
do *p2-- = *p1++; while (--len > 0);
|
||||
}
|
||||
ARY_SET_LEN(dup, RARRAY_LEN(ary));
|
||||
|
@ -2627,7 +2627,7 @@ rb_ary_rotate_m(int argc, VALUE *argv, VALUE ary)
|
|||
rotated = rb_ary_new2(len);
|
||||
if (len > 0) {
|
||||
cnt = rotate_count(cnt, len);
|
||||
ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
len -= cnt;
|
||||
ary_memcpy(rotated, 0, len, ptr + cnt);
|
||||
ary_memcpy(rotated, len, cnt, ptr);
|
||||
|
@ -3078,7 +3078,7 @@ append_values_at_single(VALUE result, VALUE ary, long olen, VALUE idx)
|
|||
/* check if idx is Range */
|
||||
else if (rb_range_beg_len(idx, &beg, &len, olen, 1)) {
|
||||
if (len > 0) {
|
||||
const VALUE *const src = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
const VALUE *const src = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
const long end = beg + len;
|
||||
const long prevlen = RARRAY_LEN(result);
|
||||
if (beg < olen) {
|
||||
|
@ -3433,7 +3433,7 @@ rb_ary_slice_bang(int argc, VALUE *argv, VALUE ary)
|
|||
len = orig_len - pos;
|
||||
}
|
||||
if (len == 0) return rb_ary_new2(0);
|
||||
arg2 = rb_ary_new4(len, RARRAY_CONST_PTR_TRANSIENT(ary)+pos);
|
||||
arg2 = rb_ary_new4(len, RARRAY_CONST_PTR_TRANSIENT(ary)+pos);
|
||||
RBASIC_SET_CLASS(arg2, rb_obj_class(ary));
|
||||
rb_ary_splice(ary, pos, len, 0, 0);
|
||||
return arg2;
|
||||
|
@ -3758,7 +3758,7 @@ rb_ary_replace(VALUE copy, VALUE orig)
|
|||
FL_UNSET_SHARED(copy);
|
||||
}
|
||||
FL_SET_EMBED(copy);
|
||||
ary_memcpy(copy, 0, RARRAY_LEN(orig), RARRAY_CONST_PTR_TRANSIENT(orig));
|
||||
ary_memcpy(copy, 0, RARRAY_LEN(orig), RARRAY_CONST_PTR_TRANSIENT(orig));
|
||||
if (shared) {
|
||||
rb_ary_decrement_share(shared);
|
||||
}
|
||||
|
@ -3952,7 +3952,7 @@ ary_append(VALUE x, VALUE y)
|
|||
{
|
||||
long n = RARRAY_LEN(y);
|
||||
if (n > 0) {
|
||||
rb_ary_splice(x, RARRAY_LEN(x), 0, RARRAY_CONST_PTR_TRANSIENT(y), n);
|
||||
rb_ary_splice(x, RARRAY_LEN(x), 0, RARRAY_CONST_PTR_TRANSIENT(y), n);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
@ -4054,11 +4054,11 @@ rb_ary_times(VALUE ary, VALUE times)
|
|||
if (0 < t) {
|
||||
ary_memcpy(ary2, 0, t, ptr);
|
||||
while (t <= len/2) {
|
||||
ary_memcpy(ary2, t, t, RARRAY_CONST_PTR_TRANSIENT(ary2));
|
||||
ary_memcpy(ary2, t, t, RARRAY_CONST_PTR_TRANSIENT(ary2));
|
||||
t *= 2;
|
||||
}
|
||||
if (t < len) {
|
||||
ary_memcpy(ary2, t, len-t, RARRAY_CONST_PTR_TRANSIENT(ary2));
|
||||
ary_memcpy(ary2, t, len-t, RARRAY_CONST_PTR_TRANSIENT(ary2));
|
||||
}
|
||||
}
|
||||
out:
|
||||
|
@ -5203,7 +5203,7 @@ rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary)
|
|||
while (i) {
|
||||
long j = RAND_UPTO(i);
|
||||
VALUE tmp;
|
||||
if (len != RARRAY_LEN(ary) || ptr != RARRAY_CONST_PTR_TRANSIENT(ary)) {
|
||||
if (len != RARRAY_LEN(ary) || ptr != RARRAY_CONST_PTR_TRANSIENT(ary)) {
|
||||
rb_raise(rb_eRuntimeError, "modified during shuffle");
|
||||
}
|
||||
tmp = ptr[--i];
|
||||
|
|
|
@ -1649,7 +1649,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *const optargs, const NODE *cons
|
|||
|
||||
opt_table = ALLOC_N(VALUE, i+1);
|
||||
|
||||
MEMCPY(opt_table, RARRAY_CONST_PTR_TRANSIENT(labels), VALUE, i+1);
|
||||
MEMCPY(opt_table, RARRAY_CONST_PTR_TRANSIENT(labels), VALUE, i+1);
|
||||
for (j = 0; j < i+1; j++) {
|
||||
opt_table[j] &= ~1;
|
||||
}
|
||||
|
@ -2304,7 +2304,7 @@ iseq_set_exception_table(rb_iseq_t *iseq)
|
|||
table->size = tlen;
|
||||
|
||||
for (i = 0; i < table->size; i++) {
|
||||
ptr = RARRAY_CONST_PTR_TRANSIENT(tptr[i]);
|
||||
ptr = RARRAY_CONST_PTR_TRANSIENT(tptr[i]);
|
||||
entry = &table->entries[i];
|
||||
entry->type = (enum catch_type)(ptr[0] & 0xffff);
|
||||
entry->start = label_get_position((LABEL *)(ptr[1] & ~1));
|
||||
|
|
8
gc.c
8
gc.c
|
@ -1532,7 +1532,7 @@ heap_page_allocate(rb_objspace_t *objspace)
|
|||
/* assign heap_page entry */
|
||||
page = (struct heap_page *)calloc(1, sizeof(struct heap_page));
|
||||
if (page == 0) {
|
||||
rb_aligned_free(page_body);
|
||||
rb_aligned_free(page_body);
|
||||
rb_memerror();
|
||||
}
|
||||
|
||||
|
@ -4674,13 +4674,13 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
|
|||
case T_ARRAY:
|
||||
if (FL_TEST(obj, ELTS_SHARED)) {
|
||||
VALUE root = any->as.array.as.heap.aux.shared;
|
||||
gc_mark(objspace, root);
|
||||
gc_mark(objspace, root);
|
||||
}
|
||||
else {
|
||||
long i, len = RARRAY_LEN(obj);
|
||||
const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(obj);
|
||||
const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(obj);
|
||||
for (i=0; i < len; i++) {
|
||||
gc_mark(objspace, ptr[i]);
|
||||
gc_mark(objspace, ptr[i]);
|
||||
}
|
||||
|
||||
if (objspace->mark_func_data == NULL) {
|
||||
|
|
|
@ -335,7 +335,7 @@ args_setup_opt_parameters(struct args_info *args, int opt_max, VALUE *locals)
|
|||
|
||||
if (args->rest) {
|
||||
int len = RARRAY_LENINT(args->rest);
|
||||
const VALUE *argv = RARRAY_CONST_PTR_TRANSIENT(args->rest);
|
||||
const VALUE *argv = RARRAY_CONST_PTR_TRANSIENT(args->rest);
|
||||
|
||||
for (; i<opt_max && args->rest_index < len; i++, args->rest_index++) {
|
||||
locals[i] = argv[args->rest_index];
|
||||
|
@ -785,7 +785,7 @@ vm_caller_setup_arg_splat(rb_control_frame_t *cfp, struct rb_calling_info *calli
|
|||
cfp->sp--;
|
||||
|
||||
if (!NIL_P(ary)) {
|
||||
const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
const VALUE *ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
long len = RARRAY_LEN(ary), i;
|
||||
|
||||
CHECK_VM_STACK_OVERFLOW(cfp, len);
|
||||
|
|
|
@ -1265,7 +1265,7 @@ vm_expandarray(VALUE *sp, VALUE ary, rb_num_t num, int flag)
|
|||
len = 1;
|
||||
}
|
||||
else {
|
||||
ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
ptr = RARRAY_CONST_PTR_TRANSIENT(ary);
|
||||
len = (rb_num_t)RARRAY_LEN(ary);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue