summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-11 10:03:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-06-11 10:03:21 +0000
commit1bc6f594d3de8dbfb5c165835eaec99bd49327c8 (patch)
treed535a84c63a5cf779aa1ae83f89ed64f22040471 /gc.c
parent3f5b1ec9cb657375a0c467ac70fdd6fbdc97f018 (diff)
1.1b9_25
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gc.c b/gc.c
index 5347585a00..36d08e99c1 100644
--- a/gc.c
+++ b/gc.c
@@ -47,10 +47,13 @@ static unsigned long malloc_memories = 0;
void *
xmalloc(size)
- unsigned long size;
+ int size;
{
void *mem;
+ if (size < 0) {
+ ArgError("negative allocation size (or too big)");
+ }
if (size == 0) size = 1;
#if 0
malloc_memories += size;
@@ -71,7 +74,7 @@ xmalloc(size)
void *
xcalloc(n, size)
- unsigned long n, size;
+ int n, size;
{
void *mem;
@@ -84,10 +87,13 @@ xcalloc(n, size)
void *
xrealloc(ptr, size)
void *ptr;
- unsigned long size;
+ int size;
{
void *mem;
+ if (size < 0) {
+ ArgError("negative re-allocation size");
+ }
if (!ptr) return xmalloc(size);
mem = realloc(ptr, size);
if (!mem) {