X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fcalloc.c;h=c8b1e1ebabd0d29c791b333b6f16234b45ebc254;hb=9fbb5dcb459bf25d5e7b89fc209359e1a61a5214;hp=59c65f0ac9c2a69b73b9139f3e2770ca2e145286;hpb=267a39bafd249d7eb9c37df06dc6defcf41cb343;p=gnulib.git diff --git a/lib/calloc.c b/lib/calloc.c index 59c65f0ac..c8b1e1eba 100644 --- a/lib/calloc.c +++ b/lib/calloc.c @@ -1,6 +1,6 @@ /* calloc() function that is glibc compatible. This wrapper function is required at least on Tru64 UNIX 5.1. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,9 +18,7 @@ /* written by Jim Meyering */ -#if HAVE_CONFIG_H -# include -#endif +#include #undef calloc #include @@ -32,10 +30,9 @@ void * rpl_calloc (size_t n, size_t s) { size_t bytes; - if (n == 0) - n = 1; - if (s == 0) - s = 1; + + if (n == 0 || s == 0) + return calloc (1, 1); /* Defend against buggy calloc implementations that mishandle size_t overflow. */