[postgis-devel] unite_array() error handling

David Blasby dblasby at gmail.com
Mon Feb 7 09:34:57 PST 2005


"elog(ERROR,...)" causes the function to return, so the next line
"PG_RETURN_NULL()" never actually gets executed.

Unfortunately, the compiler isnt smart enough to know that its going
to return, so it will sometimes complain.  Adding the
never-actually-executed "PG_RETURN_NULL()" makes the compiler happy.

dave

On Mon, 07 Feb 2005 14:56:21 +0100, Markus Schaber
<schabios at logi-track.com> wrote:
> Hi,
> 
> I just read in the unite_garray() code, and have a small question
> regarding the error handling. Should there be a call to PG_RETURN_NULL()
> added after the elog() call in line 238?
> 
>                if ( g2 == NULL )
>                {
>                        GEOSdeleteGeometry(g1);
>                        GEOSdeleteGeometry(geos_result);
>                        elog(ERROR,"GEOS union() threw an error!");
> here -->                PG_RETURN_NULL();
>                }
> 
> I'm not shure about the elog() sematics (is this a macro that
> automatically returns?), but some lines below, PG_RETURN_NULL() is called:
> 
>        if ( result == NULL )
>        {
>                elog(ERROR, "GEOS2POSTGIS returned an error");
>                PG_RETURN_NULL(); //never get here
>        }
> 
> BTW, what's the exact meaning of //never get here? :-)
> 
> I'm currently searching for good docs regarding writing PostgreSQL C
> extensions. Is the material in the official PG manual the only / best
> one available?
> 
> Markus
> 
> --
> markus schaber | dipl. informatiker
> logi-track ag | rennweg 14-16 | ch 8001 zürich
> phone +41-43-888 62 52 | fax +41-43-888 62 53
> mailto:schabios at logi-track.com | www.logi-track.com
> 
> 
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
> 
> 
> 
>



More information about the postgis-devel mailing list