#endif
/*
- * read digit
+ * read digit or decimal point
*/
if (isdigit((unsigned char) *Np->inout_p))
{
#ifdef DEBUG_TO_FROM_CHAR
elog(DEBUG_elog_output, "Read digit (%c)", *Np->inout_p);
#endif
-
- /*
- * read decimal point
- */
}
else if (IS_DECIMAL(Np->Num) && Np->read_dec == FALSE)
{
+ /*
+ * We need not test IS_LDECIMAL(Np->Num) explicitly here, because
+ * Np->decimal is always just "." if we don't have a D format token.
+ * So we just unconditionally match to Np->decimal.
+ */
+ int x = strlen(Np->decimal);
+
#ifdef DEBUG_TO_FROM_CHAR
- elog(DEBUG_elog_output, "Try read decimal point (%c)", *Np->inout_p);
+ elog(DEBUG_elog_output, "Try read decimal point (%c)",
+ *Np->inout_p);
#endif
- if (*Np->inout_p == '.')
+ if (x && AMOUNT_TEST(x) && strncmp(Np->inout_p, Np->decimal, x) == 0)
{
+ Np->inout_p += x - 1;
*Np->number_p = '.';
Np->number_p++;
Np->read_dec = TRUE;
isread = TRUE;
}
- else
- {
- int x = strlen(Np->decimal);
-
-#ifdef DEBUG_TO_FROM_CHAR
- elog(DEBUG_elog_output, "Try read locale point (%c)",
- *Np->inout_p);
-#endif
- if (x && AMOUNT_TEST(x) && strncmp(Np->inout_p, Np->decimal, x) == 0)
- {
- Np->inout_p += x - 1;
- *Np->number_p = '.';
- Np->number_p++;
- Np->read_dec = TRUE;
- isread = TRUE;
- }
- }
}
if (OVERLOAD_TEST)