From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Conway <mail@joeconway.com>
Cc: Markus Bertheau <twanger@bluetwanger.de>
Cc: Patches (PostgreSQL) <pgsql-patches@postgresql.org>
Subject: Re: [SQL] array_in: '{}}'::text[]
Date: Fri, 27 Aug 2004 23:05:41 -0400
Message-ID: <14978.1093662341@sss.pgh.pa.us> (raw)
In-Reply-To: <412F9BA5.8070009@joeconway.com>
References: <1093261555.2647.6.camel@dicaprio.akademie1.de>
<412A384C.5000907@joeconway.com>
<412F9BA5.8070009@joeconway.com>
Joe Conway <mail@joeconway.com> writes:
> /* Make a modifiable copy of the input */
> ! string_save = (char *) palloc0(strlen(string) + 1);
> strcpy(string_save, string);
palloc0, instead of palloc, is clearly a waste of cycles here ...
actually, why isn't this just a pstrdup?
> /* special case for an empty array */
> ! if (strlen(str) == 2 && strncmp(str, "{}", 2) == 0)
> return 0;
Why not just if (strcmp(str, "{}") == 0)
Looks reasonable otherwise.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, mail@joeconway.com, twanger@bluetwanger.de, pgsql-patches@postgresql.org
Subject: Re: [SQL] array_in: '{}}'::text[]
In-Reply-To: <14978.1093662341@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox