1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/st.h, st.c (st_init_table, st_init_table_with_size):

constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-07-05 01:06:49 +00:00
parent 151d11b5b1
commit ba563e4a41
8 changed files with 23 additions and 18 deletions

View file

@ -1,3 +1,8 @@
Thu Jul 5 10:06:47 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* include/ruby/st.h, st.c (st_init_table, st_init_table_with_size):
constified.
Wed Jul 4 23:36:27 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org> Wed Jul 4 23:36:27 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* lib/webrick/httpauth/authenticator.rb * lib/webrick/httpauth/authenticator.rb

4
hash.c
View file

@ -94,7 +94,7 @@ rb_any_hash(VALUE a)
} }
} }
static struct st_hash_type objhash = { static const struct st_hash_type objhash = {
rb_any_cmp, rb_any_cmp,
rb_any_hash, rb_any_hash,
}; };
@ -1614,7 +1614,7 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
return ary; return ary;
} }
static struct st_hash_type identhash = { static const struct st_hash_type identhash = {
st_numcmp, st_numcmp,
st_numhash, st_numhash,
}; };

View file

@ -30,7 +30,7 @@ struct st_hash_type {
}; };
struct st_table { struct st_table {
struct st_hash_type *type; const struct st_hash_type *type;
int num_bins; int num_bins;
int num_entries; int num_entries;
struct st_table_entry **bins; struct st_table_entry **bins;
@ -51,8 +51,8 @@ enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE, ST_CHECK};
# endif # endif
#endif #endif
st_table *st_init_table(struct st_hash_type *); st_table *st_init_table(const struct st_hash_type *);
st_table *st_init_table_with_size(struct st_hash_type *, int); st_table *st_init_table_with_size(const struct st_hash_type *, int);
st_table *st_init_numtable(void); st_table *st_init_numtable(void);
st_table *st_init_numtable_with_size(int); st_table *st_init_numtable_with_size(int);
st_table *st_init_strtable(void); st_table *st_init_strtable(void);

View file

@ -8239,7 +8239,7 @@ static struct symbols {
VALUE op_sym[tLAST_TOKEN]; VALUE op_sym[tLAST_TOKEN];
} global_symbols = {tLAST_TOKEN}; } global_symbols = {tLAST_TOKEN};
static struct st_hash_type symhash = { static const struct st_hash_type symhash = {
rb_str_cmp, rb_str_cmp,
rb_str_hash, rb_str_hash,
}; };
@ -8264,7 +8264,7 @@ ivar2_hash(struct ivar2_key *key)
return (key->id << 8) ^ (key->klass >> 2); return (key->id << 8) ^ (key->klass >> 2);
} }
static struct st_hash_type ivar2_hash_type = { static const struct st_hash_type ivar2_hash_type = {
ivar2_cmp, ivar2_cmp,
ivar2_hash, ivar2_hash,
}; };

View file

@ -312,7 +312,7 @@ typedef struct {
static int strend_cmp(st_strend_key*, st_strend_key*); static int strend_cmp(st_strend_key*, st_strend_key*);
static int strend_hash(st_strend_key*); static int strend_hash(st_strend_key*);
static struct st_hash_type type_strend_hash = { static const struct st_hash_type type_strend_hash = {
strend_cmp, strend_cmp,
strend_hash, strend_hash,
}; };
@ -4736,7 +4736,7 @@ static int type_cclass_hash(type_cclass_key* key)
return val + (val >> 5); return val + (val >> 5);
} }
static struct st_hash_type type_type_cclass_hash = { static const struct st_hash_type type_type_cclass_hash = {
type_cclass_cmp, type_cclass_cmp,
type_cclass_hash, type_cclass_hash,
}; };

8
st.c
View file

@ -39,14 +39,14 @@ struct st_table_entry {
* *
*/ */
static struct st_hash_type type_numhash = { static const struct st_hash_type type_numhash = {
st_numcmp, st_numcmp,
st_numhash, st_numhash,
}; };
/* extern int strcmp(const char *, const char *); */ /* extern int strcmp(const char *, const char *); */
static int strhash(const char *); static int strhash(const char *);
static struct st_hash_type type_strhash = { static const struct st_hash_type type_strhash = {
strcmp, strcmp,
strhash, strhash,
}; };
@ -145,7 +145,7 @@ stat_col()
#endif #endif
st_table* st_table*
st_init_table_with_size(struct st_hash_type *type, int size) st_init_table_with_size(const struct st_hash_type *type, int size)
{ {
st_table *tbl; st_table *tbl;
@ -168,7 +168,7 @@ st_init_table_with_size(struct st_hash_type *type, int size)
} }
st_table* st_table*
st_init_table(struct st_hash_type *type) st_init_table(const struct st_hash_type *type)
{ {
return st_init_table_with_size(type, 0); return st_init_table_with_size(type, 0);
} }

View file

@ -10861,7 +10861,7 @@ code2_hash(OnigCodePoint* x)
return (int )(x[0] + x[1]); return (int )(x[0] + x[1]);
} }
static struct st_hash_type type_code2_hash = { static const struct st_hash_type type_code2_hash = {
code2_cmp, code2_cmp,
code2_hash, code2_hash,
}; };
@ -10879,7 +10879,7 @@ code3_hash(OnigCodePoint* x)
return (int )(x[0] + x[1] + x[2]); return (int )(x[0] + x[1] + x[2]);
} }
static struct st_hash_type type_code3_hash = { static const struct st_hash_type type_code3_hash = {
code3_cmp, code3_cmp,
code3_hash, code3_hash,
}; };

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-07-04" #define RUBY_RELEASE_DATE "2007-07-05"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070704 #define RUBY_RELEASE_CODE 20070705
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 7 #define RUBY_RELEASE_MONTH 7
#define RUBY_RELEASE_DAY 4 #define RUBY_RELEASE_DAY 5
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];