diff options
author | bde <bde@FreeBSD.org> | 1994-09-18 23:04:25 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1994-09-18 23:04:25 +0000 |
commit | a15bf9b145684a97461699da306c542880a34df6 (patch) | |
tree | 4681d164a0c1dc83df6d90d5e1249078002b22f0 /sys/libkern | |
parent | ce10b298dff1eea96989b1d8fc9ac8b22535798f (diff) | |
download | FreeBSD-src-a15bf9b145684a97461699da306c542880a34df6.zip FreeBSD-src-a15bf9b145684a97461699da306c542880a34df6.tar.gz |
Use new-style declarations for min/max functions so that
"gcc -Wstrict-prototypes" doesn't emit warnings about them.
Write each min/max functions on a single line so that the similarity and
triviality of the functions is more obvious.
Put the quad min/max functions in the correct place (aphabetical order).
The u_quad min/max functions are missing. Only 3 or 4 of the min/max
functions are actually used. sys/socketvar.h ``should use "lmin" but
it doesn't exist now''. lmin does exist now, but isn't used. Since we
depend on gcc for `inline', perhaps we should depend on it for __typeof
and function-expressions and use only macros min() and max() that work
for any types (I'm not sure how to handle mixed types).
Diffstat (limited to 'sys/libkern')
-rw-r--r-- | sys/libkern/libkern.h | 73 |
1 files changed, 11 insertions, 62 deletions
diff --git a/sys/libkern/libkern.h b/sys/libkern/libkern.h index 752c28c..80d9e54 100644 --- a/sys/libkern/libkern.h +++ b/sys/libkern/libkern.h @@ -31,72 +31,21 @@ * SUCH DAMAGE. * * @(#)libkern.h 8.1 (Berkeley) 6/10/93 - * $Id: libkern.h,v 1.2 1994/08/02 07:44:03 davidg Exp $ + * $Id: libkern.h,v 1.3 1994/08/30 18:19:47 davidg Exp $ */ #include <sys/types.h> -static inline int -imax(a, b) - int a, b; -{ - return (a > b ? a : b); -} -static inline int -imin(a, b) - int a, b; -{ - return (a < b ? a : b); -} -static inline long -lmax(a, b) - long a, b; -{ - return (a > b ? a : b); -} -static inline long -lmin(a, b) - long a, b; -{ - return (a < b ? a : b); -} -static inline u_int -max(a, b) - u_int a, b; -{ - return (a > b ? a : b); -} -static inline u_int -min(a, b) - u_int a, b; -{ - return (a < b ? a : b); -} -static inline u_long -ulmax(a, b) - u_long a, b; -{ - return (a > b ? a : b); -} -static inline u_long -ulmin(a, b) - u_long a, b; -{ - return (a < b ? a : b); -} - -static inline quad_t -qmax(a, b) - quad_t a, b; -{ - return (a > b ? a : b); -} -static inline quad_t -qmin(a, b) - quad_t a, b; -{ - return (a < b ? a : b); -} +static inline int imax(int a, int b) { return (a > b ? a : b); } +static inline int imin(int a, int b) { return (a < b ? a : b); } +static inline long lmax(long a, long b) { return (a > b ? a : b); } +static inline long lmin(long a, long b) { return (a < b ? a : b); } +static inline u_int max(u_int a, u_int b) { return (a > b ? a : b); } +static inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } +static inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); } +static inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } +static inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } +static inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } /* Prototypes for non-quad routines. */ int bcmp __P((const void *, const void *, size_t)); |