Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TfPs6-0005x8-R2 for pgsql-www@arkaria.postgresql.org; Mon, 03 Dec 2012 06:51:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TfPs5-0006jx-ML for pgsql-www@arkaria.postgresql.org; Mon, 03 Dec 2012 06:51:17 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TfPJ5-0006aP-QX; Mon, 03 Dec 2012 06:15:08 +0000 Received: from smtprelay0017.b.hostedemail.com ([64.98.42.17] helo=smtprelay.b.hostedemail.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TfPJ3-0003b0-0A; Mon, 03 Dec 2012 06:15:06 +0000 Received: from filter.hostedemail.com (b-bigip1 [10.5.19.254]) by smtprelay05.b.hostedemail.com (Postfix) with SMTP id 8A1E3F9C308; Mon, 3 Dec 2012 06:15:03 +0000 (UTC) X-Panda: scanned! X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Filterd-Recvd-Size: 3485 Received: from perhan.alvh.no-ip.org (unknown [190.95.4.9]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf13.b.hostedemail.com (Postfix) with ESMTPA; Mon, 3 Dec 2012 06:15:00 +0000 (UTC) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 959436E0CE; Mon, 3 Dec 2012 03:14:54 -0300 (CLST) Date: Mon, 3 Dec 2012 03:14:54 -0300 From: Alvaro Herrera To: david@fetter.org, rk204885@gmail.com Cc: pgsql-general@postgresql.org, w^3 Subject: MODERATOR WARNING Re: [GENERAL] Exception Handling in C-Language Functions? Message-ID: <20121203061454.GB4601@alvh.no-ip.org> References: <1354511937712-5734656.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1354511937712-5734656.post@n5.nabble.com> User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-www Precedence: bulk Sender: pgsql-www-owner@postgresql.org MODERATOR WARNING I noticed that this guy Rahul seems to be reinjecting old list emails somehow. Please don't approve anything coming from him. Observe this example: http://postgresql.1045698.n5.nabble.com/Re-GENERAL-MS-Access-and-Stored-pro= cedures-td1843848.html http://postgresql.1045698.n5.nabble.com/Re-GENERAL-MS-Access-and-Stored-pro= cedures-td5734652.html The original message was posted in 2005! The message here is this one (also in 2005): http://postgresql.1045698.n5.nabble.com/GENERAL-Exception-Handling-in-C-Lan= guage-Functions-td1843896.html I have no idea what's going on. Maybe it's something to do with Nabble. There are others pending moderation in pgsql-admin and pgsql-hackers too. rahul143 wrote: > I have the created a C-Language function (code is below). Now, I=20 > wonder: How do I handle exceptions, for example if malloc cannot assign= =20 > the necessary memory? Do "palloc" and "pfree" handle such a case=20 > cleanly? Should I simply use an "assert"?=20 >=20 > #include "postgres.h"=20 > #include =20 > #include =20 > #include "fmgr.h"=20 > #include "libinn.h"=20 >=20 > PG_FUNCTION_INFO_V1(ffiinews_uwildmat);=20 >=20 > /* Wrapper for INN's function uwildmat. Needs parameters in UTF-8. */=20 > Datum ffiinews_uwildmat(PG_FUNCTION_ARGS) {=20 > VarChar *text =3D PG_GETARG_VARCHAR_P(0);=20 > VarChar *pattern =3D PG_GETARG_VARCHAR_P(1);=20 > int text_len =3D VARSIZE(text)-VARHDRSZ;=20 > int pattern_len =3D VARSIZE(pattern)-VARHDRSZ;=20 > char *tmp_text =3D (char *)malloc(text_len+1);=20 > if (tmp_text =3D=3D NULL)=20 > ; /* What now? */=20 > char *tmp_pattern =3D (char *)malloc(pattern_len+1);=20 > if (tmp_pattern =3D=3D NULL)=20 > ; /* What now? */=20 > strncpy(tmp_text, VARDATA(text), text_len);=20 > tmp_text[text_len] =3D '\0';=20 > strncpy(tmp_pattern, VARDATA(pattern), pattern_len);=20 > tmp_pattern[pattern_len] =3D '\0';=20 > bool matches =3D uwildmat(tmp_text, tmp_pattern);=20 >=20 >=20 >=20 > ----- >=20 >=20 >=20 >=20 > -- > View this message in context: http://postgresql.1045698.n5.nabble.com/GEN= ERAL-Exception-Handling-in-C-Language-Functions-tp5734656.html > Sent from the PostgreSQL - general mailing list archive at Nabble.com. >=20 >=20 > --=20 > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general --=20 =C1lvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --=20 Sent via pgsql-www mailing list (pgsql-www@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-www