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

* random.c (random_rand): remove unused variables.

* struct.c (rb_struct_define_without_accessor): ditto.

* strftime.c (rb_strftime_with_timespec): ditto.

* sprintf.c: ditto.

* time.c (time_asctime): remove useless GetTimeval().

* thread_pthread.c: cast to (void *) for %p.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-04-25 07:56:42 +00:00
parent 7c885222ca
commit 63f39fcb40
7 changed files with 25 additions and 22 deletions

View file

@ -1,3 +1,17 @@
Mon Apr 25 16:43:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
* random.c (random_rand): remove unused variables.
* struct.c (rb_struct_define_without_accessor): ditto.
* strftime.c (rb_strftime_with_timespec): ditto.
* sprintf.c: ditto.
* time.c (time_asctime): remove useless GetTimeval().
* thread_pthread.c: cast to (void *) for %p.
Mon Apr 25 11:02:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/ripper/lib/ripper/sexp.rb: fix rdoc arround sexp.

View file

@ -1136,8 +1136,7 @@ static VALUE
random_rand(int argc, VALUE *argv, VALUE obj)
{
rb_random_t *rnd = get_rnd(obj);
VALUE vmax, beg = Qundef, end = Qundef, v;
int excl = 0;
VALUE vmax, v;
if (argc == 0) {
return rb_float_new(genrand_real(&rnd->mt));

View file

@ -30,9 +30,7 @@ static void fmt_setup(char*,size_t,int,int,int,int);
static char*
remove_sign_bits(char *str, int base)
{
char *s, *t;
s = t = str;
char *t = str;
if (base == 16) {
while (*t == 'f') {
@ -746,7 +744,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
char sc = 0;
long v = 0;
int base, bignum = 0;
int len, pos;
int len;
switch (*p) {
case 'd':
@ -910,7 +908,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
len = rb_long2int(RSTRING_END(tmp) - s);
}
pos = -1;
if (dots) {
prec -= 2;
width -= 2;

View file

@ -689,17 +689,15 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, const str
subsec = div(subsec, INT2FIX(1));
if (FIXNUM_P(subsec)) {
int l;
l = snprintf(s, endp - s, "%0*ld", precision, FIX2LONG(subsec));
(void)snprintf(s, endp - s, "%0*ld", precision, FIX2LONG(subsec));
s += precision;
}
else {
VALUE args[2], result;
size_t l;
args[0] = INT2FIX(precision);
args[1] = subsec;
result = rb_str_format(2, args, rb_str_new2("%0*d"));
l = strlcpy(s, StringValueCStr(result), endp-s);
(void)strlcpy(s, StringValueCStr(result), endp-s);
s += precision;
}
}

View file

@ -240,12 +240,10 @@ rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_
VALUE klass;
va_list ar;
VALUE members;
long i;
char *name;
members = rb_ary_new2(0);
va_start(ar, alloc);
i = 0;
while ((name = va_arg(ar, char*)) != NULL) {
rb_ary_push(members, ID2SYM(rb_intern(name)));
}

View file

@ -43,7 +43,7 @@ gvl_show_waiting_threads(rb_vm_t *vm)
rb_thread_t *th = vm->gvl.waiting_threads;
int i = 0;
while (th) {
fprintf(stderr, "waiting (%d): %p\n", i++, th);
fprintf(stderr, "waiting (%d): %p\n", i++, (void *)th);
th = th->native_thread_data.gvl_next;
}
}
@ -82,7 +82,7 @@ gvl_acquire(rb_vm_t *vm, rb_thread_t *th)
#else
native_mutex_lock(&vm->gvl.lock);
if (vm->gvl.waiting > 0 || vm->gvl.acquired != 0) {
if (GVL_DEBUG) fprintf(stderr, "gvl acquire (%p): sleep\n", th);
if (GVL_DEBUG) fprintf(stderr, "gvl acquire (%p): sleep\n", (void *)th);
gvl_waiting_push(vm, th);
if (GVL_DEBUG) gvl_show_waiting_threads(vm);
@ -98,7 +98,7 @@ gvl_acquire(rb_vm_t *vm, rb_thread_t *th)
native_mutex_unlock(&vm->gvl.lock);
#endif
if (GVL_DEBUG) gvl_show_waiting_threads(vm);
if (GVL_DEBUG) fprintf(stderr, "gvl acquire (%p): acquire\n", th);
if (GVL_DEBUG) fprintf(stderr, "gvl acquire (%p): acquire\n", (void *)th);
}
static void
@ -110,11 +110,11 @@ gvl_release(rb_vm_t *vm)
native_mutex_lock(&vm->gvl.lock);
if (vm->gvl.waiting > 0) {
rb_thread_t *th = vm->gvl.waiting_threads;
if (GVL_DEBUG) fprintf(stderr, "gvl release (%p): wakeup: %p\n", GET_THREAD(), th);
if (GVL_DEBUG) fprintf(stderr, "gvl release (%p): wakeup: %p\n", (void *)GET_THREAD(), (void *)th);
native_cond_signal(&th->native_thread_data.gvl_cond);
}
else {
if (GVL_DEBUG) fprintf(stderr, "gvl release (%p): wakeup: %p\n", GET_THREAD(), NULL);
if (GVL_DEBUG) fprintf(stderr, "gvl release (%p): wakeup: %p\n", (void *)GET_THREAD(), NULL);
/* do nothing */
}
vm->gvl.acquired = 0;
@ -163,7 +163,7 @@ mutex_debug(const char *msg, pthread_mutex_t *lock)
static pthread_mutex_t dbglock = PTHREAD_MUTEX_INITIALIZER;
if ((r = pthread_mutex_lock(&dbglock)) != 0) {exit(1);}
fprintf(stdout, "%s: %p\n", msg, lock);
fprintf(stdout, "%s: %p\n", msg, (void *)lock);
if ((r = pthread_mutex_unlock(&dbglock)) != 0) {exit(1);}
}
}

3
time.c
View file

@ -3629,9 +3629,6 @@ static VALUE strftimev(const char *fmt, VALUE time);
static VALUE
time_asctime(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
return strftimev("%a %b %e %T %Y", time);
}