*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.69 2005/10/15 02:49:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.70 2005/11/30 23:10:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include <errno.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
errmsg("invalid input syntax for integer: \"%s\"",
s)));
- /*
- * Skip any trailing whitespace; if anything but whitespace remains before
- * the terminating character, bail out
- */
- while (*badp && *badp != c && isspace((unsigned char) *badp))
- badp++;
-
- if (*badp && *badp != c)
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("invalid input syntax for integer: \"%s\"",
- s)));
-
switch (size)
{
case sizeof(int32):
default:
elog(ERROR, "unsupported result size: %d", size);
}
+
+ /*
+ * Skip any trailing whitespace; if anything but whitespace remains before
+ * the terminating character, bail out
+ */
+ while (*badp && *badp != c && isspace((unsigned char) *badp))
+ badp++;
+
+ if (*badp && *badp != c)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
+ errmsg("invalid input syntax for integer: \"%s\"",
+ s)));
+
return (int32) l;
}