Move min/max/bound and field_offset into better locations.

min/max bound into mathlib.h (they /are/ math functions, after all) and
field_offset into qtypes.h.
This commit is contained in:
Bill Currie 2011-12-24 10:04:33 +09:00
parent 59ef1eae9d
commit cc5140e3a1
18 changed files with 29 additions and 13 deletions

View file

@ -14,6 +14,7 @@
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/idparse.h"
#include "QF/mathlib.h"
#include "QF/msg.h"
#include "QF/plugin.h"
#include "QF/qargs.h"

View file

@ -37,6 +37,16 @@
#include <math.h>
#include "QF/qtypes.h"
#ifndef max
# define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef min
# define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef bound
# define bound(a,b,c) (max(a, min(b, c)))
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h
#endif

View file

@ -42,6 +42,9 @@
# undef msg_t
#endif
#undef field_offset
#define field_offset(type,field) ((size_t)&(((type *)0)->field))
#define MAX_QPATH 64
#ifndef _DEF_BYTE_

View file

@ -38,16 +38,6 @@
#include <stdlib.h>
#ifndef max
# define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef min
# define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef bound
# define bound(a,b,c) (max(a, min(b, c)))
#endif
/* This fixes warnings when compiling with -pedantic */
#if defined(__GNUC__) && !defined(inline)
# define inline __inline__
@ -110,7 +100,4 @@ size_t strnlen (const char *str, size_t len);
# include "qstring.h"
#endif
#undef field_offset
#define field_offset(type,field) ((size_t)&(((type *)0)->field))
#endif // __compat_h

View file

@ -44,6 +44,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/plugin.h"
#include "QF/sys.h"
#include "QF/va.h"

View file

@ -45,6 +45,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cmd.h"
#include "QF/console.h"
#include "QF/keys.h"
#include "QF/mathlib.h"
#include "compat.h"

View file

@ -47,6 +47,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cvar.h"
#include "QF/dstring.h"
#include "QF/hash.h"
#include "QF/mathlib.h"
#include "QF/pr_debug.h"
#include "QF/progs.h"
#include "QF/qendian.h"

View file

@ -48,6 +48,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cvar.h"
#include "QF/dstring.h"
#include "QF/hash.h"
#include "QF/mathlib.h"
#include "QF/pr_obj.h"
#include "QF/progs.h"
#include "QF/ruamoko.h"

View file

@ -42,6 +42,8 @@ static __attribute__ ((used)) const char rcsid[] =
#include <stdlib.h> // should be sys/types.h, but bc is stupid
#include "QF/hash.h"
#include "QF/qtypes.h"
#include "QF/mathlib.h"
#include "QF/sys.h"
#include "compat.h"

View file

@ -80,6 +80,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cvar.h"
#include "QF/dstring.h"
#include "QF/hash.h"
#include "QF/mathlib.h"
#include "QF/pak.h"
#include "QF/pakfile.h"
#include "QF/qargs.h"

View file

@ -78,6 +78,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/dstring.h"
#include "QF/mathlib.h"
#include "QF/sys.h"
#include "QF/quakefs.h"
#include "QF/va.h"

View file

@ -43,6 +43,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "QF/zone.h"

View file

@ -45,6 +45,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/crc.h"
#include "QF/cvar.h"
#include "QF/draw.h"
#include "QF/mathlib.h"
#include "QF/sys.h"
#include "QF/vid.h"
#include "QF/GL/defines.h"

View file

@ -41,6 +41,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "QF/va.h"

View file

@ -35,6 +35,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include <math.h>
#include "QF/console.h"
#include "QF/mathlib.h"
#include "QF/sys.h"
#include "QF/vid.h"

View file

@ -33,6 +33,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "QF/va.h"

View file

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "QF/bspfile.h"
#include "QF/cmd.h"
#include "QF/cvar.h"
#include "QF/mathlib.h"
#include "QF/pcx.h"
#include "QF/png.h"
#include "QF/quakefs.h"

View file

@ -42,6 +42,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include <stdlib.h>
#include "QF/dstring.h"
#include "QF/mathlib.h"
#include "QF/qtypes.h"
#include "compat.h"