Move MIN() and MAX() macros to sys/params.h

This commit is contained in:
Arun Thomas 2010-08-21 13:10:41 +00:00
parent 60a71efca8
commit de231a713e
26 changed files with 23 additions and 32 deletions

View file

@ -7,6 +7,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#define ptrace mdbtrace #define ptrace mdbtrace
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include "proto.h" #include "proto.h"

View file

@ -54,9 +54,6 @@
} while (/* CONSTCOND */ 0) } while (/* CONSTCOND */ 0)
#ifndef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#endif
static void ps_letter(struct termp *, char); static void ps_letter(struct termp *, char);
static void ps_begin(struct termp *); static void ps_begin(struct termp *);
static void ps_end(struct termp *); static void ps_end(struct termp *);

View file

@ -64,6 +64,9 @@ __RCSID("$NetBSD: show.c,v 1.30 2009/08/02 17:56:45 joerg Exp $");
#if HAVE_ERR_H #if HAVE_ERR_H
#include <err.h> #include <err.h>
#endif #endif
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include "defs.h" #include "defs.h"
#include "lib.h" #include "lib.h"

View file

@ -91,10 +91,6 @@
#define WRITING 1 /* copy data from user */ #define WRITING 1 /* copy data from user */
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */ #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
/* Macros. */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* Memory is allocated in clicks. */ /* Memory is allocated in clicks. */
#if (CHIP == INTEL) #if (CHIP == INTEL)
#define CLICK_SIZE 4096 /* unit in which memory is allocated */ #define CLICK_SIZE 4096 /* unit in which memory is allocated */

View file

@ -26,6 +26,7 @@
#include <limits.h> #include <limits.h>
#include <stddef.h> #include <stddef.h>
#include <errno.h> #include <errno.h>
#include <sys/param.h>
#include <minix/partition.h> #include <minix/partition.h>
#include <minix/u64.h> #include <minix/u64.h>

View file

@ -36,5 +36,6 @@
#include <stddef.h> #include <stddef.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <sys/param.h>
#endif #endif

View file

@ -12,4 +12,8 @@ sys/param.h
#define NGROUPS 8 /* max number of supplementary groups */ #define NGROUPS 8 /* max number of supplementary groups */
#define MAXPATHLEN __MINIX_PATH_MAX #define MAXPATHLEN __MINIX_PATH_MAX
/* Macros for min/max. */
#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b))
#define MAX(a,b) ((/*CONSTCOND*/(a)>(b))?(a):(b))
#endif /* __SYS_PARAM_H__ */ #endif /* __SYS_PARAM_H__ */

View file

@ -40,6 +40,7 @@
#include <minix/sysutil.h> /* MINIX utility library functions */ #include <minix/sysutil.h> /* MINIX utility library functions */
#include <timers.h> /* watchdog timer management */ #include <timers.h> /* watchdog timer management */
#include <errno.h> /* return codes and error numbers */ #include <errno.h> /* return codes and error numbers */
#include <sys/param.h>
/* Important kernel header files. */ /* Important kernel header files. */
#include "config.h" /* configuration, MUST be first */ #include "config.h" /* configuration, MUST be first */

View file

