diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-03-18 11:16:59 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-03-18 11:16:59 +0000 |
commit | 714cbbd8e7cbafc85359d9a24dd7bbdf5e10e469 (patch) | |
tree | 857f1e09f8ebe7daf7e1a79e4d37a82b357b6efd /lib/libc | |
parent | 9b255247878256ae9af29334aad8d346f8b72309 (diff) |
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@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/recallocarray.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/recallocarray.c b/lib/libc/stdlib/recallocarray.c index a2f37fe81a9..81059e6ae18 100644 --- a/lib/libc/stdlib/recallocarray.c +++ b/lib/libc/stdlib/recallocarray.c @@ -1,4 +1,4 @@ -/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */ +/* $OpenBSD: recallocarray.c,v 1.2 2021/03/18 11:16:58 claudio Exp $ */ /* * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net> * @@ -57,7 +57,7 @@ recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size) if (newsize <= oldsize) { size_t d = oldsize - newsize; - if (d < oldsize / 2 && d < getpagesize()) { + if (d < oldsize / 2 && d < (size_t)getpagesize()) { memset((char *)ptr + newsize, 0, d); return ptr; } |