X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 987E55E46C1 for ; Sat, 28 Aug 2004 00:05:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54451-01 for ; Sat, 28 Aug 2004 03:05:48 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id D205E5E3631 for ; Sat, 28 Aug 2004 00:05:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i7S35fxl014979; Fri, 27 Aug 2004 23:05:42 -0400 (EDT) To: Joe Conway Cc: Markus Bertheau , "Patches (PostgreSQL)" Subject: Re: [SQL] array_in: '{}}'::text[] In-reply-to: <412F9BA5.8070009@joeconway.com> References: <1093261555.2647.6.camel@dicaprio.akademie1.de> <412A384C.5000907@joeconway.com> <412F9BA5.8070009@joeconway.com> Comments: In-reply-to Joe Conway message dated "Fri, 27 Aug 2004 13:37:57 -0700" Date: Fri, 27 Aug 2004 23:05:41 -0400 Message-ID: <14978.1093662341@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/520 X-Sequence-Number: 12809 Joe Conway 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