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

ruby-changes:36168

From: nobu <ko1@a...>
Date: Mon, 3 Nov 2014 14:36:29 +0900 (JST)
Subject: [ruby-changes:36168] nobu:r48249 (trunk): foreach.c: printf specifier

nobu	2014-11-03 14:36:18 +0900 (Mon, 03 Nov 2014)

  New Revision: 48249

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

  Log:
    foreach.c: printf specifier
    
    * ext/-test-/st/foreach/foreach.c: get rid of hard coded "%lu",
      since st_data_t depends on the platforms.  use PRIuVALUE with
      casting VALUE instead since there is no specifier for it.

  Modified files:
    trunk/ext/-test-/st/foreach/foreach.c
Index: ext/-test-/st/foreach/foreach.c
===================================================================
--- ext/-test-/st/foreach/foreach.c	(revision 48248)
+++ ext/-test-/st/foreach/foreach.c	(revision 48249)
@@ -24,10 +24,10 @@ force_unpack_check(struct checker *c, st https://github.com/ruby/ruby/blob/trunk/ext/-test-/st/foreach/foreach.c#L24
     }
 
     if (key != c->nr) {
-	rb_bug("unexpected key: %lu (expected %lu)\n", key, c->nr);
+	rb_bug("unexpected key: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)key, (VALUE)c->nr);
     }
     if (val != c->nr) {
-	rb_bug("unexpected val: %lu (expected %lu)\n", val, c->nr);
+	rb_bug("unexpected val: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)val, (VALUE)c->nr);
     }
 
     c->nr++;
@@ -63,7 +63,7 @@ unp_fec_i(st_data_t key, st_data_t val, https://github.com/ruby/ruby/blob/trunk/ext/-test-/st/foreach/foreach.c#L63
 		rb_bug("failed to delete\n");
 	    }
 	    if (v != 0) {
-		rb_bug("unexpected value deleted: %lu (expected 0)", v);
+		rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v);
 	    }
 	}
 	return ST_CHECK;
@@ -90,12 +90,12 @@ unp_fec(VALUE self, VALUE test) https://github.com/ruby/ruby/blob/trunk/ext/-test-/st/foreach/foreach.c#L90
 
     if (c.test == ID2SYM(rb_intern("delete2"))) {
 	if (c.nr != 1) {
-	    rb_bug("mismatched iteration: %lu (expected 1)\n", c.nr);
+	    rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr);
 	}
     }
     else if (c.nr != expect_size) {
-	rb_bug("mismatched iteration: %lu (expected %lu)\n",
-		c.nr, expect_size);
+	rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE")\n",
+		(VALUE)c.nr, (VALUE)expect_size);
     }
 
     if (tbl->entries_packed) rb_bug("should be unpacked\n");
@@ -123,7 +123,7 @@ unp_fe_i(st_data_t key, st_data_t val, s https://github.com/ruby/ruby/blob/trunk/ext/-test-/st/foreach/foreach.c#L123
 		rb_bug("failed to delete\n");
 	    }
 	    if (v != 0) {
-		rb_bug("unexpected value deleted: %lu (expected 0)", v);
+		rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v);
 	    }
 	    return ST_CONTINUE;
 	}
@@ -151,12 +151,12 @@ unp_fe(VALUE self, VALUE test) https://github.com/ruby/ruby/blob/trunk/ext/-test-/st/foreach/foreach.c#L151
 
     if (c.test == ID2SYM(rb_intern("unpack_delete"))) {
 	if (c.nr != 1) {
-	    rb_bug("mismatched iteration: %lu (expected 1)\n", c.nr);
+	    rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr);
 	}
     }
     else if (c.nr != expect_size) {
-	rb_bug("mismatched iteration: %lu (expected %lu)\n",
-		c.nr, expect_size);
+	rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE"o)\n",
+		(VALUE)c.nr, (VALUE)expect_size);
     }
 
     if (tbl->entries_packed) rb_bug("should be unpacked\n");

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

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