summaryrefslogtreecommitdiff
path: root/cord/cordbscs.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-08-29 15:58:00 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-08-29 16:34:45 +0300
commitc54aba1c5feb77ad9b111a990481e8a5be29954c (patch)
tree7430ac905b703b8ff375e84a8f8afb697041cf1e /cord/cordbscs.c
parentf0fd1b1595781e9305733fd29d1c147b3dceaccc (diff)
downloadbdwgc-c54aba1c5feb77ad9b111a990481e8a5be29954c.tar.gz
Eliminate 'checking if unsigned variable is <0' cppcheck style warning
* cord/cordbscs.c (CORD_from_fn, CORD_substr): Do not expect size_t value to be negative (replace <=0 comparison with ==0 one). * cord/cordxtra.c (CORD_cmp): Likewise. * cord/cordbscs.c (CORD_substr): Remove obsolete comment (about SunOS 4 which had signed size_t type).
Diffstat (limited to 'cord/cordbscs.c')
-rw-r--r--cord/cordbscs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/cord/cordbscs.c b/cord/cordbscs.c
index 2c54d06f..efe75b54 100644
--- a/cord/cordbscs.c
+++ b/cord/cordbscs.c
@@ -281,7 +281,7 @@ CORD CORD_cat(CORD x, CORD y)
CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len)
{
- if (len <= 0) return(0);
+ if (len == 0) return(0);
if (len <= SHORT_LIMIT) {
register char * result;
register size_t i;
@@ -457,9 +457,7 @@ CORD CORD_substr(CORD x, size_t i, size_t n)
{
register size_t len = CORD_len(x);
- if (i >= len || n <= 0) return(0);
- /* n < 0 is impossible in a correct C implementation, but */
- /* quite possible under SunOS 4.X. */
+ if (i >= len || n == 0) return(0);
if (i + n > len) n = len - i;
return(CORD_substr_checked(x, i, n));
}