pike.git/
src/
program.c
Branch:
Tag:
Non-build tags
All tags
No tags
2004-01-16
2004-01-16 21:51:38 by Mirar (Pontus Hagland) <pike@sort.mirar.org>
6c87496c3277bccf812b4bdf350388e6ef8dd339 (
20
lines) (+
16
/-
4
)
[
Show
|
Annotate
]
Branch:
7.9
warnings fixed for my system... lets see about other systems.
Rev: src/program.c:1.549
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: program.c,v 1.
548
2004/01/16 21:
20
:
08
mirar Exp $
+
|| $Id: program.c,v 1.
549
2004/01/16 21:
51
:
38
mirar Exp $
*/ #include "global.h"
-
RCSID("$Id: program.c,v 1.
548
2004/01/16 21:
20
:
08
mirar Exp $");
+
RCSID("$Id: program.c,v 1.
549
2004/01/16 21:
51
:
38
mirar Exp $");
#include "program.h" #include "object.h" #include "dynamic_buffer.h"
1184:
#define RELOCATE_constants(ORIG,NEW) #define RELOCATE_relocations(ORIG,NEW)
+
#if SIZEOF_LONG_LONG == 8
+
/* we have 8 byte ints, hopefully this constant works on all these systems */
+
#define MAXVARS(NUMTYPE) \
+
(NUMTYPE)(sizeof(NUMTYPE)==1?254: \
+
(sizeof(NUMTYPE)==2?65534: \
+
(sizeof(NUMTYPE)==4?4294967294U:18446744073709551614ULL)))
+
#else
+
#define MAXVARS(NUMTYPE) \
+
(NUMTYPE)(sizeof(NUMTYPE)==1?254: (sizeof(NUMTYPE)==2?65534:4294967294U))
+
#endif
+
/* Funny guys use the uppermost value for nonexistant variables and the like. Hence -2 and not -1. Y2K. */ #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \
1193:
CHECK_FOO(NUMTYPE,TYPE,NAME); \ if(m == state->new_program->PIKE_CONCAT(num_,NAME)) { \ TYPE *tmp; \
-
if(m==(
1<<(sizeof(
NUMTYPE)
*8
)
)-2)
\
+
if(m==
MAXVARS
(NUMTYPE))
\
Pike_error("Too many " #NAME ".\n"); \
-
m = MINIMUM(m*2+1,(
1<<(sizeof(
NUMTYPE)
*8
)
)-2)
; \
+
m = MINIMUM(m*2+1,
MAXVARS
(NUMTYPE));
\
tmp = realloc((void *)state->new_program->NAME, \ sizeof(TYPE) * m); \ if(!tmp) Pike_fatal("Out of memory.\n"); \