summaryrefslogtreecommitdiff
path: root/monitor_mm.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-07-04 00:08:23 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-07-04 00:08:23 +0000
commita79616278e15a61eb899bc5b582094c063214238 (patch)
tree9e1cfdd0f28fd81f922463f4fb3f3f8e6863e6c3 /monitor_mm.c
parentedd098b1967fa267d4246a1780d49b18a6c58560 (diff)
- millert@cvs.openbsd.org 2002/06/28 01:49:31
[monitor_mm.c] tree(3) wants an int return value for its compare functions and the difference between two pointers is not an int. Just do the safest thing and store the result in a long and then return 0, -1, or 1 based on that result.
Diffstat (limited to 'monitor_mm.c')
-rw-r--r--monitor_mm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/monitor_mm.c b/monitor_mm.c
index c363036e6..f72a180ea 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: monitor_mm.c,v 1.6 2002/06/04 23:05:49 markus Exp $"); 27RCSID("$OpenBSD: monitor_mm.c,v 1.7 2002/06/28 01:49:31 millert Exp $");
28 28
29#ifdef HAVE_SYS_MMAN_H 29#ifdef HAVE_SYS_MMAN_H
30#include <sys/mman.h> 30#include <sys/mman.h>
@@ -38,7 +38,14 @@ RCSID("$OpenBSD: monitor_mm.c,v 1.6 2002/06/04 23:05:49 markus Exp $");
38static int 38static int
39mm_compare(struct mm_share *a, struct mm_share *b) 39mm_compare(struct mm_share *a, struct mm_share *b)
40{ 40{
41 return ((char *)a->address - (char *)b->address); 41 long diff = (char *)a->address - (char *)b->address;
42
43 if (diff == 0)
44 return (0);
45 else if (diff < 0)
46 return (-1);
47 else
48 return (1);
42} 49}
43 50
44RB_GENERATE(mmtree, mm_share, next, mm_compare) 51RB_GENERATE(mmtree, mm_share, next, mm_compare)