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

ruby-changes:56647

From: Nobuyoshi <ko1@a...>
Date: Thu, 25 Jul 2019 05:55:25 +0900 (JST)
Subject: [ruby-changes:56647] Nobuyoshi Nakada: efa380b006 (master): Use PRIuSIZE instead of "%zu"

https://git.ruby-lang.org/ruby.git/commit/?id=efa380b006

From efa380b006aeafbad90b2d4e795a602404fec3c5 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 25 Jul 2019 05:54:38 +0900
Subject: Use PRIuSIZE instead of "%zu"


diff --git a/cont.c b/cont.c
index 409fbcc..286e35d 100644
--- a/cont.c
+++ b/cont.c
@@ -292,7 +292,7 @@ fiber_pool_stack_alloca(struct fiber_pool_stack * stack, size_t offset) https://github.com/ruby/ruby/blob/trunk/cont.c#L292
 {
     STACK_GROW_DIR_DETECTION;
 
-    if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %zu/%zu\n", stack, offset, stack->available);
+    if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %"PRIuSIZE"/%"PRIuSIZE"\n", stack, offset, stack->available);
     VM_ASSERT(stack->available >= offset);
 
     // The pointer to the memory being allocated:
@@ -445,7 +445,7 @@ fiber_pool_expand(struct fiber_pool * fiber_pool, size_t count) https://github.com/ruby/ruby/blob/trunk/cont.c#L445
     void * base = fiber_pool_allocate_memory(&count, stride);
 
     if (base == NULL) {
-        rb_raise(rb_eFiberError, "can't alloc machine stack to fiber (%zu x %zu bytes): %s", count, size, ERRNOMSG);
+        rb_raise(rb_eFiberError, "can't alloc machine stack to fiber (%"PRIuSIZE" x %"PRIuSIZE" bytes): %s", count, size, ERRNOMSG);
     }
 
     struct fiber_pool_vacancy * vacancies = fiber_pool->vacancies;
@@ -461,7 +461,10 @@ fiber_pool_expand(struct fiber_pool * fiber_pool, size_t count) https://github.com/ruby/ruby/blob/trunk/cont.c#L461
 #endif
     allocation->pool = fiber_pool;
 
-    if (DEBUG) fprintf(stderr, "fiber_pool_expand(%zu): %p, %zu/%zu x [%zu:%zu]\n", count, fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size);
+    if (DEBUG) {
+        fprintf(stderr, "fiber_pool_expand(%"PRIuSIZE"): %p, %"PRIuSIZE"/%"PRIuSIZE" x [%"PRIuSIZE":%"PRIuSIZE"]\n",
+                count, fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size);
+    }
 
     // Iterate over all stacks, initializing the vacancy list:
     for (size_t i = 0; i < count; i += 1) {
@@ -540,7 +543,7 @@ fiber_pool_allocation_free(struct fiber_pool_allocation * allocation) https://github.com/ruby/ruby/blob/trunk/cont.c#L543
 
     VM_ASSERT(allocation->used == 0);
 
-    if (DEBUG) fprintf(stderr, "fiber_pool_allocation_free: %p base=%p count=%zu\n", allocation, allocation->base, allocation->count);
+    if (DEBUG) fprintf(stderr, "fiber_pool_allocation_free: %p base=%p count=%"PRIuSIZE"\n", allocation, allocation->base, allocation->count);
 
     size_t i;
     for (i = 0; i < allocation->count; i += 1) {
@@ -581,7 +584,7 @@ static struct fiber_pool_stack https://github.com/ruby/ruby/blob/trunk/cont.c#L584
 fiber_pool_stack_acquire(struct fiber_pool * fiber_pool) {
     struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pop(fiber_pool);
 
-    if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%zu\n", fiber_pool->vacancies, fiber_pool->used);
+    if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%"PRIuSIZE"\n", fiber_pool->vacancies, fiber_pool->used);
 
     if (!vacancy) {
         const size_t maximum = FIBER_POOL_ALLOCATION_MAXIMUM_SIZE;
@@ -625,7 +628,7 @@ fiber_pool_stack_free(struct fiber_pool_stack * stack) https://github.com/ruby/ruby/blob/trunk/cont.c#L628
     // If this is not true, the vacancy information will almost certainly be destroyed:
     VM_ASSERT(size <= (stack->size - RB_PAGE_SIZE));
 
-    if (DEBUG) fprintf(stderr, "fiber_pool_stack_free: %p+%zu [base=%p, size=%zu]\n", base, size, stack->base, stack->size);
+    if (DEBUG) fprintf(stderr, "fiber_pool_stack_free: %p+%"PRIuSIZE" [base=%p, size=%"PRIuSIZE"]\n", base, size, stack->base, stack->size);
 
 #if VM_CHECK_MODE > 0 && defined(MADV_DONTNEED)
     // This immediately discards the pages and the memory is reset to zero.
@@ -650,7 +653,7 @@ fiber_pool_stack_release(struct fiber_pool_stack * stack) https://github.com/ruby/ruby/blob/trunk/cont.c#L653
     struct fiber_pool * pool = stack->pool;
     struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pointer(stack->base, stack->size);
 
-    if (DEBUG) fprintf(stderr, "fiber_pool_stack_release: %p used=%zu\n", stack->base, stack->pool->used);
+    if (DEBUG) fprintf(stderr, "fiber_pool_stack_release: %p used=%"PRIuSIZE"\n", stack->base, stack->pool->used);
 
     // Copy the stack details into the vacancy area:
     vacancy->stack = *stack;
-- 
cgit v0.10.2


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

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