summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclaudio <>2021-03-18 11:16:58 +0000
committerclaudio <>2021-03-18 11:16:58 +0000
commit2ae24cd98259982f745f2428534a13181d0c9256 (patch)
tree207677d72914d57c3621a5db4506e0a3aadcdfd4
parent2383fe1805dd61190c182b5b57afc85ff78c3c17 (diff)
downloadopenbsd-2ae24cd98259982f745f2428534a13181d0c9256.tar.gz
openbsd-2ae24cd98259982f745f2428534a13181d0c9256.tar.bz2
openbsd-2ae24cd98259982f745f2428534a13181d0c9256.zip
Type-cast getpagesize() from int to size_t for the comparison with d.
getpagesize() will only return positive numbers (there is no negative page size system) and it can not fail. Should fix some compiler warnings seen in -portable projects. OK otto@
-rw-r--r--src/lib/libc/stdlib/recallocarray.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/recallocarray.c b/src/lib/libc/stdlib/recallocarray.c
index a2f37fe81a..81059e6ae1 100644
--- a/src/lib/libc/stdlib/recallocarray.c
+++ b/src/lib/libc/stdlib/recallocarray.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */ 1/* $OpenBSD: recallocarray.c,v 1.2 2021/03/18 11:16:58 claudio Exp $ */
2/* 2/*
3 * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net> 3 * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
4 * 4 *
@@ -57,7 +57,7 @@ recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
57 if (newsize <= oldsize) { 57 if (newsize <= oldsize) {
58 size_t d = oldsize - newsize; 58 size_t d = oldsize - newsize;
59 59
60 if (d < oldsize / 2 && d < getpagesize()) { 60 if (d < oldsize / 2 && d < (size_t)getpagesize()) {
61 memset((char *)ptr + newsize, 0, d); 61 memset((char *)ptr + newsize, 0, d);
62 return ptr; 62 return ptr;
63 } 63 }