@ -54,9 +54,6 @@ __RCSID("$NetBSD: bt_overflow.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
#include <db.h> #include <db.h>
#include "btree.h" #include "btree.h"
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* /*
* Big key/data code. * Big key/data code.
* *

View file

@ -51,9 +51,6 @@ __RCSID("$NetBSD: bt_utils.c,v 1.13 2008/09/10 17:52:35 joerg Exp $");
#include <db.h> #include <db.h>
#include "btree.h" #include "btree.h"
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* /*
* __bt_ret -- * __bt_ret --
* Build return key/data pair. * Build return key/data pair.

View file

@ -76,9 +76,6 @@ __RCSID("$NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $");
#define _DIAGASSERT #define _DIAGASSERT
#endif #endif
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static int alloc_segs(HTAB *, int); static int alloc_segs(HTAB *, int);
static int flush_meta(HTAB *); static int flush_meta(HTAB *);
static int hash_access(HTAB *, ACTION, DBT *, DBT *); static int hash_access(HTAB *, ACTION, DBT *, DBT *);

View file

@ -76,9 +76,6 @@ __RCSID("$NetBSD: hash_bigkey.c,v 1.23 2009/02/12 06:33:13 lukem Exp $");
#define _DIAGASSERT #define _DIAGASSERT
#endif #endif
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int); static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int);
static int collect_data(HTAB *, BUFHEAD *, int, int); static int collect_data(HTAB *, BUFHEAD *, int, int);

View file

@ -97,8 +97,6 @@ static BUFHEAD *newbuf(HTAB *, uint32_t, BUFHEAD *);
#define _DIAGASSERT assert #define _DIAGASSERT assert
#endif #endif
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* /*
* We are looking for a buffer with address "addr". If prev_bp is NULL, then * We are looking for a buffer with address "addr". If prev_bp is NULL, then
* address is a bucket index. If prev_bp is not NULL, then it points to the * address is a bucket index. If prev_bp is not NULL, then it points to the

View file

@ -39,10 +39,6 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#endif #endif
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define _POSIX_SOURCE 1 #define _POSIX_SOURCE 1
#define _MINIX 1 #define _MINIX 1

View file

@ -4,14 +4,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <unistd.h> #include <unistd.h>
#define VECTORIO_READ 1 #define VECTORIO_READ 1
#define VECTORIO_WRITE 2 #define VECTORIO_WRITE 2
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
static ssize_t vectorio_buffer(int fildes, const struct iovec *iov, static ssize_t vectorio_buffer(int fildes, const struct iovec *iov,
int iovcnt, int readwrite, ssize_t totallen) int iovcnt, int readwrite, ssize_t totallen)
{ {

View file

@ -1,6 +1,6 @@
#include <string.h> #include <string.h>
#include <sys/param.h>
#include "syslib.h" #include "syslib.h"
/*===========================================================================* /*===========================================================================*

View file

@ -9,6 +9,7 @@
#include <ansi.h> #include <ansi.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h>
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <regex.h> #include <regex.h>

View file

@ -13,6 +13,7 @@
#include "super.h" #include "super.h"
#include <minix/vfsif.h> #include <minix/vfsif.h>
#include <assert.h> #include <assert.h>
#include <sys/param.h>
FORWARD _PROTOTYPE( struct buf *rahead, (struct inode *rip, block_t baseblock, FORWARD _PROTOTYPE( struct buf *rahead, (struct inode *rip, block_t baseblock,

View file

@ -13,6 +13,7 @@
#include <minix/vfsif.h> #include <minix/vfsif.h>
#include <minix/syslib.h> #include <minix/syslib.h>
#include <minix/sysutil.h> #include <minix/sysutil.h>
#include <sys/param.h>
#if DEBUG #if DEBUG
#define dprintf(x) printf x #define dprintf(x) printf x

View file

@ -26,6 +26,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <sys/param.h>
#include "proto.h" #include "proto.h"
#include "super.h" #include "super.h"

View file

@ -20,6 +20,7 @@
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
#include <sys/param.h>
#include "const.h" #include "const.h"
#include "type.h" #include "type.h"

View file

@ -49,6 +49,7 @@
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <assert.h> #include <assert.h>
#include <sys/param.h>
#include "proto.h" #include "proto.h"
#include "const.h" #include "const.h"

View file

@ -20,6 +20,7 @@
#include <assert.h> #include <assert.h>
#include <env.h> #include <env.h>
#include <pagetable.h> #include <pagetable.h>
#include <sys/param.h>
#include "glo.h" #include "glo.h"
#include "proto.h" #include "proto.h"

View file

@ -19,6 +19,7 @@
#include <assert.h> #include <assert.h>
#include <stdint.h> #include <stdint.h>
#include <memory.h> #include <memory.h>
#include <sys/param.h>
#include "vm.h" #include "vm.h"
#include "proto.h" #include "proto.h"

View file

@ -24,6 +24,7 @@
#include <unistd.h> #include <unistd.h>
#include <memory.h> #include <memory.h>
#include <assert.h> #include <assert.h>
#include <sys/param.h>
#include "proto.h" #include "proto.h"
#include "glo.h" #include "glo.h"

View file

@ -1,6 +1,7 @@
/* Tests for truncate(2) call family - by D.C. van Moolenbroek */ /* Tests for truncate(2) call family - by D.C. van Moolenbroek */
#define _POSIX_SOURCE 1 #define _POSIX_SOURCE 1
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/param.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <assert.h> #include <assert.h>
@ -12,10 +13,6 @@
#define TESTSIZE 4096 #define TESTSIZE 4096
#define THRESHOLD 1048576 #define THRESHOLD 1048576
#ifndef MIN
#define MIN(x,y) (((x)<(y))?(x):(y))
#endif
#include "common.c" #include "common.c"
_PROTOTYPE(int main, (int argc, char *argv[])); _PROTOTYPE(int main, (int argc, char *argv[]));