From b46cd0e400ff278897908479acc9163419341b07 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 9 Sep 2009 02:11:35 +0000 Subject: [PATCH] * include/ruby/ruby.h (rb_data_type_struct): constified dsize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ encoding.c | 2 +- include/ruby/ruby.h | 2 +- iseq.c | 4 ++-- parse.y | 2 +- proc.c | 6 +++--- random.c | 2 +- vm.c | 10 +++++----- 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36dbcb07eb..ccef4b97fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Sep 9 11:11:33 2009 Nobuyoshi Nakada + + * include/ruby/ruby.h (rb_data_type_struct): constified dsize. + Wed Sep 9 11:07:48 2009 Nobuyoshi Nakada * cont.c (cont_memsize): fixed wrong expression on IA64. diff --git a/encoding.c b/encoding.c index 2118eba3e4..a7594aa378 100644 --- a/encoding.c +++ b/encoding.c @@ -53,7 +53,7 @@ void rb_enc_init(void); static int load_encoding(const char *name); static size_t -enc_memsize(void *p) +enc_memsize(const void *p) { return 0; } diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 0df679791a..aa96df5a3d 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -740,7 +740,7 @@ typedef struct rb_data_type_struct { const char *wrap_struct_name; void (*dmark)(void*); void (*dfree)(void*); - size_t (*dsize)(void *); + size_t (*dsize)(const void *); void *ary[4]; /* for extension */ } rb_data_type_t; diff --git a/iseq.c b/iseq.c index 6d8b9e191c..680ddd1a06 100644 --- a/iseq.c +++ b/iseq.c @@ -116,10 +116,10 @@ iseq_mark(void *ptr) } static size_t -iseq_memsize(void *ptr) +iseq_memsize(const void *ptr) { size_t size = sizeof(rb_iseq_t); - rb_iseq_t *iseq; + const rb_iseq_t *iseq; if (ptr) { iseq = ptr; diff --git a/parse.y b/parse.y index 754b363f96..80afdb66ef 100644 --- a/parse.y +++ b/parse.y @@ -9745,7 +9745,7 @@ parser_free(void *ptr) } static size_t -parser_memsize(void *ptr) +parser_memsize(const void *ptr) { struct parser_params *p = (struct parser_params*)ptr; struct local_vars *local; diff --git a/proc.c b/proc.c index 710de3915d..0398fb2ec6 100644 --- a/proc.c +++ b/proc.c @@ -62,7 +62,7 @@ proc_mark(void *ptr) } static size_t -proc_memsize(void *ptr) +proc_memsize(const void *ptr) { return ptr ? sizeof(rb_proc_t) : 0; } @@ -255,7 +255,7 @@ binding_mark(void *ptr) } static size_t -binding_memsize(void *ptr) +binding_memsize(const void *ptr) { return ptr ? sizeof(rb_binding_t) : 0; } @@ -859,7 +859,7 @@ bm_free(void *ptr) } static size_t -bm_memsize(void *ptr) +bm_memsize(const void *ptr) { return ptr ? sizeof(struct METHOD) : 0; } diff --git a/random.c b/random.c index b9383f9cfc..d3451b83cd 100644 --- a/random.c +++ b/random.c @@ -315,7 +315,7 @@ random_mark(void *ptr) #define random_free RUBY_TYPED_DEFAULT_FREE static size_t -random_memsize(void *ptr) +random_memsize(const void *ptr) { return ptr ? sizeof(rb_random_t) : 0; } diff --git a/vm.c b/vm.c index 3db6cc726b..d886f4c83b 100644 --- a/vm.c +++ b/vm.c @@ -225,7 +225,7 @@ env_free(void * const ptr) } static size_t -env_memsize(void *ptr) +env_memsize(const void *ptr) { if (ptr) { const rb_env_t * const env = ptr; @@ -1482,10 +1482,10 @@ vm_free(void *ptr) } static size_t -vm_memsize(void *ptr) +vm_memsize(const void *ptr) { if (ptr) { - rb_vm_t *vmobj = ptr; + const rb_vm_t *vmobj = ptr; return sizeof(rb_vm_t) + st_memsize(vmobj->living_threads); } else { @@ -1658,12 +1658,12 @@ thread_free(void *ptr) } static size_t -thread_memsize(void *ptr) +thread_memsize(const void *ptr) { RUBY_FREE_ENTER("thread"); if (ptr) { - rb_thread_t *th = ptr; + const rb_thread_t *th = ptr; size_t size = sizeof(rb_thread_t); if (!th->root_fiber) {