summaryrefslogtreecommitdiff
path: root/transient_heap.c
diff options
context:
space:
mode:
authorKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-11-04 18:45:48 +0900
committerKazuhiro NISHIYAMA <zn@mbf.nifty.com>2020-11-04 18:45:48 +0900
commit704fb0b815151504f731c9ddb52cad0b530b545f (patch)
treea7f7644320dc9d116ba56b4ec8267d12f14b6958 /transient_heap.c
parentd42c68e912f04441cfa27188223e90ac44611bb6 (diff)
downloadruby-704fb0b815151504f731c9ddb52cad0b530b545f.tar.gz
Suppress a warning
``` transient_heap.c: In function ‘transient_heap_allocatable_header’: transient_heap.c:347:37: warning: comparison of integer expressions of different signedness: ‘int16_t’ {aka ‘short int’} and ‘long unsigned int’ [-Wsign-compare] 347 | TH_ASSERT(block->info.index <= TRANSIENT_HEAP_USABLE_SIZE); | ^~ ```
Diffstat (limited to 'transient_heap.c')
-rw-r--r--transient_heap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/transient_heap.c b/transient_heap.c
index 51886d8dc1..9441aa8d7f 100644
--- a/transient_heap.c
+++ b/transient_heap.c
@@ -62,7 +62,7 @@
#define TRANSIENT_HEAP_TOTAL_SIZE (1024 * 1024 * 32) /* 32 MB */
#define TRANSIENT_HEAP_ALLOC_MAX (1024 * 2 ) /* 2 KB */
#define TRANSIENT_HEAP_BLOCK_NUM (TRANSIENT_HEAP_TOTAL_SIZE / TRANSIENT_HEAP_BLOCK_SIZE)
-#define TRANSIENT_HEAP_USABLE_SIZE TRANSIENT_HEAP_BLOCK_SIZE - sizeof(struct transient_heap_block_header)
+#define TRANSIENT_HEAP_USABLE_SIZE (TRANSIENT_HEAP_BLOCK_SIZE - sizeof(struct transient_heap_block_header))
#define TRANSIENT_HEAP_ALLOC_MAGIC 0xfeab
#define TRANSIENT_HEAP_ALLOC_ALIGN RUBY_ALIGNOF(void *)
@@ -344,7 +344,7 @@ transient_heap_allocatable_header(struct transient_heap* theap, size_t size)
struct transient_heap_block *block = theap->using_blocks;
while (block) {
- TH_ASSERT(block->info.index <= TRANSIENT_HEAP_USABLE_SIZE);
+ TH_ASSERT(block->info.index <= (int16_t)TRANSIENT_HEAP_USABLE_SIZE);
if (TRANSIENT_HEAP_USABLE_SIZE - block->info.index >= size) {
struct transient_alloc_header *header = (void *)&block->buff[block->info.index];