[前][次][番号順一覧][スレッド一覧]

ruby-changes:19303

From: naruse <ko1@a...>
Date: Mon, 25 Apr 2011 16:57:45 +0900 (JST)
Subject: [ruby-changes:19303] Ruby:r31343 (trunk): * random.c (random_rand): remove unused variables.

naruse	2011-04-25 16:56:42 +0900 (Mon, 25 Apr 2011)

  New Revision: 31343

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31343

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/random.c
    trunk/sprintf.c
    trunk/strftime.c
    trunk/struct.c
    trunk/thread_pthread.c
    trunk/time.c

Index: time.c
===================================================================
--- time.c	(revision 31342)
+++ time.c	(revision 31343)
@@ -3629,9 +3629,6 @@
 static VALUE
 time_asctime(VALUE time)
 {
-    struct time_object *tobj;
-
-    GetTimeval(time, tobj);
     return strftimev("%a %b %e %T %Y", time);
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31342)
+++ ChangeLog	(revision 31343)
@@ -1,3 +1,17 @@
+Mon Apr 25 16:43:45 2011  NARUSE, Yui  <naruse@r...>
+
+	* 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@r...>
 
 	* ext/ripper/lib/ripper/sexp.rb: fix rdoc arround sexp.
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 31342)
+++ thread_pthread.c	(revision 31343)
@@ -43,7 +43,7 @@
     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 @@
 #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 @@
     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 @@
     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 @@
 	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);}
     }
 }
Index: struct.c
===================================================================
--- struct.c	(revision 31342)
+++ struct.c	(revision 31343)
@@ -240,12 +240,10 @@
     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)));
     }
Index: sprintf.c
===================================================================
--- sprintf.c	(revision 31342)
+++ sprintf.c	(revision 31343)
@@ -30,10 +30,8 @@
 static char*
 remove_sign_bits(char *str, int base)
 {
-    char *s, *t;
+    char *t = str;
 
-    s = t = str;
-
     if (base == 16) {
 	while (*t == 'f') {
 	    t++;
@@ -746,7 +744,7 @@
 		char sc = 0;
 		long v = 0;
 		int base, bignum = 0;
-		int len, pos;
+		int len;
 
 		switch (*p) {
 		  case 'd':
@@ -910,7 +908,6 @@
 		    len = rb_long2int(RSTRING_END(tmp) - s);
 		}
 
-		pos = -1;
 		if (dots) {
 		    prec -= 2;
 		    width -= 2;
Index: strftime.c
===================================================================
--- strftime.c	(revision 31342)
+++ strftime.c	(revision 31343)
@@ -689,17 +689,15 @@
                                 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;
                                 }
 			}
Index: random.c
===================================================================
--- random.c	(revision 31342)
+++ random.c	(revision 31343)
@@ -1136,8 +1136,7 @@
 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));

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]