From: Francesco Chemolli Date: Mon, 10 Jan 2011 14:46:21 +0000 (+0100) Subject: Standard compliance fix: size_t is guaranteed unsigned. X-Git-Tag: take00~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f9ec5833f8da699b94cca77e3e691c260c90ec5;p=thirdparty%2Fsquid.git Standard compliance fix: size_t is guaranteed unsigned. --- diff --git a/compat/xstring.cc b/compat/xstring.cc index 1e8376cace..34d2ecd8a9 100644 --- a/compat/xstring.cc +++ b/compat/xstring.cc @@ -61,17 +61,9 @@ xstrndup(const char *s, size_t n) } exit(1); } - if (n < 0) { - errno = EINVAL; - if (failure_notify) { - (*failure_notify) ("xstrndup: tried to dup a negative length string!\n"); - } else { - perror("xstrndup: tried to dup a negative length string!"); - } - exit(1); - } sz = strlen(s) + 1; + // size_t is unsigned, as mandated by c99 and c++ standards. if (sz > n) sz = n;