[postgis-devel] PG_NARGS not defined in fmgr.h < 7.3

strk at refractions.net strk at refractions.net
Thu Oct 21 10:16:58 PDT 2004


Sebastien, current HEAD contains the following lines
in lwgeom_pg.h:

#ifndef PG_NARGS
#define PG_NARGS() (fcinfo->nargs)
#endif

Doesn't this work for you ?
--strk;

On Thu, Oct 21, 2004 at 07:16:14PM +0200, Sébastien NICAISE wrote:
> http://postgis.refractions.net/pipermail/postgis-users/2003-August/002945.html 
> :
> >> PG_NARGS is not defined in fmgr.h < 7.3
> >> It is used with no check in postgis_inout.c (multiple times)
> >>
> >> All checks can be substituted with the macro
> >> PG_ARGISNULL() available also on the older pgres versions.
> 
> Here is the patch for file : lwgeom_inout.c lwgeom_ogc.c postgis_svg.c
> 
> Sebastien N.

> diff -aurN postgis-0.9.0/lwgeom/lwgeom_inout.c postgis-0.9.0.seb/lwgeom/lwgeom_inout.c
> --- postgis-0.9.0/lwgeom/lwgeom_inout.c	Fri Sep 10 09:36:25 2004
> +++ postgis-0.9.0.seb/lwgeom/lwgeom_inout.c	Thu Oct 21 18:34:22 2004
> @@ -141,7 +141,7 @@
>  
>  	wkb_input = (WellKnownBinary *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
>  
> -	if (  ( PG_NARGS()>1) && ( ! PG_ARGISNULL(1) ))
> +	if (!PG_ARGISNULL (1))
>  		SRID = PG_GETARG_INT32(1);
>  	else
>  		SRID = -1;
> diff -aurN postgis-0.9.0/lwgeom/lwgeom_ogc.c postgis-0.9.0.seb/lwgeom/lwgeom_ogc.c
> --- postgis-0.9.0/lwgeom/lwgeom_ogc.c	Wed Sep  8 12:25:26 2004
> +++ postgis-0.9.0.seb/lwgeom/lwgeom_ogc.c	Thu Oct 21 18:35:00 2004
> @@ -689,7 +689,7 @@
>  	LWGEOM *result = NULL;
>  
>  	// read user-requested SRID if any
> -	if ( PG_NARGS() > 1 )
> +	if (!PG_ARGISNULL (1))
>  	{
>  		SRID = PG_GETARG_INT32(1);
>  		if ( SRID != lwgeom_getSRID(geom) )
> diff -aurN postgis-0.9.0/postgis_svg.c postgis-0.9.0.seb/postgis_svg.c
> --- postgis-0.9.0/postgis_svg.c	Fri Sep 10 18:16:31 2004
> +++ postgis-0.9.0.seb/postgis_svg.c	Thu Oct 21 18:39:54 2004
> @@ -55,10 +55,10 @@
>  	geom1 = (GEOMETRY *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
>  
>  	// check for relative path notation
> -	if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
> +	if (! PG_ARGISNULL(1))
>  			svgrel = PG_GETARG_INT32(1);
>  
> -	if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
> +	if (! PG_ARGISNULL(2))
>  		precision = PG_GETARG_INT32(2);
>  		
>  	wkt = geometry_to_svg(geom1, svgrel, precision);

> _______________________________________________
> 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