switch (value->type)
{
case T_Integer:
- appendStringInfo(str, "%ld", value->val.ival);
+ appendStringInfo(str, "%d", value->val.ival);
break;
case T_Float:
errno = 0;
val = strtol(token, &endptr, 10);
- (void) val; /* avoid compiler warning if unused */
- if (endptr != token + length || errno == ERANGE
-#ifdef HAVE_LONG_INT_64
- /* if long > 32 bits, check for overflow of int4 */
- || val != (long) ((int32) val)
-#endif
- )
+ if (endptr != token + length || errno == ERANGE ||
+ /* check for overflow of int */
+ val != (int) val)
return T_Float;
return T_Integer;
}
case T_Integer:
/*
- * we know that the token terminates on a char atol will stop at
+ * we know that the token terminates on a char atoi will stop at
*/
- result = (Node *) makeInteger(atol(token));
+ result = (Node *) makeInteger(atoi(token));
break;
case T_Float:
{
* makeInteger
*/
Value *
-makeInteger(long i)
+makeInteger(int i)
{
Value *v = makeNode(Value);
errno = 0;
val = strtol(token, &endptr, 10);
- if (*endptr != '\0' || errno == ERANGE
-#ifdef HAVE_LONG_INT_64
- /* if long > 32 bits, check for overflow of int4 */
- || val != (long) ((int32) val)
-#endif
- )
+ if (*endptr != '\0' || errno == ERANGE ||
+ /* check for overflow of int */
+ val != (int) val)
{
/* integer too large, treat it as a float */
lval->str = pstrdup(token);
switch (nodeTag(&con->val))
{
case T_Integer:
- appendStringInfo(&buf, "%ld", intVal(&con->val));
+ appendStringInfo(&buf, "%d", intVal(&con->val));
break;
case T_Float:
/* represented as a string, so just copy it */
* better to use the more general representation.)
*
* Note that an integer-looking string will get lexed as T_Float if
- * the value is too large to fit in a 'long'.
+ * the value is too large to fit in an 'int'.
*
* Nulls, of course, don't need the value part at all.
*----------------------
NodeTag type; /* tag appropriately (eg. T_String) */
union ValUnion
{
- long ival; /* machine integer */
+ int ival; /* machine integer */
char *str; /* string */
} val;
} Value;
#define floatVal(v) atof(((Value *)(v))->val.str)
#define strVal(v) (((Value *)(v))->val.str)
-extern Value *makeInteger(long i);
+extern Value *makeInteger(int i);
extern Value *makeFloat(char *numericStr);
extern Value *makeString(char *str);
extern Value *makeBitString(char *str);
errno = 0;
val = strtol((char *)yytext, &endptr,10);
- if (*endptr != '\0' || errno == ERANGE
-#ifdef HAVE_LONG_INT_64
- /* if long > 32 bits, check for overflow of int4 */
- || val != (long) ((int32) val)
-#endif
- )
+ if (*endptr != '\0' || errno == ERANGE ||
+ /* check for overflow of int */
+ val != (int) val)
{
errno = 0;
base_yylval.str = mm_strdup(yytext);