В Сбт, 28.08.2004, в 21:33, Joe Conway пишет:
> /* special case for an empty array */
> ! if (strcmp(str, "{}") == 0)
> return 0;
Without looking at the code in a whole, you accept '{} ' as an empty
array literal, so why is the special case for '{}' needed here? I should
be catched by the code that accepts additional whitespace after the last
closing brace, just that there is no white space:
> + /* only whitespace is allowed after the closing brace */
> + while (*ptr)
> + {
> + if (!isspace(*ptr++))
> + ereport(ERROR,
> + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
> + errmsg("malformed array literal: \"%s\"", str)));
> + }
> +
> + /* special case for an empty array */
> + if (empty_array)
> + return 0;
Here's the second special case for empty arrays.
--
Markus Bertheau <twanger@bluetwanger.de>