* gc.c (vm_xmalloc, vm_xrealloc): comparisons had no meanings on
platforms where size_t is unsigned. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3abae536a6
commit
643b8cb4b4
4
gc.c
4
gc.c
@ -608,7 +608,7 @@ vm_xmalloc(rb_objspace_t *objspace, size_t size)
|
|||||||
{
|
{
|
||||||
void *mem;
|
void *mem;
|
||||||
|
|
||||||
if (size < 0) {
|
if ((ssize_t)size < 0) {
|
||||||
negative_size_allocation_error("negative allocation size (or too big)");
|
negative_size_allocation_error("negative allocation size (or too big)");
|
||||||
}
|
}
|
||||||
if (size == 0) size = 1;
|
if (size == 0) size = 1;
|
||||||
@ -647,7 +647,7 @@ vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size)
|
|||||||
{
|
{
|
||||||
void *mem;
|
void *mem;
|
||||||
|
|
||||||
if (size < 0) {
|
if ((ssize_t)size < 0) {
|
||||||
negative_size_allocation_error("negative re-allocation size");
|
negative_size_allocation_error("negative re-allocation size");
|
||||||
}
|
}
|
||||||
if (!ptr) return ruby_xmalloc(size);
|
if (!ptr) return ruby_xmalloc(size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user