mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ce89a1c081
commit
5c54eb4045
6 changed files with 18 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Nov 8 11:35:06 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||||
|
|
||||||
|
* dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
|
||||||
|
|
||||||
Fri Nov 8 10:58:02 2013 Masaki Matsushita <glass.saga@gmail.com>
|
Fri Nov 8 10:58:02 2013 Masaki Matsushita <glass.saga@gmail.com>
|
||||||
|
|
||||||
* compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
|
* compile.c (iseq_build_from_ary_exception): use RARRAY_CONST_PTR().
|
||||||
|
|
4
dir.c
4
dir.c
|
@ -1764,7 +1764,7 @@ rb_push_glob(VALUE str, int flags) /* '\0' is delimiter */
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
dir_globs(long argc, VALUE *argv, int flags)
|
dir_globs(long argc, const VALUE *argv, int flags)
|
||||||
{
|
{
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
long i;
|
long i;
|
||||||
|
@ -1891,7 +1891,7 @@ dir_s_glob(int argc, VALUE *argv, VALUE obj)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
volatile VALUE v = ary;
|
volatile VALUE v = ary;
|
||||||
ary = dir_globs(RARRAY_LEN(v), RARRAY_PTR(v), flags);
|
ary = dir_globs(RARRAY_LEN(v), RARRAY_CONST_PTR(v), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
|
|
10
pack.c
10
pack.c
|
@ -1798,12 +1798,13 @@ pack_unpack(VALUE str, VALUE fmt)
|
||||||
s += sizeof(char *);
|
s += sizeof(char *);
|
||||||
|
|
||||||
if (t) {
|
if (t) {
|
||||||
VALUE a, *p, *pend;
|
VALUE a;
|
||||||
|
const VALUE *p, *pend;
|
||||||
|
|
||||||
if (!(a = rb_str_associated(str))) {
|
if (!(a = rb_str_associated(str))) {
|
||||||
rb_raise(rb_eArgError, "no associated pointer");
|
rb_raise(rb_eArgError, "no associated pointer");
|
||||||
}
|
}
|
||||||
p = RARRAY_PTR(a);
|
p = RARRAY_CONST_PTR(a);
|
||||||
pend = p + RARRAY_LEN(a);
|
pend = p + RARRAY_LEN(a);
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
|
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
|
||||||
|
@ -1840,12 +1841,13 @@ pack_unpack(VALUE str, VALUE fmt)
|
||||||
s += sizeof(char *);
|
s += sizeof(char *);
|
||||||
|
|
||||||
if (t) {
|
if (t) {
|
||||||
VALUE a, *p, *pend;
|
VALUE a;
|
||||||
|
const VALUE *p, *pend;
|
||||||
|
|
||||||
if (!(a = rb_str_associated(str))) {
|
if (!(a = rb_str_associated(str))) {
|
||||||
rb_raise(rb_eArgError, "no associated pointer");
|
rb_raise(rb_eArgError, "no associated pointer");
|
||||||
}
|
}
|
||||||
p = RARRAY_PTR(a);
|
p = RARRAY_CONST_PTR(a);
|
||||||
pend = p + RARRAY_LEN(a);
|
pend = p + RARRAY_LEN(a);
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
|
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
|
||||||
|
|
4
ruby.c
4
ruby.c
|
@ -590,11 +590,11 @@ process_sflag(int *sflag)
|
||||||
{
|
{
|
||||||
if (*sflag > 0) {
|
if (*sflag > 0) {
|
||||||
long n;
|
long n;
|
||||||
VALUE *args;
|
const VALUE *args;
|
||||||
VALUE argv = rb_argv;
|
VALUE argv = rb_argv;
|
||||||
|
|
||||||
n = RARRAY_LEN(argv);
|
n = RARRAY_LEN(argv);
|
||||||
args = RARRAY_PTR(argv);
|
args = RARRAY_CONST_PTR(argv);
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
VALUE v = *args++;
|
VALUE v = *args++;
|
||||||
char *s = StringValuePtr(v);
|
char *s = StringValuePtr(v);
|
||||||
|
|
4
struct.c
4
struct.c
|
@ -435,7 +435,7 @@ num_members(VALUE klass)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
|
rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
|
||||||
{
|
{
|
||||||
VALUE klass = rb_obj_class(self);
|
VALUE klass = rb_obj_class(self);
|
||||||
long i, n;
|
long i, n;
|
||||||
|
@ -457,7 +457,7 @@ rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
|
||||||
VALUE
|
VALUE
|
||||||
rb_struct_initialize(VALUE self, VALUE values)
|
rb_struct_initialize(VALUE self, VALUE values)
|
||||||
{
|
{
|
||||||
return rb_struct_initialize_m(RARRAY_LENINT(values), RARRAY_PTR(values), self);
|
return rb_struct_initialize_m(RARRAY_LENINT(values), RARRAY_CONST_PTR(values), self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
|
@ -757,7 +757,7 @@ rb_apply(VALUE recv, ID mid, VALUE args)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
argv = ALLOCA_N(VALUE, argc);
|
argv = ALLOCA_N(VALUE, argc);
|
||||||
MEMCPY(argv, RARRAY_PTR(args), VALUE, argc);
|
MEMCPY(argv, RARRAY_CONST_PTR(args), VALUE, argc);
|
||||||
return rb_call(recv, mid, argc, argv, CALL_FCALL);
|
return rb_call(recv, mid, argc, argv, CALL_FCALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,7 +984,7 @@ rb_yield_splat(VALUE values)
|
||||||
if (NIL_P(tmp)) {
|
if (NIL_P(tmp)) {
|
||||||
rb_raise(rb_eArgError, "not an array");
|
rb_raise(rb_eArgError, "not an array");
|
||||||
}
|
}
|
||||||
v = rb_yield_0(RARRAY_LENINT(tmp), RARRAY_PTR(tmp));
|
v = rb_yield_0(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp));
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue