Skip to content

Commit

Permalink
PgSQL 11 support, change from FALSE to false, etc.
Browse files Browse the repository at this point in the history
Closes #3931, from Raúl Marín Rodríguez


git-svn-id: http://svn.osgeo.org/postgis/trunk@16116 b70326c6-7e19-0410-871a-916f4a2858ee
  • Loading branch information
pramsey committed Nov 20, 2017
1 parent dc34619 commit b8400ae
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 207 deletions.
2 changes: 1 addition & 1 deletion libpgcommon/lwgeom_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ PROJ4SRSCacheIsEmpty(MemoryContext context)
* Always return false since this call is mandatory according to tgl
* (see postgis-devel archives July 2007)
*/
return FALSE;
return LW_FALSE;
}

static void
Expand Down
20 changes: 10 additions & 10 deletions postgis/geography_btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ Datum geography_lt(PG_FUNCTION_ARGS)
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
if (cmp < 0)
PG_RETURN_BOOL(TRUE);
PG_RETURN_BOOL(true);
else
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

/*
Expand All @@ -68,9 +68,9 @@ Datum geography_le(PG_FUNCTION_ARGS)
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
if (cmp <= 0)
PG_RETURN_BOOL(TRUE);
PG_RETURN_BOOL(true);
else
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

/*
Expand All @@ -84,9 +84,9 @@ Datum geography_gt(PG_FUNCTION_ARGS)
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
if (cmp > 0)
PG_RETURN_BOOL(TRUE);
PG_RETURN_BOOL(true);
else
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

/*
Expand All @@ -100,9 +100,9 @@ Datum geography_ge(PG_FUNCTION_ARGS)
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
if (cmp >= 0)
PG_RETURN_BOOL(TRUE);
PG_RETURN_BOOL(true);
else
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

/*
Expand All @@ -116,9 +116,9 @@ Datum geography_eq(PG_FUNCTION_ARGS)
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
if (cmp == 0)
PG_RETURN_BOOL(TRUE);
PG_RETURN_BOOL(true);
else
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions postgis/geography_measurement.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Datum geography_dwithin(PG_FUNCTION_ARGS)
{
PG_FREE_IF_COPY(g1, 0);
PG_FREE_IF_COPY(g2, 1);
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

/* Do the brute force calculation if the cached calculation doesn't tick over */
Expand Down Expand Up @@ -436,7 +436,7 @@ Datum geography_dwithin_uncached(PG_FUNCTION_ARGS)
/* Return FALSE on empty arguments. */
if ( lwgeom_is_empty(lwgeom1) || lwgeom_is_empty(lwgeom2) )
{
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

distance = lwgeom_distance_spheroid(lwgeom1, lwgeom2, &s, tolerance);
Expand All @@ -451,7 +451,7 @@ Datum geography_dwithin_uncached(PG_FUNCTION_ARGS)
if ( distance < 0.0 )
{
elog(ERROR, "lwgeom_distance_spheroid returned negative!");
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(false);
}

PG_RETURN_BOOL(distance <= tolerance);
Expand Down
52 changes: 26 additions & 26 deletions postgis/gserialized_estimate.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,15 @@ nd_box_merge(const ND_BOX *source, ND_BOX *target)
target->min[d] = Min(target->min[d], source->min[d]);
target->max[d] = Max(target->max[d], source->max[d]);
}
return TRUE;
return true;
}

/** Zero out an ND_BOX */
static int
nd_box_init(ND_BOX *a)
{
memset(a, 0, sizeof(ND_BOX));
return TRUE;
return true;
}

/**
Expand All @@ -524,7 +524,7 @@ nd_box_init_bounds(ND_BOX *a)
a->min[d] = FLT_MAX;
a->max[d] = -1 * FLT_MAX;
}
return TRUE;
return true;
}

/** Set the values of an #ND_BOX from a #GBOX */
Expand Down Expand Up @@ -563,7 +563,7 @@ nd_box_from_gbox(const GBOX *gbox, ND_BOX *nd_box)
}

