* gc.c (gc_sweep): adjust GC trigger.

* dln.c (init_funcname_len): get rid of gcc-3 -O3 warning.

* eval.c (copy_node_scope): ditto.

* hash.c (rb_hash_foreach, delete_if_i, select_i, each_value_i,
  each_key_i, each_pair_i, envix): ditto.

* range.c (range_each_func): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2002-12-29 14:51:22 +00:00
Родитель 0569c8422c
Коммит 05b990b7c1
6 изменённых файлов: 35 добавлений и 44 удалений

Просмотреть файл

@ -1,3 +1,16 @@
Sun Dec 29 23:45:53 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* gc.c (gc_sweep): adjust GC trigger.
* dln.c (init_funcname_len): get rid of gcc-3 -O3 warning.
* eval.c (copy_node_scope): ditto.
* hash.c (rb_hash_foreach, delete_if_i, select_i, each_value_i,
each_key_i, each_pair_i, envix): ditto.
* range.c (range_each_func): ditto.
Sun Dec 29 15:30:37 2002 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (fu_parseargs): should not inherit ftools.rb's

11
dln.c
Просмотреть файл

@ -107,17 +107,18 @@ int eaccess();
static int
init_funcname_len(buf, file)
char **buf;
char *file;
const char *file;
{
char *p, *slash;
char *p;
const char *slash;
int len;
/* Load the file as an object one */
for (p = file, slash = p-1; *p; p++) /* Find position of last '/' */
for (slash = file-1; *file; file++) /* Find position of last '/' */
#ifdef __MACOS__
if (*p == ':') slash = p;
if (*file == ':') slash = file;
#else
if (*p == '/') slash = p;
if (*file == '/') slash = file;
#endif
len = strlen(FUNCNAME_PATTERN) + strlen(slash + 1);

2
eval.c
Просмотреть файл

@ -1766,7 +1766,7 @@ rb_mod_alias_method(mod, newname, oldname)
static NODE*
copy_node_scope(node, rval)
NODE *node;
VALUE rval;
NODE *rval;
{
NODE *copy = rb_node_newnode(NODE_SCOPE,0,rval,node->nd_next);

33
gc.c
Просмотреть файл

@ -879,7 +879,7 @@ gc_sweep()
RVALUE *p, *pend, *final_list;
int freed = 0;
int i, j;
unsigned long live = 0;
unsigned long live = 0, garbage = 0;
if (ruby_in_compile && ruby_parser_stack_on_heap()) {
/* should not reclaim nodes during compilation
@ -929,32 +929,7 @@ gc_sweep()
}
else {
RBASIC(p)->flags &= ~FL_MARK;
live += sizeof(VALUE);
switch (BUILTIN_TYPE(p)) {
case T_OBJECT:
live += size_of_table(ROBJECT(p)->iv_tbl);
break;
case T_CLASS:
case T_ICLASS:
live += size_of_table(RCLASS(p)->iv_tbl);
live += size_of_table(RCLASS(p)->m_tbl);
break;
case T_STRING:
live += RSTRING(p)->len+1;
break;
case T_ARRAY:
live += RARRAY(p)->len * sizeof(VALUE);
break;
case T_HASH:
live += size_of_table(RHASH(p)->tbl);
break;
case T_BIGNUM:
live += RBIGNUM(p)->len * sizeof(BDIGIT);
break;
case T_STRUCT:
live += RSTRUCT(p)->len * sizeof(VALUE);
break;
}
live++;
}
p++;
}
@ -971,7 +946,9 @@ gc_sweep()
freed += n;
}
}
malloc_limit = live;
malloc_limit += malloc_increase;
malloc_limit *= (double)live / (live + freed);
if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT;
malloc_increase = 0;
if (freed < FREE_MIN) {
add_heap();

18
hash.c
Просмотреть файл

@ -120,7 +120,7 @@ static struct st_hash_type objhash = {
struct rb_hash_foreach_arg {
VALUE hash;
enum st_retval (*func)();
char *arg;
VALUE arg;
};
static int
@ -167,7 +167,7 @@ static int
rb_hash_foreach(hash, func, farg)
VALUE hash;
enum st_retval (*func)();
char *farg;
VALUE farg;
{
struct rb_hash_foreach_arg arg;
@ -462,7 +462,7 @@ rb_hash_shift(hash)
}
}
static int
static enum st_retval
delete_if_i(key, value)
VALUE key, value;
{
@ -498,9 +498,9 @@ rb_hash_reject(hash)
return rb_hash_delete_if(rb_obj_dup(hash));
}
static int
static enum st_retval
select_i(key, value, result)
VALUE key, value;
VALUE key, value, result;
{
VALUE assoc;
@ -611,7 +611,7 @@ rb_hash_empty_p(hash)
return Qfalse;
}
static int
static enum st_retval
each_value_i(key, value)
VALUE key, value;
{
@ -628,7 +628,7 @@ rb_hash_each_value(hash)
return hash;
}
static int
static enum st_retval
each_key_i(key, value)
VALUE key, value;
{
@ -645,7 +645,7 @@ rb_hash_each_key(hash)
return hash;
}
static int
static enum st_retval
each_pair_i(key, value)
VALUE key, value;
{
@ -1076,7 +1076,7 @@ rb_env_path_tainted()
static int
envix(nam)
char *nam;
const char *nam;
{
register int i, len = strlen(nam);
char **env;

Просмотреть файл

@ -208,7 +208,7 @@ step_i(i, iter)
static void
range_each_func(range, func, v, e, arg)
VALUE range;
void (*func) _((VALUE, void*));
VALUE (*func) _((VALUE, void*));
VALUE v, e;
void *arg;
{