/**
* Return TRUE if #ND_BOX a overlaps b, false otherwise.
* Return true if #ND_BOX a overlaps b, false otherwise.
*/
static int
nd_box_intersects(const ND_BOX *a, const ND_BOX *b, int ndims)
Expand All @@ -572,13 +572,13 @@ nd_box_intersects(const ND_BOX *a, const ND_BOX *b, int ndims)
for ( d = 0; d < ndims; d++ )
{
if ( (a->min[d] > b->max[d]) || (a->max[d] < b->min[d]) )
return FALSE;
return false;
}
return TRUE;
return true;
}

/**
* Return TRUE if #ND_BOX a contains b, false otherwise.
* Return true if #ND_BOX a contains b, false otherwise.
*/
static int
nd_box_contains(const ND_BOX *a, const ND_BOX *b, int ndims)
Expand All @@ -587,9 +587,9 @@ nd_box_contains(const ND_BOX *a, const ND_BOX *b, int ndims)
for ( d = 0; d < ndims; d++ )
{
if ( ! ((a->min[d] < b->min[d]) && (a->max[d] > b->max[d])) )
return FALSE;
return false;
}
return TRUE;
return true;
}

/**
Expand All @@ -608,7 +608,7 @@ nd_box_expand(ND_BOX *nd_box, double expansion_factor)
nd_box->min[d] -= size * expansion_factor / 2;
nd_box->max[d] += size * expansion_factor / 2;
}
return TRUE;
return true;
}

/**
Expand Down Expand Up @@ -644,7 +644,7 @@ nd_box_overlap(const ND_STATS *nd_stats, const ND_BOX *nd_box, ND_IBOX *nd_ibox)
nd_ibox->min[d] = Max(nd_ibox->min[d], 0);
nd_ibox->max[d] = Min(nd_ibox->max[d], size-1);
}
return TRUE;
return true;
}

/**
Expand All @@ -654,7 +654,7 @@ static inline double
nd_box_ratio(const ND_BOX *b1, const ND_BOX *b2, int ndims)
{
int d;
bool covered = TRUE;
bool covered = true;
double ivol = 1.0;
double vol2 = 1.0;
double vol1 = 1.0;
Expand All @@ -665,7 +665,7 @@ nd_box_ratio(const ND_BOX *b1, const ND_BOX *b2, int ndims)
return 0.0; /* Disjoint */

if ( b1->min[d] > b2->min[d] || b1->max[d] < b2->max[d] )
covered = FALSE;
covered = false;
}

if ( covered )
Expand Down Expand Up @@ -793,7 +793,7 @@ nd_box_array_distribution(const ND_BOX **nd_boxes, int num_boxes, const ND_BOX *
distribution[d] = range;
}

return TRUE;
return true;
}

/**
Expand All @@ -818,10 +818,10 @@ nd_increment(ND_IBOX *ibox, int ndims, int *counter)
}
/* That's it, cannot increment any more! */
if ( d == ndims )
return FALSE;
return false;

/* Increment complete! */
return TRUE;
return true;
}

static ND_STATS*
Expand Down Expand Up @@ -889,7 +889,7 @@ pg_get_nd_stats(const Oid table_oid, AttrNumber att_num, int mode, bool only_par
if ( ! only_parent )
{
POSTGIS_DEBUGF(2, "searching whole tree stats for \"%s\"", get_rel_name(table_oid)? get_rel_name(table_oid) : "NULL");
stats_tuple = SearchSysCache3(STATRELATT, table_oid, att_num, TRUE);
stats_tuple = SearchSysCache3(STATRELATT, table_oid, att_num, true);
if ( stats_tuple )
POSTGIS_DEBUGF(2, "found whole tree stats for \"%s\"", get_rel_name(table_oid)? get_rel_name(table_oid) : "NULL");
}
Expand Down Expand Up @@ -924,7 +924,7 @@ pg_get_nd_stats(const Oid table_oid, AttrNumber att_num, int mode, bool only_par
* debugging functions are taking human input (table names)
* and columns, so we have to look those up first.
* In case of parent tables whith INHERITS, when "only_parent"
* is TRUE this function only searchs for stats in the parent
* is true this function only searchs for stats in the parent
* table ignoring any statistic collected from the children.
*/
static ND_STATS*
Expand Down Expand Up @@ -1249,8 +1249,8 @@ Datum gserialized_gist_joinsel(PG_FUNCTION_ARGS)
get_rel_name(relid1) ? get_rel_name(relid1) : "NULL", relid1, get_rel_name(relid2) ? get_rel_name(relid2) : "NULL", relid2);

/* Pull the stats from the stats system. */
stats1 = pg_get_nd_stats(relid1, var1->varattno, mode, FALSE);
stats2 = pg_get_nd_stats(relid2, var2->varattno, mode, FALSE);
stats1 = pg_get_nd_stats(relid1, var1->varattno, mode, false);
stats2 = pg_get_nd_stats(relid2, var2->varattno, mode, false);

/* If we can't get stats, we have to stop here! */
if ( ! stats1 )
Expand Down Expand Up @@ -1803,7 +1803,7 @@ compute_gserialized_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
* It will need to return a stats builder function reference
* and a "minimum" sample rows to feed it.
* If we want analisys to be completely skipped we can return
* FALSE and leave output vals untouched.
* false and leave output vals untouched.
*
* What we know from this call is:
*
Expand Down Expand Up @@ -1992,7 +1992,7 @@ Datum _postgis_gserialized_stats(PG_FUNCTION_ARGS)
char *str;
text *json;
int mode = 2; /* default to 2D mode */
bool only_parent = FALSE; /* default to whole tree stats */
bool only_parent = false; /* default to whole tree stats */

/* Check if we've been asked to not use 2d mode */
if ( ! PG_ARGISNULL(2) )
Expand Down Expand Up @@ -2036,7 +2036,7 @@ Datum _postgis_gserialized_sel(PG_FUNCTION_ARGS)
mode = text_p_get_mode(PG_GETARG_TEXT_P(3));

/* Retrieve the stats object */
nd_stats = pg_get_nd_stats_by_name(table_oid, att_text, mode, FALSE);
nd_stats = pg_get_nd_stats_by_name(table_oid, att_text, mode, false);

if ( ! nd_stats )
elog(ERROR, "stats for \"%s.%s\" do not exist", get_rel_name(table_oid), text2cstring(att_text));
Expand Down Expand Up @@ -2072,8 +2072,8 @@ Datum _postgis_gserialized_joinsel(PG_FUNCTION_ARGS)


/* Retrieve the stats object */
nd_stats1 = pg_get_nd_stats_by_name(table_oid1, att_text1, mode, FALSE);
nd_stats2 = pg_get_nd_stats_by_name(table_oid2, att_text2, mode, FALSE);
nd_stats1 = pg_get_nd_stats_by_name(table_oid1, att_text1, mode, false);
nd_stats2 = pg_get_nd_stats_by_name(table_oid2, att_text2, mode, false);

if ( ! nd_stats1 )
elog(ERROR, "stats for \"%s.%s\" do not exist", get_rel_name(table_oid1), text2cstring(att_text1));
Expand Down Expand Up @@ -2242,7 +2242,7 @@ Datum gserialized_estimated_extent(PG_FUNCTION_ARGS)
Oid tbl_oid;
ND_STATS *nd_stats;
GBOX *gbox;
bool only_parent = FALSE;
bool only_parent = false;

if ( PG_NARGS() == 4 )
{
Expand Down
Loading

0 comments on commit b8400ae

Please sign in to comment.