finfoP = (FuncIndexInfo **) palloc(n_indices * sizeof(FuncIndexInfo *));
ObjectIdGetDatum(RelationGetRelid(index_rels[i])),
elog(ERROR, "CopyReadAttribute - end of record marker corrupted. line: %d", lineno);
* geqo_erx.c--
* edge recombination crossover [ER]
*
-* $Id: geqo_erx.c,v 1.9 1998/06/15 19:28:34 momjian Exp $
+* $Id: geqo_erx.c,v 1.10 1998/09/01 03:23:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
edge_table = (Edge *) palloc((num_gene + 1) * sizeof(Edge));
- return (edge_table);
+ return edge_table;
}
/* free_edge_table--
}
/* return average number of edges per index */
- return (((float) (edge_total * 2) / (float) num_gene));
+ return ((float) (edge_total * 2) / (float) num_gene);
}
/* gimme_edge--
/* mark shared edges as negative */
edge_table[city1].edge_list[i] = 0 - city2;
- return (0);
+ return 0;
}
}
edge_table[city1].total_edges++;
edge_table[city1].unused_edges++;
- return (1);
+ return 1;
}
/* gimme_tour--
} /* for (i=1; i
- return (edge_failures);
+ return edge_failures;
}
* converting to absolute values
*/
if (friend < 0)
- return ((Gene) Abs(friend));
+ return (Gene) Abs(friend);
/*
minimum_count--;
if (minimum_count == rand_decision)
- return (friend);
+ return friend;
}
}
four_count--;
if (rand_decision == four_count)
- return ((Gene) i);
+ return (Gene) i;
}
}
remaining_edges--;
if (rand_decision == remaining_edges)
- return (i);
+ return i;
}
}
for (i = 1; i <= num_gene; i++)
if (edge_table[i].unused_edges >= 0)
- return ((Gene) i);
+ return (Gene) i;
elog(DEBUG, "edge_failure(3): no edge found via looking for the last ununsed point");
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_eval.c,v 1.22 1998/08/10 02:26:16 momjian Exp $
+ * $Id: geqo_eval.c,v 1.23 1998/09/01 03:23:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static List *gimme_clause_joins(Query *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel);
static RelOptInfo *gimme_clauseless_join(RelOptInfo *outer_rel, RelOptInfo *inner_rel);
-static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo);
+static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo);
static List *new_join_tlist(List *tlist, List *other_relids, int first_resdomno);
static List *new_joininfo_list(List *joininfo_list, List *join_relids);
static void geqo_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel);
pfree(joinrel);
freeList(temp);
- return (fitness);
+ return fitness;
}
}
- return (outer_rel); /* tree finished ... */
+ return outer_rel; /* tree finished ... */
}
/*
foreach(i, joininfo_list)
{
- JInfo *joininfo = (JInfo *) lfirst(i);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(i);
RelOptInfo *rel = NULL;
if (!joininfo->inactive)
}
}
- return (join_list);
+ return join_list;
}
/*
static RelOptInfo *
gimme_clauseless_join(RelOptInfo *outer_rel, RelOptInfo *inner_rel)
{
- return (init_join_rel(outer_rel, inner_rel, (JInfo *) NULL));
+ return init_join_rel(outer_rel, inner_rel, (JoinInfo *) NULL);
}
/*
* Returns the new join relation node.
*/
static RelOptInfo *
-init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
+init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo)
{
RelOptInfo *joinrel = makeNode(RelOptInfo);
List *joinrel_joininfo_list = NIL;
geqo_joinrel_size(joinrel, outer_rel, inner_rel);
- return (joinrel);
+ return joinrel;
}
/*
}
}
- return (t_list);
+ return t_list;
}
/*
{
List *current_joininfo_list = NIL;
List *new_otherrels = NIL;
- JInfo *other_joininfo = (JInfo *) NULL;
+ JoinInfo *other_joininfo = (JoinInfo *) NULL;
List *xjoininfo = NIL;
foreach(xjoininfo, joininfo_list)
{
List *or;
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
new_otherrels = joininfo->otherrels;
foreach(or, new_otherrels)
}
else
{
- other_joininfo = makeNode(JInfo);
+ other_joininfo = makeNode(JoinInfo);
other_joininfo->otherrels =
joininfo->otherrels;
}
}
- return (current_joininfo_list);
+ return current_joininfo_list;
}
#ifdef NOTUSED
List *super_rels;
List *xsuper_rel = NIL;
- JInfo *new_joininfo;
+ JoinInfo *new_joininfo;
foreach(xjoinrel, joinrels)
{
foreach(xjoininfo, joinrel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
List *other_rels = joininfo->otherrels;
List *clause_info = joininfo->jinfoclauseinfo;
bool mergejoinable = joininfo->mergejoinable;
rel = rel_member(relids, root->base_rel_list);
super_rels = rel->superrels;
- new_joininfo = makeNode(JInfo);
+ new_joininfo = makeNode(JoinInfo);
new_joininfo->otherrels = joinrel->relids;
new_joininfo->jinfoclauseinfo = clause_info;
if (nonoverlap_rels(super_rel, joinrel))
{
List *new_relids = super_rel->relids;
- JInfo *other_joininfo =
+ JoinInfo *other_joininfo =
joininfo_member(new_relids,
joinrel->joininfo);
}
else
{
- JInfo *new_joininfo = makeNode(JInfo);
+ JoinInfo *new_joininfo = makeNode(JoinInfo);
new_joininfo->otherrels = new_relids;
new_joininfo->jinfoclauseinfo = clause_info;
foreach(xjoininfo, rel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
if (joininfo->otherrels != NIL)
{
}
}
- return (t_list);
+ return t_list;
}
/*
static bool
nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
{
- return (nonoverlap_sets(rel1->relids, rel2->relids));
+ return nonoverlap_sets(rel1->relids, rel2->relids);
}
static bool
int e = lfirsti(x);
if (intMember(e, s2))
- return (false);
+ return false;
}
- return (true);
+ return true;
}
#endif /* NOTUSED */
double
geqo_log(double x, double b)
{
- return (log(x) / log(b));
+ return log(x) / log(b);
}
static RelOptInfo *
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_main.c,v 1.9 1998/08/10 02:26:17 momjian Exp $
+ * $Id: geqo_main.c,v 1.10 1998/09/01 03:23:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
free_pool(pool);
- return (best_rel);
+ return best_rel;
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_misc.c,v 1.9 1998/07/18 04:22:28 momjian Exp $
+ * $Id: geqo_misc.c,v 1.10 1998/09/01 03:23:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < pool->size; i++)
cumulative = cumulative + pool->data[i].worth;
- return ((float) cumulative / pool->size);
+ return (float) cumulative / pool->size;
}
/* print_pool--
foreach(l, clauses)
{
- CInfo *c = lfirst(l);
+ ClauseInfo *c = lfirst(l);
print_expr((Node *) c->clause, root->rtable);
if (lnext(l))
*
* Copyright (c) 1994, Regents of the University of California
*
-* $Id: geqo_params.c,v 1.9 1998/06/15 19:28:36 momjian Exp $
+* $Id: geqo_params.c,v 1.10 1998/09/01 03:23:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ungetc(c, fp);
/* If we ended with a newline, return that, otherwise return 0 */
- return (c == '\n' ? '\n' : 0);
+ return c == '\n' ? '\n' : 0;
}
/* gimme_pool_size--
size = pow(2.0, exponent);
if (size < MIN_POOL)
- return (MIN_POOL);
+ return MIN_POOL;
else if (size > MAX_POOL)
- return (MAX_POOL);
+ return MAX_POOL;
else
- return ((int) ceil(size));
+ return (int) ceil(size);
}
/* gimme_number_generations--
number_gens = (int) ceil(geqo_log((double) pool_size, 2.0));
- return (effort * number_gens);
+ return effort * number_gens;
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_paths.c,v 1.10 1998/07/18 04:22:28 momjian Exp $
+ * $Id: geqo_paths.c,v 1.11 1998/09/01 03:23:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
geqo_prune_rels(geqo_prune_rel((RelOptInfo *) lfirst(rel_list),
lnext(rel_list))));
}
- return (temp_list);
+ return temp_list;
}
/*
t_list = nconc(t_list, temp_node);
}
}
- return (t_list);
+ return t_list;
}
/*
else
rel->unorderedpath = (Path *) unorderedpath;
- return (cheapest);
+ return cheapest;
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_pool.c,v 1.8 1998/06/15 19:28:37 momjian Exp $
+ * $Id: geqo_pool.c,v 1.9 1998/09/01 03:23:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < pool_size; i++)
chromo[i].string = palloc((string_length + 1) * sizeof(Gene));
- return (new_pool);
+ return new_pool;
}
/*
Chromosome chromo2 = *(Chromosome *) arg2;
if (chromo1.worth == chromo2.worth)
- return (0);
+ return 0;
else if (chromo1.worth > chromo2.worth)
- return (1);
+ return 1;
else
- return (-1);
+ return -1;
}
/* alloc_chromo--
chromo = (Chromosome *) palloc(sizeof(Chromosome));
chromo->string = (Gene *) palloc((string_length + 1) * sizeof(Gene));
- return (chromo);
+ return chromo;
}
/* free_chromo--
* geqo_recombination.c--
* misc recombination procedures
*
-* $Id: geqo_recombination.c,v 1.5 1998/02/26 04:32:25 momjian Exp $
+* $Id: geqo_recombination.c,v 1.6 1998/09/01 03:23:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
city_table = (City *) palloc((num_gene + 1) * sizeof(City));
- return (city_table);
+ return city_table;
}
/* free_city_table--
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_selection.c,v 1.4 1997/09/08 21:44:41 momjian Exp $
+ * $Id: geqo_selection.c,v 1.5 1998/09/01 03:23:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
max * (bias - sqrt((bias * bias) - 4.0 * (bias - 1.0) * geqo_rand()))
/ 2.0 / (bias - 1.0);
- return ((int) index);
+ return (int) index;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.21 1998/08/10 04:49:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.22 1998/09/01 03:23:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
foreach(l, clauses)
{
- CInfo *c = lfirst(l);
+ ClauseInfo *c = lfirst(l);
print_expr((Node *) c->clause, root->rtable);
if (lnext(l))
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.11 1998/08/09 04:17:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.12 1998/09/01 03:23:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
{
List *temp;
- CInfo *clausenode;
+ ClauseInfo *clausenode;
Cost cost_clause;
foreach(temp, clauseinfo_list)
{
- clausenode = (CInfo *) lfirst(temp);
+ clausenode = (ClauseInfo *) lfirst(temp);
cost_clause = clausenode->selectivity;
if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause)
clausenode->selectivity = new_selectivity;
foreach(xclausenode, clauseinfo_list)
{
- temp = ((CInfo *) lfirst(xclausenode))->selectivity;
+ temp = ((ClauseInfo *) lfirst(xclausenode))->selectivity;
result = result * temp;
}
}
- return (result);
+ return result;
}
/*
set_rest_selec(Query *root, List *clauseinfo_list)
{
List *temp = NIL;
- CInfo *clausenode = (CInfo *) NULL;
+ ClauseInfo *clausenode = (ClauseInfo *) NULL;
Cost cost_clause;
foreach(temp, clauseinfo_list)
{
- clausenode = (CInfo *) lfirst(temp);
+ clausenode = (ClauseInfo *) lfirst(temp);
cost_clause = clausenode->selectivity;
/*
* Both 'or' and 'and' clauses are evaluated as described in
* (compute_selec).
*/
- return (compute_selec(root, ((Expr *) clause)->args, or_selectivities));
+ return compute_selec(root, ((Expr *) clause)->args, or_selectivities);
}
else
{
- return (compute_selec(root, lcons(clause, NIL), or_selectivities));
+ return compute_selec(root, lcons(clause, NIL), or_selectivities);
}
}
*/
if (length(clauses) < 2)
- return (s1);
+ return s1;
else
{
/* Compute selectivity of the 'or'ed subclauses. */
s2 = compute_selec(root, lnext(clauses), lnext(or_selectivities));
else
s2 = compute_selec(root, lnext(clauses), NIL);
- return (s1 + s2 - s1 * s2);
+ return s1 + s2 - s1 * s2;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.23 1998/08/04 16:44:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.24 1998/09/01 03:23:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
temp += _cpu_page_wight_ * reltuples;
}
Assert(temp >= 0);
- return (temp);
+ return temp;
}
temp = temp + (_cpu_page_wight_ * selec * reltuples);
Assert(temp >= 0);
- return (temp);
+ return temp;
}
/*
if (tuples == 0 || keys == NULL)
{
Assert(temp >= 0);
- return (temp);
+ return temp;
}
temp += pages * base_log((double) pages, (double) 2.0);
temp = temp + cost_seqscan(_TEMP_RELATION_ID_, npages, tuples);
Assert(temp >= 0);
- return (temp);
+ return temp;
}
temp = temp + page_size(tuples, width);
temp = temp + _cpu_page_wight_ * tuples;
Assert(temp >= 0);
- return (temp);
+ return temp;
}
#endif
temp += outertuples * innercost;
Assert(temp >= 0);
- return (temp);
+ return temp;
}
/*
temp += _cpu_page_wight_ * (outersize + innersize);
Assert(temp >= 0);
- return (temp);
+ return temp;
}
/*
temp += _cpu_page_wight_ * (outersize + nrun * innersize);
Assert(temp >= 0);
- return (temp);
+ return temp;
}
/*
temp1 = ceil((double) temp);
Assert(temp1 >= 0);
Assert(temp1 <= MAXINT);
- return (temp1);
+ return temp1;
}
/*
int
compute_rel_width(RelOptInfo *rel)
{
- return (compute_targetlist_width(get_actual_tlist(rel->targetlist)));
+ return compute_targetlist_width(get_actual_tlist(rel->targetlist));
}
/*
tuple_width = tuple_width +
compute_attribute_width(lfirst(temp_tl));
}
- return (tuple_width);
+ return tuple_width;
}
/*
int width = get_typlen(tlistentry->resdom->restype);
if (width < 0)
- return (_DEFAULT_ATTRIBUTE_WIDTH_);
+ return _DEFAULT_ATTRIBUTE_WIDTH_;
else
- return (width);
+ return width;
}
/*
}
Assert(temp1 >= 0);
- return (temp1);
+ return temp1;
}
/*
temp = ceil((double) (tuples * (width + sizeof(HeapTupleData)))
/ BLCKSZ);
Assert(temp >= 0);
- return (temp);
+ return temp;
}
static double
base_log(double x, double b)
{
- return (log(x) / log(b));
+ return log(x) / log(b);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.5 1998/02/26 04:32:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.6 1998/09/01 03:23:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int inner_relid)
{
List *hashinfo_list = NIL;
- CInfo *clauseinfo = (CInfo *) NULL;
+ ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
List *i = NIL;
Oid hashjoinop = 0;
foreach(i, clauseinfo_list)
{
- clauseinfo = (CInfo *) lfirst(i);
+ clauseinfo = (ClauseInfo *) lfirst(i);
hashjoinop = clauseinfo->hashjoinoperator;
/*
lcons(keys, xhashinfo->jmethod.jmkeys);
}
}
- return (hashinfo_list);
+ return hashinfo_list;
}
key = xhashinfo->hashop;
if (hashop == key)
{ /* found */
- return (xhashinfo); /* should be a hashinfo node ! */
+ return xhashinfo; /* should be a hashinfo node ! */
}
}
- return ((HInfo *) NIL);
+ return (HInfo *) NIL;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.32 1998/08/31 07:19:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.33 1998/09/01 03:23:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static List *
group_clauses_by_ikey_for_joins(RelOptInfo *rel, RelOptInfo *index,
int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list);
-static CInfo *
+static ClauseInfo *
match_clause_to_indexkey(RelOptInfo *rel, RelOptInfo *index, int indexkey,
- int xclass, CInfo *clauseInfo, bool join);
+ int xclass, ClauseInfo *clauseInfo, bool join);
static bool
pred_test(List *predicate_list, List *clauseinfo_list,
List *joininfo_list);
int xclass,
List *clauseinfo_list)
{
- CInfo *clauseinfo = (CInfo *) NULL;
+ ClauseInfo *clauseinfo = (ClauseInfo *) NULL;
List *i = NIL;
foreach(i, clauseinfo_list)
{
- clauseinfo = (CInfo *) lfirst(i);
+ clauseinfo = (ClauseInfo *) lfirst(i);
if (valid_or_clause(clauseinfo))
{
matching_indices = lnext(matching_indices);
}
- return (index_list);
+ return index_list;
}
List *clauseinfo_list)
{
List *curCinfo = NIL;
- CInfo *matched_clause = (CInfo *) NULL;
+ ClauseInfo *matched_clause = (ClauseInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
foreach(curCinfo, clauseinfo_list)
{
- CInfo *temp = (CInfo *) lfirst(curCinfo);
+ ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
/* clausegroup holds all matched clauses ordered by indexkeys */
if (clausegroup != NIL)
- return (lcons(clausegroup, NIL));
+ return lcons(clausegroup, NIL);
return NIL;
}
List *restr_cinfo_list)
{
List *curCinfo = NIL;
- CInfo *matched_clause = (CInfo *) NULL;
+ ClauseInfo *matched_clause = (ClauseInfo *) NULL;
List *clausegroup = NIL;
int curIndxKey;
Oid curClass;
foreach(curCinfo, join_cinfo_list)
{
- CInfo *temp = (CInfo *) lfirst(curCinfo);
+ ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
}
foreach(curCinfo, restr_cinfo_list)
{
- CInfo *temp = (CInfo *) lfirst(curCinfo);
+ ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
freeList(clausegroup);
return NIL;
}
- return (lcons(clausegroup, NIL));
+ return lcons(clausegroup, NIL);
}
return NIL;
}
* NOTE: returns nil if clause is an or_clause.
*
*/
-static CInfo *
+static ClauseInfo *
match_clause_to_indexkey(RelOptInfo *rel,
RelOptInfo *index,
int indexkey,
int xclass,
- CInfo *clauseInfo,
+ ClauseInfo *clauseInfo,
bool join)
{
Expr *clause = clauseInfo->clause;
if (or_clause((Node *) clause) ||
not_clause((Node *) clause) || single_node((Node *) clause))
- return ((CInfo *) NULL);
+ return (ClauseInfo *) NULL;
leftop = get_leftop(clause);
rightop = get_rightop(clause);
}
if (isIndexable)
- return (clauseInfo);
+ return clauseInfo;
- return (NULL);
+ return NULL;
}
/****************************************************************************
static bool
one_pred_test(Expr *predicate, List *clauseinfo_list)
{
- CInfo *clauseinfo;
+ ClauseInfo *clauseinfo;
List *item;
Assert(predicate != NULL);
foreach(item, clauseinfo_list)
{
- clauseinfo = (CInfo *) lfirst(item);
+ clauseinfo = (ClauseInfo *) lfirst(item);
/* if any clause implies the predicate, return true */
if (one_pred_clause_expr_test(predicate, (Node *) clauseinfo->clause))
return true;
*
* Returns a list of these clause groups.
*
- * Added: clauseinfo_list - list of restriction CInfos. It's to
+ * Added: clauseinfo_list - list of restriction ClauseInfos. It's to
* support multi-column indices in joins and for cases
* when a key is in both join & restriction clauses. - vadim 03/18/97
*
indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
List *joininfo_list, List *clauseinfo_list)
{
- JInfo *joininfo = (JInfo *) NULL;
+ JoinInfo *joininfo = (JoinInfo *) NULL;
List *cg_list = NIL;
List *i = NIL;
List *clausegroups = NIL;
foreach(i, joininfo_list)
{
- joininfo = (JInfo *) lfirst(i);
+ joininfo = (JoinInfo *) lfirst(i);
if (joininfo->jinfoclauseinfo == NIL)
continue;
{
List *clauses = lfirst(clausegroups);
- ((CInfo *) lfirst(clauses))->cinfojoinid =
+ ((ClauseInfo *) lfirst(clauses))->cinfojoinid =
joininfo->otherrels;
}
cg_list = nconc(cg_list, clausegroups);
}
- return (cg_list);
+ return cg_list;
}
/****************************************************************************
foreach(l, clausegroup)
{
- CInfo *cinfo = lfirst(l);
+ ClauseInfo *cinfo = lfirst(l);
if (!is_joinable((Node *) cinfo->clause))
restrict_cls = lappend(restrict_cls, cinfo);
pathnode->indexkeys = index->indexkeys;
pathnode->indexqual = clausegroup;
- pathnode->path.joinid = ((CInfo *) lfirst(clausegroup))->cinfojoinid;
+ pathnode->path.joinid = ((ClauseInfo *) lfirst(clausegroup))->cinfojoinid;
pathnode->path.path_cost =
cost_index((Oid) lfirsti(index->relids),
#endif
cg_list = lappend(cg_list, pathnode);
}
- return (cg_list);
+ return cg_list;
}
/*
foreach(i, clausegroup_list)
{
- CInfo *clauseinfo;
+ ClauseInfo *clauseinfo;
List *temp_node = NIL;
bool temp = true;
foreach(j, clausegroup)
{
- clauseinfo = (CInfo *) lfirst(j);
+ clauseinfo = (ClauseInfo *) lfirst(j);
if (!(is_joinable((Node *) clauseinfo->clause) &&
equal_path_merge_ordering(index->ordering,
clauseinfo->mergejoinorder)))
ip_list = nconc(ip_list, temp_node);
}
}
- return (ip_list);
+ return ip_list;
}
static List *
{
if (indexKeys[i] == 0)
- return (false);
+ return false;
if (((Var *) lfirst(arg))->varattno != indexKeys[i])
- return (false);
+ return false;
i++;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.8 1998/08/04 16:44:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.9 1998/09/01 03:23:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
cheapest = (Path *) lfirst(join_path);
}
}
- return (cheapest);
+ return cheapest;
}
/*
ms_list = lappend(ms_list, temp_node);
}
- return (ms_list);
+ return ms_list;
}
/*
temp_node = paths;
jp_list = nconc(jp_list, temp_node);
}
- return (jp_list);
+ return jp_list;
}
/*
}
}
}
- return (mp_list);
+ return mp_list;
}
hjoin_list = lappend(hjoin_list, temp_node);
}
}
- return (hjoin_list);
+ return hjoin_list;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.13 1998/08/10 02:26:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.14 1998/09/01 03:23:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static List *find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list);
static List *find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels);
-static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo);
+static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo);
static List *
new_join_tlist(List *tlist, List *other_relids,
int first_resdomno);
static bool nonoverlap_sets(List *s1, List *s2);
static void
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel,
- JInfo *jinfo);
+ JoinInfo *jinfo);
/*
* find-join-rels--
join_list = nconc(join_list, joins);
}
- return (join_list);
+ return join_list;
}
/*
foreach(i, joininfo_list)
{
- JInfo *joininfo = (JInfo *) lfirst(i);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(i);
RelOptInfo *rel;
if (!joininfo->inactive)
}
}
- return (join_list);
+ return join_list;
}
/*
{
temp_node = lcons(init_join_rel(outer_rel,
inner_rel,
- (JInfo *) NULL),
+ (JoinInfo *) NULL),
NIL);
t_list = nconc(t_list, temp_node);
}
}
- return (t_list);
+ return t_list;
}
/*
* Returns the new join relation node.
*/
static RelOptInfo *
-init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
+init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *joininfo)
{
RelOptInfo *joinrel = makeNode(RelOptInfo);
List *joinrel_joininfo_list = NIL;
set_joinrel_size(joinrel, outer_rel, inner_rel, joininfo);
- return (joinrel);
+ return joinrel;
}
/*
}
}
- return (t_list);
+ return t_list;
}
/*
{
List *current_joininfo_list = NIL;
List *new_otherrels = NIL;
- JInfo *other_joininfo = (JInfo *) NULL;
+ JoinInfo *other_joininfo = (JoinInfo *) NULL;
List *xjoininfo = NIL;
foreach(xjoininfo, joininfo_list)
{
List *or;
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
new_otherrels = joininfo->otherrels;
foreach(or, new_otherrels)
}
else
{
- other_joininfo = makeNode(JInfo);
+ other_joininfo = makeNode(JoinInfo);
other_joininfo->otherrels =
joininfo->otherrels;
}
}
- return (current_joininfo_list);
+ return current_joininfo_list;
}
/*
foreach(xjoininfo, joinrel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
List *other_rels = joininfo->otherrels;
List *clause_info = joininfo->jinfoclauseinfo;
bool mergejoinable = joininfo->mergejoinable;
RelOptInfo *rel = get_join_rel(root, relid);
List *super_rels = rel->superrels;
List *xsuper_rel = NIL;
- JInfo *new_joininfo = makeNode(JInfo);
+ JoinInfo *new_joininfo = makeNode(JoinInfo);
new_joininfo->otherrels = joinrel->relids;
new_joininfo->jinfoclauseinfo = clause_info;
if (nonoverlap_rels(super_rel, joinrel))
{
List *new_relids = super_rel->relids;
- JInfo *other_joininfo =
+ JoinInfo *other_joininfo =
joininfo_member(new_relids,
joinrel->joininfo);
}
else
{
- JInfo *new_joininfo = makeNode(JInfo);
+ JoinInfo *new_joininfo = makeNode(JoinInfo);
new_joininfo->otherrels = new_relids;
new_joininfo->jinfoclauseinfo = clause_info;
foreach(xjoininfo, rel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
if (joininfo->otherrels != NIL)
{
}
}
- return (t_list);
+ return t_list;
}
/*
static bool
nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
{
- return (nonoverlap_sets(rel1->relids, rel2->relids));
+ return nonoverlap_sets(rel1->relids, rel2->relids);
}
static bool
int e = lfirsti(x);
if (intMember(e, s2))
- return (false);
+ return false;
}
- return (true);
+ return true;
}
static void
-set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *jinfo)
+set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo *jinfo)
{
int ntuples;
float selec;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.7 1998/09/01 03:23:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
joinkeys = LispRemove(xjoinkey, joinkeys);
}
else
- return (NIL);
+ return NIL;
}
if (matched_joinkeys == NULL ||
return NIL;
*matchedJoinClausesPtr = nreverse(matched_joinclauses);
- return (nreverse(matched_joinkeys));
+ return nreverse(matched_joinkeys);
}
/*
jk = (JoinKey *) lfirst(x);
if (var_equal(path_subkey,
extract_subkey(jk, which_subkey)))
- return (pos);
+ return pos;
pos++;
}
}
- return (-1); /* no index found */
+ return -1; /* no index found */
}
/*
}
}
if (found == false)
- return (false);
+ return false;
}
- return (found);
+ return found;
}
pathkeys =
lappend(pathkeys, lcons(key, NIL));
}
- return (pathkeys);
+ return pathkeys;
}
if (x != NIL)
t_list = lappend(t_list, x);
}
- return (t_list);
+ return t_list;
}
/*
t_list = nconc(t_list, newly_considered_subkeys);
}
- return (t_list);
+ return t_list;
}
/*
t_list = nconc(t_list, temp);
}
}
- return (t_list);
+ return t_list;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.7 1998/08/04 16:44:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.8 1998/09/01 03:23:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
foreach(xclauseinfo, clauseinfo_list)
{
- CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
+ ClauseInfo *clauseinfo = (ClauseInfo *) lfirst(xclauseinfo);
MergeOrder *merge_ordering = clauseinfo->mergejoinorder;
if (merge_ordering)
((JoinMethod *) xmergeinfo)->jmkeys);
}
}
- return (mergeinfo_list);
+ return mergeinfo_list;
}
equal_path_merge_ordering(ordering->ord.sortop, xmergeorder)))
{
- return (mergeinfo);
+ return mergeinfo;
}
}
- return ((MInfo *) NIL);
+ return (MInfo *) NIL;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.9 1998/08/31 07:19:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.10 1998/09/01 03:23:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
foreach(clist, clauses)
{
- CInfo *clausenode = (CInfo *) (lfirst(clist));
+ ClauseInfo *clausenode = (ClauseInfo *) (lfirst(clist));
/*
* Check to see if this clause is an 'or' clause, and, if so,
}
}
- return (t_list);
+ return t_list;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.11 1998/06/15 19:28:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.12 1998/09/01 03:23:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static Stream xfunc_add_clauses(Stream current);
static void xfunc_setup_group(Stream node, Stream bottom);
static Stream
-xfunc_streaminsert(CInfo clauseinfo, Stream current,
+xfunc_streaminsert(ClauseInfo clauseinfo, Stream current,
int clausetype);
static int xfunc_num_relids(Stream node);
static StreamPtr xfunc_get_downjoin(Stream node);
if (progress)
changed = true;
} while (progress);
- return (changed);
+ return changed;
}
set_downstream(laststream, (StreamPtr) newstream);
set_downstream(newstream, (StreamPtr) NULL);
set_pathptr(newstream, (pathPtr) pathnode);
- set_cinfo(newstream, (CInfo) NULL);
+ set_cinfo(newstream, (ClauseInfo) NULL);
set_clausetype(newstream, XFUNC_UNKNOWN);
/* base case: we're at a leaf, call xfunc_series_llel */
if (xfunc_llel_chains(stream, temp))
progress = true;
}
- return (progress);
+ return progress;
}
/*
/* free up origstream */
xfunc_free_stream(origstream);
- return (progress);
+ return progress;
}
/*
tmpstream = (Stream) get_upstream(tmpstream))
/* no body in for loop */ ;
- return (tmpstream);
+ return tmpstream;
}
/*
static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
{
- CInfo clauseinfo = get_cinfo(pullme);
+ ClauseInfo clauseinfo = get_cinfo(pullme);
bool progress = false;
Stream upjoin,
orignode,
}
if (!progress)
elog(DEBUG, "didn't succeed in pulling up in xfunc_prdmig_pullup");
- return (progress);
+ return progress;
}
/*
foreach(temp, get_locclauseinfo((Path) get_pathptr(current)))
{
topnode =
- xfunc_streaminsert((CInfo) lfirst(temp), topnode,
+ xfunc_streaminsert((ClauseInfo) lfirst(temp), topnode,
XFUNC_LOCPRD);
}
primjoin = xfunc_primary_join((JoinPath) get_pathptr(current));
foreach(temp, get_pathclauseinfo((JoinPath) get_pathptr(current)))
{
- if (!equal(get_clause((CInfo) lfirst(temp)), primjoin))
+ if (!equal(get_clause((ClauseInfo) lfirst(temp)), primjoin))
topnode =
- xfunc_streaminsert((CInfo) lfirst(temp), topnode,
+ xfunc_streaminsert((ClauseInfo) lfirst(temp), topnode,
XFUNC_JOINPRD);
}
}
- return (topnode);
+ return topnode;
}
** Return new node.
*/
static Stream
-xfunc_streaminsert(CInfo clauseinfo,
+xfunc_streaminsert(ClauseInfo clauseinfo,
Stream current,
int clausetype) /* XFUNC_LOCPRD or XFUNC_JOINPRD */
{
set_pathptr(newstream, get_pathptr(current));
set_cinfo(newstream, clauseinfo);
set_clausetype(newstream, clausetype);
- return (newstream);
+ return newstream;
}
/*
xfunc_num_relids(Stream node)
{
if (!node || !IsA(get_pathptr(node), JoinPath))
- return (0);
+ return 0;
else
return (length
(get_relids(get_parent((JoinPath) get_pathptr(node)))));
temp = (Stream) get_downstream(temp))
/* empty body in for loop */ ;
- return ((StreamPtr) temp);
+ return (StreamPtr) temp;
}
/*
temp = (Stream) get_upstream(temp))
/* empty body in for loop */ ;
- return ((StreamPtr) temp);
+ return (StreamPtr) temp;
}
/*
tmp = (Stream) get_downstream(tmp))
num++;
if (num <= 1)
- return (root);
+ return root;
/* copy elements of the list into an array */
nodearray = (Stream *) palloc(num * sizeof(Stream));
set_upstream(bottom, (StreamPtr) nodearray[0]);
Assert(xfunc_check_stream(output));
- return (output);
+ return output;
}
/*
rank2 = get_grouprank(stream2);
if (rank1 > rank2)
- return (1);
+ return 1;
else if (rank1 < rank2)
- return (-1);
+ return -1;
else
{
if (is_clause(stream1) && is_clause(stream2))
- return (0); /* doesn't matter what order if both are
+ return 0; /* doesn't matter what order if both are
* restrictions */
else if (!is_clause(stream1) && !is_clause(stream2))
{
if (xfunc_num_relids(stream1) < xfunc_num_relids(stream2))
- return (-1);
+ return -1;
else
- return (1);
+ return 1;
}
else if (is_clause(stream1) && !is_clause(stream2))
{
if (xfunc_num_relids(stream1) == xfunc_num_relids(stream2))
/* stream1 is a restriction over stream2 */
- return (1);
+ return 1;
else
- return (-1);
+ return -1;
}
else if (!is_clause(stream1) && is_clause(stream2))
{
/* stream2 is a restriction over stream1: never push down */
- return (-1);
+ return -1;
}
}
}
if ((Stream) get_upstream((Stream) get_downstream(temp)) != temp)
{
elog(ERROR, "bad pointers in stream");
- return (false);
+ return false;
}
if (!is_clause(temp))
{
if ((tmp = xfunc_num_relids(temp)) >= numrelids)
{
elog(ERROR, "Joins got reordered!");
- return (false);
+ return false;
}
numrelids = tmp;
}
}
- return (true);
+ return true;
}
/*
for (temp = stream; temp; temp = (Stream) get_downstream(temp))
if (temp == node)
- return (1);
- return (0);
+ return 1;
+ return 0;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.15 1998/07/18 04:22:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.16 1998/09/01 03:23:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
else
result = nconc(result, lcons(other_rel, NIL));
}
- return (result);
+ return result;
}
/*
else
rel->unorderedpath = (Path *) unorderedpath;
- return (cheapest);
+ return cheapest;
}
/*
rel_list2 = prune_joinrel(rel, rel_list2);
}
- return (append(rel_list1, rel_list2));
+ return append(rel_list1, rel_list2);
}
/*
{
foreach(xjoininfo, joininfo_list)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo);
if (!joininfo->inactive)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.20 1998/08/24 01:37:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.21 1998/09/01 03:23:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
xfunc_trypullup(RelOptInfo rel)
{
LispValue y; /* list ptr */
- CInfo maxcinfo; /* The CInfo to pull up, as calculated by
+ ClauseInfo maxcinfo; /* The ClauseInfo to pull up, as calculated by
* xfunc_shouldpull() */
JoinPath curpath; /* current path in list */
int progress; /* has progress been made this time
Path childpath,
JoinPath parentpath,
int whichchild,
- CInfo *maxcinfopt) /* Out: pointer to clause to
+ ClauseInfo *maxcinfopt) /* Out: pointer to clause to
* pullup */
{
LispValue clauselist,
tmplist; /* lists of clauses */
- CInfo maxcinfo; /* clause to pullup */
+ ClauseInfo maxcinfo; /* clause to pullup */
LispValue primjoinclause /* primary join clause */
= xfunc_primary_join(parentpath);
Cost tmprank,
{
/* find local predicate with maximum rank */
for (tmplist = clauselist,
- maxcinfo = (CInfo) lfirst(tmplist),
+ maxcinfo = (ClauseInfo) lfirst(tmplist),
maxrank = xfunc_rank(get_clause(maxcinfo));
tmplist != LispNil;
tmplist = lnext(tmplist))
{
- if ((tmprank = xfunc_rank(get_clause((CInfo) lfirst(tmplist))))
+ if ((tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
> maxrank)
{
- maxcinfo = (CInfo) lfirst(tmplist);
+ maxcinfo = (ClauseInfo) lfirst(tmplist);
maxrank = tmprank;
}
}
{
if (tmplist != LispNil &&
- (tmprank = xfunc_rank(get_clause((CInfo) lfirst(tmplist))))
+ (tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
> maxrank)
{
- maxcinfo = (CInfo) lfirst(tmplist);
+ maxcinfo = (ClauseInfo) lfirst(tmplist);
maxrank = tmprank;
retval = XFUNC_JOINPRD;
}
}
if (maxrank == (-1 * MAXFLOAT)) /* no expensive clauses */
- return (0);
+ return 0;
/*
* * Pullup over join if clause is higher rank than join, or if * join
{
*maxcinfopt = maxcinfo;
- return (retval);
+ return retval;
}
else if (maxrank != -(MAXFLOAT))
/* and fall through */
}
}
- return (0);
+ return 0;
}
** in the query; it's merely a parent for the new childpath.
** We also have to fix up the path costs of the child and parent.
**
- ** Now returns a pointer to the new pulled-up CInfo. -- JMH, 11/18/92
+ ** Now returns a pointer to the new pulled-up ClauseInfo. -- JMH, 11/18/92
*/
-CInfo
+ClauseInfo
xfunc_pullup(Query *queryInfo,
Path childpath,
JoinPath parentpath,
- CInfo cinfo, /* clause to pull up */
+ ClauseInfo cinfo, /* clause to pull up */
int whichchild, /* whether child is INNER or OUTER of join */
int clausetype) /* whether clause to pull is join or local */
{
RelOptInfo newrel;
Cost pulled_selec;
Cost cost;
- CInfo newinfo;
+ ClauseInfo newinfo;
/* remove clause from childpath */
newkid = (Path) copyObject((Node) childpath);
* * We copy the cinfo, since it may appear in other plans, and we're
* going * to munge it. -- JMH, 7/22/92
*/
- newinfo = (CInfo) copyObject((Node) cinfo);
+ newinfo = (ClauseInfo) copyObject((Node) cinfo);
/*
* * Fix all vars in the clause * to point to the right varno and
cost = xfunc_total_path_cost(parentpath);
set_path_cost(parentpath, cost);
- return (newinfo);
+ return newinfo;
}
/*
if (cost == 0)
if (selec > 1)
- return (MAXFLOAT);
+ return MAXFLOAT;
else
- return (-(MAXFLOAT));
- return ((selec - 1) / cost);
+ return -(MAXFLOAT);
+ return (selec - 1) / cost;
}
/*
cost /= card;
}
- return (cost);
+ return cost;
}
/*
if (card)
cost /= card;
- return (cost);
+ return cost;
}
/*
/* First handle the base case */
if (IsA(clause, Const) ||IsA(clause, Var) ||IsA(clause, Param))
- return (0);
+ return 0;
/* now other stuff */
else if (IsA(clause, Iter))
/* Too low. Should multiply by the expected number of iterations. */
- return (xfunc_local_expense(get_iterexpr((Iter) clause)));
+ return xfunc_local_expense(get_iterexpr((Iter) clause));
else if (IsA(clause, ArrayRef))
- return (xfunc_local_expense(get_refexpr((ArrayRef) clause)));
+ return xfunc_local_expense(get_refexpr((ArrayRef) clause));
else if (fast_is_clause(clause))
return (xfunc_func_expense((LispValue) get_op(clause),
(LispValue) get_opargs(clause)));
return (xfunc_func_expense((LispValue) get_function(clause),
(LispValue) get_funcargs(clause)));
else if (fast_not_clause(clause))
- return (xfunc_local_expense(lsecond(clause)));
+ return xfunc_local_expense(lsecond(clause));
else if (fast_or_clause(clause) || fast_and_clause(clause))
{
/* find cost of evaluating each disjunct */
for (tmpclause = lnext(clause); tmpclause != LispNil;
tmpclause = lnext(tmpclause))
cost += xfunc_local_expense(lfirst(tmpclause));
- return (cost);
+ return cost;
}
else
{
elog(ERROR, "Clause node of undetermined type");
- return (-1);
+ return -1;
}
}
*/
foreach(tmpplan, planlist)
cost += get_cost((Plan) lfirst(tmpplan));
- return (cost);
+ return cost;
}
else
{ /* it's a C function */
{
Relation rd; /* Relation Descriptor */
HeapTuple tupl; /* structure to hold a cached tuple */
- TypeTupleForm type; /* structure to hold a type tuple */
+ Form_pg_type type; /* structure to hold a type tuple */
int retval = 0;
if (IsA(clause, Const))
if (!HeapTupleIsValid(tupl))
elog(ERROR, "Cache lookup failed for type %d",
get_vartype((Var) clause));
- type = (TypeTupleForm) GETSTRUCT(tupl);
+ type = (Form_pg_type) GETSTRUCT(tupl);
if (get_varattno((Var) clause) == 0)
{
/* clause is a tuple. Get its width */
elog(ERROR, "Cache lookup failed for procedure %d",
get_opno((Oper) get_op(clause)));
return (xfunc_func_width
- ((RegProcedure) (((OperatorTupleForm) (GETSTRUCT(tupl)))->oprcode),
+ ((RegProcedure) (((Form_pg_operator) (GETSTRUCT(tupl)))->oprcode),
(LispValue) get_opargs(clause)));
}
else if (fast_is_funcclause(clause))
else
{
elog(ERROR, "Clause node of undetermined type");
- return (-1);
+ return -1;
}
exit:
if (retval == -1)
retval = VARLEN_DEFAULT;
- return (retval);
+ return retval;
}
/*
referenced = xfunc_find_references(clause);
unreferenced = set_difference(allrelids, referenced);
- return (xfunc_card_product(unreferenced));
+ return xfunc_card_product(unreferenced);
}
/*
/* factor in the selectivity of all zero-cost clauses */
foreach(cinfonode, get_clauseinfo(currel))
{
- if (!xfunc_expense(queryInfo, get_clause((CInfo) lfirst(cinfonode))))
+ if (!xfunc_expense(queryInfo, get_clause((ClauseInfo) lfirst(cinfonode))))
tuples *=
compute_clause_selec(queryInfo,
- get_clause((CInfo) lfirst(cinfonode)),
+ get_clause((ClauseInfo) lfirst(cinfonode)),
LispNil);
}
}
if (retval == 0)
retval = 1; /* saves caller from dividing by zero */
- return (retval);
+ return retval;
}
/* Base cases */
if (IsA(clause, Var))
- return (lispCons(lfirst(get_varid((Var) clause)), LispNil));
+ return lispCons(lfirst(get_varid((Var) clause)), LispNil);
else if (IsA(clause, Const) ||IsA(clause, Param))
- return ((List) LispNil);
+ return (List) LispNil;
/* recursion */
else if (IsA(clause, Iter))
* Too low. Should multiply by the expected number of iterations.
* maybe
*/
- return (xfunc_find_references(get_iterexpr((Iter) clause)));
+ return xfunc_find_references(get_iterexpr((Iter) clause));
else if (IsA(clause, ArrayRef))
- return (xfunc_find_references(get_refexpr((ArrayRef) clause)));
+ return xfunc_find_references(get_refexpr((ArrayRef) clause));
else if (fast_is_clause(clause))
{
/* string together result of all operands of Oper */
for (tmpclause = (LispValue) get_opargs(clause); tmpclause != LispNil;
tmpclause = lnext(tmpclause))
retval = nconc(retval, xfunc_find_references(lfirst(tmpclause)));
- return (retval);
+ return retval;
}
else if (fast_is_funcclause(clause))
{
tmpclause != LispNil;
tmpclause = lnext(tmpclause))
retval = nconc(retval, xfunc_find_references(lfirst(tmpclause)));
- return (retval);
+ return retval;
}
else if (fast_not_clause(clause))
- return (xfunc_find_references(lsecond(clause)));
+ return xfunc_find_references(lsecond(clause));
else if (fast_or_clause(clause) || fast_and_clause(clause))
{
/* string together result of all operands of OR */
for (tmpclause = lnext(clause); tmpclause != LispNil;
tmpclause = lnext(tmpclause))
retval = nconc(retval, xfunc_find_references(lfirst(tmpclause)));
- return (retval);
+ return retval;
}
else
{
elog(ERROR, "Clause node of undetermined type");
- return ((List) LispNil);
+ return (List) LispNil;
}
}
xfunc_primary_join(JoinPath pathnode)
{
LispValue joinclauselist = get_pathclauseinfo(pathnode);
- CInfo mincinfo;
+ ClauseInfo mincinfo;
LispValue tmplist;
LispValue minclause = LispNil;
Cost minrank,
minrank = tmprank;
minclause = lfirst(tmplist);
}
- return (minclause);
+ return minclause;
}
else if (IsA(pathnode, HashPath))
{
minrank = tmprank;
minclause = lfirst(tmplist);
}
- return (minclause);
+ return minclause;
}
/* if we drop through, it's nested loop join */
if (joinclauselist == LispNil)
- return (LispNil);
+ return LispNil;
- for (tmplist = joinclauselist, mincinfo = (CInfo) lfirst(joinclauselist),
- minrank = xfunc_rank(get_clause((CInfo) lfirst(tmplist)));
+ for (tmplist = joinclauselist, mincinfo = (ClauseInfo) lfirst(joinclauselist),
+ minrank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist)));
tmplist != LispNil;
tmplist = lnext(tmplist))
- if ((tmprank = xfunc_rank(get_clause((CInfo) lfirst(tmplist))))
+ if ((tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))))
< minrank)
{
minrank = tmprank;
- mincinfo = (CInfo) lfirst(tmplist);
+ mincinfo = (ClauseInfo) lfirst(tmplist);
}
- return ((LispValue) get_clause(mincinfo));
+ return (LispValue) get_clause(mincinfo);
}
/*
tmplist != LispNil;
tmplist = lnext(tmplist))
{
- cost += (Cost) (xfunc_local_expense(get_clause((CInfo) lfirst(tmplist)))
+ cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist)))
* (Cost) get_tuples(get_parent(pathnode)) * selec);
selec *= compute_clause_selec(queryInfo,
- get_clause((CInfo) lfirst(tmplist)),
+ get_clause((ClauseInfo) lfirst(tmplist)),
LispNil);
}
tmplist != LispNil;
tmplist = lnext(tmplist))
{
- cost += (Cost) (xfunc_local_expense(get_clause((CInfo) lfirst(tmplist)))
+ cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist)))
* (Cost) get_tuples(get_parent(pathnode)) * selec);
selec *= compute_clause_selec(queryInfo,
- get_clause((CInfo) lfirst(tmplist)),
+ get_clause((ClauseInfo) lfirst(tmplist)),
LispNil);
}
}
}
}
Assert(cost >= 0);
- return (cost);
+ return cost;
}
/*
get_width(get_parent((Path) get_innerjoinpath
(mrgnode))));
Assert(cost >= 0);
- return (cost);
+ return cost;
}
else if (IsA(pathnode, HashPath))
{
get_width(get_parent((Path) get_innerjoinpath
(hashnode))));
Assert(cost >= 0);
- return (cost);
+ return cost;
}
else
/* Nested Loop Join */
(pathnode))),
IsA(get_innerjoinpath(pathnode), IndexPath));
Assert(cost >= 0);
- return (cost);
+ return cost;
}
}
if (IsA(joinnode, HashPath))
{
if (whichchild == INNER)
- return ((1 + _CPU_PAGE_WEIGHT_) * outers_per_page / NBuffers);
+ return (1 + _CPU_PAGE_WEIGHT_) * outers_per_page / NBuffers;
else
return (((1 + _CPU_PAGE_WEIGHT_) * outers_per_page / NBuffers)
+ _CPU_PAGE_WEIGHT_
/* nestloop */
{
Assert(IsA(joinnode, JoinPath));
- return (_CPU_PAGE_WEIGHT_);
+ return _CPU_PAGE_WEIGHT_;
}
}
/*
- ** Comparison function for lisp_qsort() on a list of CInfo's.
- ** arg1 and arg2 should really be of type (CInfo *).
+ ** Comparison function for lisp_qsort() on a list of ClauseInfo's.
+ ** arg1 and arg2 should really be of type (ClauseInfo *).
*/
int
xfunc_cinfo_compare(void *arg1, void *arg2)
{
- CInfo info1 = *(CInfo *) arg1;
- CInfo info2 = *(CInfo *) arg2;
+ ClauseInfo info1 = *(ClauseInfo *) arg1;
+ ClauseInfo info2 = *(ClauseInfo *) arg2;
LispValue clause1 = (LispValue) get_clause(info1),
clause2 = (LispValue) get_clause(info2);
- return (xfunc_clause_compare((void *) &clause1, (void *) &clause2));
+ return xfunc_clause_compare((void *) &clause1, (void *) &clause2);
}
/*
rank2 = xfunc_rank(clause2);
if (rank1 < rank2)
- return (-1);
+ return -1;
else if (rank1 == rank2)
- return (0);
+ return 0;
else
- return (1);
+ return 1;
}
/*
rank2 = cost2 / selec2;
if (rank1 < rank2)
- return (-1);
+ return -1;
else if (rank1 == rank2)
- return (0);
+ return 0;
else
- return (1);
+ return 1;
}
/* ------------------------ UTILITY FUNCTIONS ------------------------------- */
Relation rd; /* Relation Descriptor */
HeapTuple tupl; /* structure to hold a cached tuple */
Form_pg_proc proc; /* structure to hold the pg_proc tuple */
- TypeTupleForm type; /* structure to hold the pg_type tuple */
+ Form_pg_type type; /* structure to hold the pg_type tuple */
LispValue tmpclause;
int retval;
0, 0, 0);
if (!HeapTupleIsValid(tupl))
elog(ERROR, "Cache lookup failed for type %d", proc->prorettype);
- type = (TypeTupleForm) GETSTRUCT(tupl);
+ type = (Form_pg_type) GETSTRUCT(tupl);
/* if the type length is known, return that */
if (type->typlen != -1)
{
}
}
exit:
- return (retval);
+ return retval;
}
/*
{
int i;
int retval = 0;
- TupleDesc tdesc = RelationGetTupleDescriptor(rd);
+ TupleDesc tdesc = RelationGetDescr(rd);
for (i = 0; i < tdesc->natts; i++)
{
retval += VARLEN_DEFAULT;
}
- return (retval);
+ return retval;
}
/*
int num = length(get_pathclauseinfo(path));
if (IsA(path, MergePath))
- return (num + length(get_path_mergeclauses((MergePath) path)));
+ return num + length(get_path_mergeclauses((MergePath) path));
else if (IsA(path, HashPath))
- return (num + length(get_path_hashclauses((HashPath) path)));
+ return num + length(get_path_hashclauses((HashPath) path));
else
- return (num);
+ return num;
}
/*
if (!sanity)
elog(ERROR, "xfunc_LispRemove: didn't find a match!");
- return (result);
+ return result;
}
#define Node_Copy(a, b, c, d) \
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.30 1998/08/04 16:44:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.31 1998/09/01 03:23:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
#endif
- return (plan_node);
+ return plan_node;
}
/*
(get_locclauseinfo(best_path)))));
#endif
- return (retval);
+ return retval;
}
/*****************************************************************************
scan_node->plan.cost = best_path->path_cost;
- return (scan_node);
+ return scan_node;
}
/*
IndexScan *scan_node = (IndexScan *) NULL;
bool lossy = FALSE;
HeapTuple indexTuple;
- IndexTupleForm index;
+ Form_pg_index index;
/*
* If an 'or' clause is to be used with this index, the indxqual field
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "create_plan: index %d not found",
lfirsti(ixid));
- index = (IndexTupleForm) GETSTRUCT(indexTuple);
+ index = (Form_pg_index) GETSTRUCT(indexTuple);
if (index->indislossy)
lossy = TRUE;
}
fixed_indxqual,
best_path->path.path_cost);
- return (scan_node);
+ return scan_node;
}
/*****************************************************************************
join_node->join.cost = best_path->path.path_cost;
- return (join_node);
+ return join_node;
}
static MergeJoin *
join_node->join.cost = best_path->jpath.path.path_cost;
- return (join_node);
+ return join_node;
}
/*
(Plan *) hash_node);
join_node->join.cost = best_path->jpath.path.path_cost;
- return (join_node);
+ return join_node;
}
}
newclause = copyObject((Node *) clause);
((Var *) newclause)->varattno = pos + 1;
- return (newclause);
+ return newclause;
}
else
- return (clause);
+ return clause;
}
else if (IsA(clause, Const))
- return (clause);
+ return clause;
else if (IsA(clause, Param))
{
/* Function parameter used as index scan arg. DZ - 27-8-1996 */
- return (clause);
+ return clause;
}
else if (is_opclause(clause) &&
is_funcclause((Node *) get_leftop((Expr *) clause)) &&
make_clause(expr->opType, expr->oper, new_subclauses);
}
else
- return (clause);
+ return clause;
}
else
{
if (new_subclauses)
return (Node *) new_subclauses;
else
- return (clause);
+ return clause;
}
}
else
t_list = lappend(t_list, clause);
}
- return (t_list);
+ return t_list;
}
/*
}
keyno += 1;
}
- return (tlist);
+ return tlist;
}
/*****************************************************************************
elog(ERROR, "make_temp: unknown temp type %d", temptype);
}
- return (retval);
+ return retval;
}
node->scanrelid = scanrelid;
node->scanstate = (CommonScanState *) NULL;
- return (node);
+ return node;
}
static IndexScan *
node->indxqual = indxqual;
node->scan.scanstate = (CommonScanState *) NULL;
- return (node);
+ return node;
}
plan->righttree = righttree;
node->nlstate = (NestLoopState *) NULL;
- return (node);
+ return node;
}
static HashJoin *
node->hashjointablesize = 0;
node->hashdone = false;
- return (node);
+ return node;
}
static Hash *
node->hashtablekey = 0;
node->hashtablesize = 0;
- return (node);
+ return node;
}
static MergeJoin *
node->mergerightorder = rightorder;
node->mergeleftorder = leftorder;
- return (node);
+ return node;
}
Sort *
node->tempid = tempid;
node->keycount = keycount;
- return (node);
+ return node;
}
static Material *
node->tempid = tempid;
node->keycount = keycount;
- return (node);
+ return node;
}
Agg *
node->plan.righttree = (Plan *) NULL;
node->aggs = NIL;
- return (node);
+ return node;
}
Group *
node->numCols = ngrp;
node->grpColIdx = grpColIdx;
- return (node);
+ return node;
}
/*
node->uniqueAttr = NULL;
else
node->uniqueAttr = pstrdup(uniqueAttr);
- return (node);
+ return node;
}
#ifdef NOT_USED
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.18 1998/08/10 02:26:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.19 1998/09/01 03:23:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern int Quiet;
static void add_clause_to_rels(Query *root, List *clause);
-static void add_join_info_to_rels(Query *root, CInfo *clauseinfo,
+static void add_join_info_to_rels(Query *root, ClauseInfo *clauseinfo,
List *join_relids);
static void add_vars_to_targetlist(Query *root, List *vars, List *join_relids);
{
List *relids;
List *vars;
- CInfo *clauseinfo = makeNode(CInfo);
+ ClauseInfo *clauseinfo = makeNode(ClauseInfo);
/*
* Retrieve all relids and vars contained within the clause.
*
*/
static void
-add_join_info_to_rels(Query *root, CInfo *clauseinfo, List *join_relids)
+add_join_info_to_rels(Query *root, ClauseInfo *clauseinfo, List *join_relids)
{
List *join_relid;
foreach(join_relid, join_relids)
{
- JInfo *joininfo;
+ JoinInfo *joininfo;
List *other_rels = NIL;
List *rel;
*y,
*z;
RelOptInfo *rel;
- JInfo *joininfo;
- CInfo *clauseinfo;
+ JoinInfo *joininfo;
+ ClauseInfo *clauseinfo;
Expr *clause;
foreach(x, rel_list)
rel = (RelOptInfo *) lfirst(x);
foreach(y, rel->joininfo)
{
- joininfo = (JInfo *) lfirst(y);
+ joininfo = (JoinInfo *) lfirst(y);
foreach(z, joininfo->jinfoclauseinfo)
{
- clauseinfo = (CInfo *) lfirst(z);
+ clauseinfo = (ClauseInfo *) lfirst(z);
clause = clauseinfo->clause;
if (is_joinable((Node *) clause))
{
morder->right_operator = rightOp;
morder->left_type = (get_leftop(clause))->vartype;
morder->right_type = (get_rightop(clause))->vartype;
- return (morder);
+ return morder;
}
else
- return (NULL);
+ return NULL;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.26 1998/08/10 04:49:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.27 1998/09/01 03:23:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
(Plan *) NULL));
}
else
- return ((Plan *) NULL);
+ return (Plan *) NULL;
}
/*
(Plan *) scan));
}
else
- return ((Plan *) scan);
+ return (Plan *) scan;
}
break;
default:
- return ((Plan *) NULL);
+ return (Plan *) NULL;
}
}
* it.
*/
if (final_rel)
- return (create_plan((Path *) final_rel->cheapestpath));
+ return create_plan((Path *) final_rel->cheapestpath);
else
{
elog(NOTICE, "final relation is nil");
- return (create_plan((Path *) NULL));
+ return create_plan((Path *) NULL);
}
}
node->resconstantqual = resconstantqual;
node->resstate = NULL;
- return (node);
+ return node;
}
/*****************************************************************************
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.30 1998/08/29 04:09:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.31 1998/09/01 03:23:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
result_plan->nParamExec = length(PlannerParamVar);
- return (result_plan);
+ return result_plan;
}
/*
{
Plan *sortplan = make_sortplan(tlist, parse->sortClause, result_plan);
- return ((Plan *) make_unique(tlist, sortplan, parse->uniqueFlag));
+ return (Plan *) make_unique(tlist, sortplan, parse->uniqueFlag);
}
else
{
if (parse->sortClause)
- return (make_sortplan(tlist, parse->sortClause, result_plan));
+ return make_sortplan(tlist, parse->sortClause, result_plan);
else
- return ((Plan *) result_plan);
+ return (Plan *) result_plan;
}
}
sortplan->cost = plannode->cost;
- return (sortplan);
+ return sortplan;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.24 1998/07/20 19:53:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.25 1998/09/01 03:23:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
}
- return (t_list);
+ return t_list;
}
/*
temp = (List *) replace_joinvar_refs((Var *) clause,
outer_tlist, inner_tlist);
if (temp)
- return (temp);
+ return temp;
else if (clause != NULL)
- return ((List *) clause);
+ return (List *) clause;
else
- return (NIL);
+ return NIL;
}
else if (single_node((Node *) clause))
- return ((List *) clause);
+ return (List *) clause;
else if (and_clause((Node *) clause))
{
List *andclause =
outer_tlist,
inner_tlist);
- return ((List *) make_andclause(andclause));
+ return (List *) make_andclause(andclause);
}
else if (or_clause((Node *) clause))
{
outer_tlist,
inner_tlist);
- return ((List *) make_orclause(orclause));
+ return (List *) make_orclause(orclause);
}
else if (IsA(clause, ArrayRef))
{
* structure 'clause'.
*/
- return ((List *) clause);
+ return (List *) clause;
}
else if (is_funcclause((Node *) clause))
{
outer_tlist,
inner_tlist);
- return ((List *) make_notclause((Expr *) notclause));
+ return (List *) make_notclause((Expr *) notclause);
}
else if (is_opclause((Node *) clause))
{
replace_subclause_joinvar_refs(((SubPlan *) ((Expr *) clause)->oper)->sublink->oper,
outer_tlist,
inner_tlist);
- return ((List *) clause);
+ return (List *) clause;
}
/* shouldn't reach here */
elog(ERROR, "replace_clause_joinvar_refs: unsupported clause %d",
inner_tlist);
t_list = lappend(t_list, temp);
}
- return (t_list);
+ return t_list;
}
static Var *
t_list = lappend(t_list, temp);
}
- return (t_list);
+ return t_list;
}
/*---------------------------------------------------------
lfirst(last) = makeVar(var->varno, var->varattno, var->vartype,
var->vartypmod, varlevel, var->varnoold, var->varoattno);
- return (i);
+ return i;
}
static Param *
retval->paramid = (AttrNumber) i;
retval->paramtype = var->vartype;
- return (retval);
+ return retval;
}
static Node *
result = (Node *) expr;
}
- return (result);
+ return result;
}
set_unioni(List *l1, List *l2)
{
if (l1 == NULL)
- return (l2);
+ return l2;
if (l2 == NULL)
- return (l1);
+ return l1;
- return (nconc(l1, set_differencei(l2, l1)));
+ return nconc(l1, set_differencei(l2, l1));
}
static List *
List *result = NULL;
if (expr == NULL)
- return (NULL);
+ return NULL;
if (IsA(expr, Param))
{
if (((Param *) expr)->paramkind == PARAM_EXEC)
- return (lconsi(((Param *) expr)->paramid, (List *) NULL));
+ return lconsi(((Param *) expr)->paramid, (List *) NULL);
}
else if (single_node(expr))
- return (NULL);
+ return NULL;
else if (IsA(expr, List))
{
List *le;
_finalize_primnode(lfirst(le), subplan));
}
else if (IsA(expr, Iter))
- return (_finalize_primnode(((Iter *) expr)->iterexpr, subplan));
+ return _finalize_primnode(((Iter *) expr)->iterexpr, subplan);
else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
not_clause(expr) || is_funcclause(expr))
- return (_finalize_primnode(((Expr *) expr)->args, subplan));
+ return _finalize_primnode(((Expr *) expr)->args, subplan);
else if (IsA(expr, Aggreg))
- return (_finalize_primnode(((Aggreg *) expr)->target, subplan));
+ return _finalize_primnode(((Aggreg *) expr)->target, subplan);
else if (IsA(expr, ArrayRef))
{
result = _finalize_primnode(((ArrayRef *) expr)->refupperindexpr, subplan);
_finalize_primnode(((ArrayRef *) expr)->refassgnexpr, subplan));
}
else if (IsA(expr, TargetEntry))
- return (_finalize_primnode(((TargetEntry *) expr)->expr, subplan));
+ return _finalize_primnode(((TargetEntry *) expr)->expr, subplan);
else if (is_subplan(expr))
{
List *lst;
elog(ERROR, "_finalize_primnode: can't handle node %d",
nodeTag(expr));
- return (result);
+ return result;
}
Node *
{
if (expr == NULL)
- return (NULL);
+ return NULL;
if (IsA(expr, List))
{
List *le;
SS_replace_correlation_vars(((Iter *) expr)->iterexpr);
}
else if (single_node(expr))
- return (expr);
+ return expr;
else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
not_clause(expr) || is_funcclause(expr))
((Expr *) expr)->args = (List *)
elog(NOTICE, "SS_replace_correlation_vars: can't handle node %d",
nodeTag(expr));
- return (expr);
+ return expr;
}
Node *
SS_process_sublinks(Node *expr)
{
if (expr == NULL)
- return (NULL);
+ return NULL;
if (IsA(expr, List))
{
List *le;
expr = _make_subplan((SubLink *) expr);
}
- return (expr);
+ return expr;
}
List *
List *lst;
if (plan == NULL)
- return (NULL);
+ return NULL;
param_list = _finalize_primnode(plan->targetlist, &subPlan);
Assert(subPlan == NULL);
break;
default:
elog(ERROR, "SS_finalize_plan: node %d unsupported", nodeTag(plan));
- return (NULL);
+ return NULL;
}
param_list = set_unioni(param_list, _finalize_primnode(plan->qual, &subPlan));
plan->locParam = locParam;
plan->subPlan = subPlan;
- return (param_list);
+ return param_list;
}
List *result = NULL;
if (expr == NULL || single_node(expr))
- return (NULL);
+ return NULL;
if (IsA(expr, List))
{
result = nconc(result, SS_pull_subplan(lfirst(le)));
}
else if (IsA(expr, Iter))
- return (SS_pull_subplan(((Iter *) expr)->iterexpr));
+ return SS_pull_subplan(((Iter *) expr)->iterexpr);
else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
not_clause(expr) || is_funcclause(expr))
- return (SS_pull_subplan(((Expr *) expr)->args));
+ return SS_pull_subplan(((Expr *) expr)->args);
else if (IsA(expr, Aggreg))
- return (SS_pull_subplan(((Aggreg *) expr)->target));
+ return SS_pull_subplan(((Aggreg *) expr)->target);
else if (IsA(expr, ArrayRef))
{
result = SS_pull_subplan(((ArrayRef *) expr)->refupperindexpr);
SS_pull_subplan(((ArrayRef *) expr)->refassgnexpr));
}
else if (IsA(expr, TargetEntry))
- return (SS_pull_subplan(((TargetEntry *) expr)->expr));
+ return SS_pull_subplan(((TargetEntry *) expr)->expr);
else if (is_subplan(expr))
- return (lcons(((Expr *) expr)->oper, NULL));
+ return lcons(((Expr *) expr)->oper, NULL);
else
elog(ERROR, "SS_pull_subplan: can't handle node %d",
nodeTag(expr));
- return (result);
+ return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.9 1998/06/15 19:28:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.10 1998/09/01 03:23:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pull_args(Expr *qual)
{
if (qual == NULL)
- return (NULL);
+ return NULL;
if (is_opclause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, pull_args(lfirst(temp)));
- return (make_andclause(pull_ands(t_list)));
+ return make_andclause(pull_ands(t_list));
}
else if (or_clause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, pull_args(lfirst(temp)));
- return (make_orclause(pull_ors(t_list)));
+ return make_orclause(pull_ors(t_list));
}
else if (not_clause((Node *) qual))
- return (make_notclause(pull_args(get_notclausearg(qual))));
+ return make_notclause(pull_args(get_notclausearg(qual)));
else
- return (qual);
+ return qual;
}
/*
pull_ors(List *orlist)
{
if (orlist == NIL)
- return (NIL);
+ return NIL;
if (or_clause(lfirst(orlist)))
{
copyObject((Node *) lnext(orlist)))));
}
else
- return (lcons(lfirst(orlist), pull_ors(lnext(orlist))));
+ return lcons(lfirst(orlist), pull_ors(lnext(orlist)));
}
/*
pull_ands(List *andlist)
{
if (andlist == NIL)
- return (NIL);
+ return NIL;
if (and_clause(lfirst(andlist)))
{
copyObject((Node *) lnext(andlist)))));
}
else
- return (lcons(lfirst(andlist), pull_ands(lnext(andlist))));
+ return lcons(lfirst(andlist), pull_ands(lnext(andlist)));
}
/*
find_nots(Expr *qual)
{
if (qual == NULL)
- return (NULL);
+ return NULL;
if (is_opclause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, find_nots(lfirst(temp)));
- return (make_andclause(t_list));
+ return make_andclause(t_list);
}
else if (or_clause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, find_nots(lfirst(temp)));
- return (make_orclause(t_list));
+ return make_orclause(t_list);
}
else if (not_clause((Node *) qual))
- return (push_nots(get_notclausearg(qual)));
+ return push_nots(get_notclausearg(qual));
else
- return (qual);
+ return qual;
}
/*
push_nots(Expr *qual)
{
if (qual == NULL)
- return (NULL);
+ return NULL;
/*
* Negate an operator clause if possible: ("NOT" (< A B)) => (> A B)
(make_opclause(op, get_leftop(qual), get_rightop(qual)));
}
else
- return (make_notclause(qual));
+ return make_notclause(qual);
}
else if (and_clause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, push_nots(lfirst(temp)));
- return (make_orclause(t_list));
+ return make_orclause(t_list);
}
else if (or_clause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, push_nots(lfirst(temp)));
- return (make_andclause(t_list));
+ return make_andclause(t_list);
}
else if (not_clause((Node *) qual))
* Another 'not' cancels this 'not', so eliminate the 'not' and
* stop negating this branch.
*/
- return (find_nots(get_notclausearg(qual)));
+ return find_nots(get_notclausearg(qual));
else
/*
* We don't know how to negate anything else, place a 'not' at
* this level.
*/
- return (make_notclause(qual));
+ return make_notclause(qual);
}
/*
normalize(Expr *qual)
{
if (qual == NULL)
- return (NULL);
+ return NULL;
if (is_opclause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, normalize(lfirst(temp)));
- return (make_andclause(t_list));
+ return make_andclause(t_list);
}
else if (or_clause((Node *) qual))
{
}
}
if (has_andclause == TRUE)
- return (make_andclause(or_normalize(orlist)));
+ return make_andclause(or_normalize(orlist));
else
- return (make_orclause(orlist));
+ return make_orclause(orlist);
}
else if (not_clause((Node *) qual))
- return (make_notclause(normalize(get_notclausearg(qual))));
+ return make_notclause(normalize(get_notclausearg(qual)));
else
- return (qual);
+ return qual;
}
/*
lnext(new_orlist))));
}
else
- return (orlist);
+ return orlist;
}
/*
List *t_list = NIL;
if (args == NULL)
- return (item);
+ return item;
foreach(temp, args)
{
or_list = (List *) make_orclause(n_list);
t_list = lappend(t_list, or_list);
}
- return ((List *) make_andclause(t_list));
+ return (List *) make_andclause(t_list);
}
/*
qualcleanup(Expr *qual)
{
if (qual == NULL)
- return (NIL);
+ return NIL;
if (is_opclause((Node *) qual))
{
new_and_args = remove_duplicates(t_list);
if (length(new_and_args) > 1)
- return ((List *) make_andclause(new_and_args));
+ return (List *) make_andclause(new_and_args);
else
- return (lfirst(new_and_args));
+ return lfirst(new_and_args);
}
else if (or_clause((Node *) qual))
{
if (length(new_or_args) > 1)
- return ((List *) make_orclause(new_or_args));
+ return (List *) make_orclause(new_or_args);
else
- return (lfirst(new_or_args));
+ return lfirst(new_or_args);
}
else if (not_clause((Node *) qual))
- return ((List *) make_notclause((Expr *) qualcleanup((Expr *) get_notclausearg(qual))));
+ return (List *) make_notclause((Expr *) qualcleanup((Expr *) get_notclausearg(qual)));
else
- return ((List *) qual);
+ return (List *) qual;
}
/*
List *t_list = NIL;
if (qual == NULL)
- return (NIL);
+ return NIL;
if (is_opclause((Node *) qual))
{
return ((List *) make_clause(qual->opType, qual->oper,
foreach(temp, qual->args)
t_list = lappend(t_list, remove_ands(lfirst(temp)));
- return (t_list);
+ return t_list;
}
else if (or_clause((Node *) qual))
{
foreach(temp, qual->args)
t_list = lappend(t_list, remove_ands(lfirst(temp)));
- return ((List *) make_orclause((List *) t_list));
+ return (List *) make_orclause((List *) t_list);
}
else if (not_clause((Node *) qual))
- return ((List *) make_notclause((Expr *) remove_ands((Expr *) get_notclausearg(qual))));
+ return (List *) make_notclause((Expr *) remove_ands((Expr *) get_notclausearg(qual)));
else
- return ((List *) qual);
+ return (List *) qual;
}
/*****************************************************************************
bool there_exists_duplicate = false;
if (length(list) == 1)
- return (list);
+ return list;
foreach(i, list)
{
there_exists_duplicate = false;
}
}
- return (result);
+ return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.14 1998/07/20 19:53:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.15 1998/09/01 03:23:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
t_list = lappend(t_list, ctid);
}
- return (t_list);
+ return t_list;
}
/*****************************************************************************
result_relation,
node_type);
- return (replace_matching_resname(ntlist, tlist));
+ return replace_matching_resname(ntlist, tlist);
}
else
- return (tlist);
+ return tlist;
}
}
}
- return (t_list);
+ return t_list;
}
/*
}
}
- return (t_list);
+ return t_list;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.25 1998/07/15 14:54:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.26 1998/09/01 03:23:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
*union_rtentriesPtr = union_rtentries;
- return (union_plans);
+ return union_plans;
}
/*
new_examined_relids);
if (new_unexamined_relids == NULL)
- return (new_examined_relids);
+ return new_examined_relids;
else
{
return (find_all_inheritors(new_unexamined_relids,
new_entry->relname = get_rel_name(new_relid);
new_entry->relid = new_relid;
- return (new_entry);
+ return new_entry;
}
/*
;
lfirst(temp) = new_entry;
- return (new_root);
+ return new_root;
}
static void
node->plan.lefttree = (Plan *) NULL;
node->plan.righttree = (Plan *) NULL;
- return (node);
+ return node;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.7 1998/02/26 04:33:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.8 1998/09/01 03:23:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*
*/
bool
-valid_or_clause(CInfo *clauseinfo)
+valid_or_clause(ClauseInfo *clauseinfo)
{
if (clauseinfo != NULL &&
!single_node((Node *) clauseinfo->clause) &&
!clauseinfo->notclause &&
or_clause((Node *) clauseinfo->clause))
- return (true);
+ return true;
else
- return (false);
+ return false;
}
/*
{
List *temp = NIL;
List *result = NIL;
- CInfo *clause = (CInfo *) NULL;
+ ClauseInfo *clause = (ClauseInfo *) NULL;
foreach(temp, clauseinfo_list)
{
- clause = (CInfo *) lfirst(temp);
+ clause = (ClauseInfo *) lfirst(temp);
result = lappend(result, clause->clause);
}
- return (result);
+ return result;
}
/*
List *result1 = NIL;
List *result2 = NIL;
List *result3 = NIL;
- CInfo *temp = (CInfo *) NULL;
+ ClauseInfo *temp = (ClauseInfo *) NULL;
List *i = NIL;
foreach(i, clauseinfo_list)
Datum constval;
int flag;
- temp = (CInfo *) lfirst(i);
+ temp = (ClauseInfo *) lfirst(i);
get_relattval((Node *) temp->clause, &dummy, &attno, &constval, &flag);
result1 = lappendi(result1, (int) attno);
result2 = lappendi(result2, constval);
foreach(temp, clauseinfo_list)
{
- CInfo *clauseinfo = lfirst(temp);
+ ClauseInfo *clauseinfo = lfirst(temp);
Expr *clause = clauseinfo->clause;
if (IsA(get_leftop(clause), Var) &&
List *
get_opnos(List *clauseinfo_list)
{
- CInfo *temp = (CInfo *) NULL;
+ ClauseInfo *temp = (ClauseInfo *) NULL;
List *result = NIL;
List *i = NIL;
foreach(i, clauseinfo_list)
{
- temp = (CInfo *) lfirst(i);
+ temp = (ClauseInfo *) lfirst(i);
result =
lappendi(result,
(((Oper *) temp->clause->oper)->opno));
}
- return (result);
+ return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.22 1998/08/31 07:55:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.23 1998/09/01 03:23:49 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
{
elog(ERROR, "make_clause: unsupported type %d", type);
/* will this ever happen? translated from lispy C code - ay 10/94 */
- return ((Expr *) args);
+ return (Expr *) args;
}
}
get_leftop(Expr *clause)
{
if (clause->args != NULL)
- return (lfirst(clause->args));
+ return lfirst(clause->args);
else
return NULL;
}
get_rightop(Expr *clause)
{
if (clause->args != NULL && lnext(clause->args) != NULL)
- return (lfirst(lnext(clause->args)));
+ return lfirst(lnext(clause->args));
else
return NULL;
}
Expr *
get_notclausearg(Expr *notclause)
{
- return (lfirst(notclause->args));
+ return lfirst(notclause->args);
}
/*****************************************************************************
var_list = lconsi(var->varno, var_list);
}
- return (length(var_list));
+ return length(var_list);
}
/*
contains_not(Node *clause)
{
if (single_node(clause))
- return (false);
+ return false;
if (not_clause(clause))
- return (true);
+ return true;
if (or_clause(clause) || and_clause(clause))
{
foreach(a, ((Expr *) clause)->args)
{
if (contains_not(lfirst(a)))
- return (true);
+ return true;
}
}
- return (false);
+ return false;
}
/*
* ... or a func node.
*/
if (is_funcclause(leftop) || is_funcclause(rightop))
- return (true);
+ return true;
- return (false);
+ return false;
}
/*
/* How about Param-s ? - vadim 02/03/98 */
if (IsA(get_leftop((Expr *) clause), Var) &&
IsA(get_rightop((Expr *) clause), Const))
- return (true);
+ return true;
else if (IsA(get_rightop((Expr *) clause), Var) &&
IsA(get_leftop((Expr *) clause), Const))
- return (true);
- return (false);
+ return true;
+ return false;
}
/*
foreach(clause, clauses)
fix_opid(lfirst(clause));
- return (clauses);
+ return clauses;
}
/*
{
Node *temp;
Oper *commu;
- OperatorTupleForm commuTup;
+ Form_pg_operator commuTup;
HeapTuple heapTup;
if (!is_opclause(clause))
if (heapTup == (HeapTuple) NULL)
return;
- commuTup = (OperatorTupleForm) GETSTRUCT(heapTup);
+ commuTup = (Form_pg_operator) GETSTRUCT(heapTup);
commu = makeOper(heapTup->t_oid,
InvalidOid,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.8 1998/07/18 04:22:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.9 1998/09/01 03:23:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
find_relation_indices(Query *root, RelOptInfo *rel)
{
if (rel->indexed)
- return (find_secondary_index(root, lfirsti(rel->relids)));
+ return find_secondary_index(root, lfirsti(rel->relids));
else
- return (NIL);
+ return NIL;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.10 1998/08/10 02:26:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.11 1998/09/01 03:23:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* exists.
*
*/
-JInfo *
+JoinInfo *
joininfo_member(List *join_relids, List *joininfo_list)
{
List *i = NIL;
foreach(i, joininfo_list)
{
other_rels = lfirst(i);
- if (same(join_relids, ((JInfo *) other_rels)->otherrels))
- return ((JInfo *) other_rels);
+ if (same(join_relids, ((JoinInfo *) other_rels)->otherrels))
+ return (JoinInfo *) other_rels;
}
- return ((JInfo *) NULL);
+ return (JoinInfo *) NULL;
}
* Returns a joininfo node.
*
*/
-JInfo *
+JoinInfo *
find_joininfo_node(RelOptInfo *this_rel, List *join_relids)
{
- JInfo *joininfo = joininfo_member(join_relids,
+ JoinInfo *joininfo = joininfo_member(join_relids,
this_rel->joininfo);
if (joininfo == NULL)
{
- joininfo = makeNode(JInfo);
+ joininfo = makeNode(JoinInfo);
joininfo->otherrels = join_relids;
joininfo->jinfoclauseinfo = NIL;
joininfo->mergejoinable = false;
joininfo->inactive = false;
this_rel->joininfo = lcons(joininfo, this_rel->joininfo);
}
- return (joininfo);
+ return joininfo;
}
/*
retval = l;
}
- return (retval);
+ return retval;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.7 1998/07/18 04:22:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.8 1998/09/01 03:23:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (IsA(operand, Var) &&
(lfirsti(rel->relids) == operand->varno) &&
equal_indexkey_var(indexkey, operand))
- return (true);
+ return true;
else
- return (false);
+ return false;
}
/*
equal_indexkey_var(int index_key, Var *var)
{
if (index_key == var->varattno)
- return (true);
+ return true;
else
- return (false);
+ return false;
}
/*
elog(DEBUG, "extract_subkey with neither INNER or OUTER");
retval = NULL;
}
- return (retval);
+ return retval;
}
/*
allmember = false;
if ((length(keys2) >= length(keys1)) && allmember)
- return (true);
+ return true;
else
- return (false);
+ return false;
}
/*
}
if (tlentry)
- return ((Expr *) get_expr(tlentry));
+ return (Expr *) get_expr(tlentry);
else
- return ((Expr *) NULL);
+ return (Expr *) NULL;
}
NIL));
index_keys++;
}
- return (retval);
+ return retval;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.6 1997/09/08 21:45:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.7 1998/09/01 03:23:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
MergeOrder *merge_ordering)
{
if (path_ordering == NULL || merge_ordering == NULL)
- return (false);
+ return false;
if (path_ordering[0] == merge_ordering->left_operator ||
path_ordering[0] == merge_ordering->right_operator)
- return (true);
+ return true;
else
- return (false);
+ return false;
}
/*
equal_merge_merge_ordering(MergeOrder *merge_ordering1,
MergeOrder *merge_ordering2)
{
- return (equal(merge_ordering1, merge_ordering2));
+ return equal(merge_ordering1, merge_ordering2);
}
/*****************************************************************************
int i = 0;
if (ordering1 == NULL || ordering2 == NULL)
- return (ordering1 == ordering2);
+ return ordering1 == ordering2;
while (ordering1[i] != 0 && ordering2[i] != 0)
{
i++;
}
- return (ordering1[i] == 0 && ordering2[i] == 0);
+ return ordering1[i] == 0 && ordering2[i] == 0;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.10 1998/08/04 16:44:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.11 1998/09/01 03:23:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Cost cost1 = path1->path_cost;
Cost cost2 = path2->path_cost;
- return ((bool) (cost1 < cost2));
+ return (bool) (cost1 < cost2);
}
/*
parent_rel->cheapestpath = cheapest_so_far;
- return (cheapest_so_far);
+ return cheapest_so_far;
}
/*
LispRemove(old_path, unique_paths));
}
}
- return (unique_paths);
+ return unique_paths;
}
/*
retval = old_path;
}
- return (retval);
+ return retval;
}
xfunc_get_path_cost(pathnode);
}
#endif
- return (pathnode);
+ return pathnode;
}
/*
/* XXX Can this divide the selectivities in a better way? */
set_clause_selectivities(restriction_clauses, clausesel);
}
- return (pathnode);
+ return pathnode;
}
/*
if (XfuncMode != XFUNC_OFF)
pathnode->path_cost += xfunc_get_path_cost((Path *) pathnode);
#endif
- return (pathnode);
+ return pathnode;
}
/*
xfunc_get_path_cost((Path *) pathnode);
}
#endif
- return (pathnode);
+ return pathnode;
}
/*
xfunc_get_path_cost((Path *) pathnode);
}
#endif
- return (pathnode);
+ return pathnode;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.19 1998/08/19 02:02:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.20 1998/09/01 03:23:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static void
IndexSelectivity(Oid indexrelid, Oid indrelid, int32 nIndexKeys,
- Oid AccessMethodOperatorClasses[], Oid operatorObjectIds[],
- int32 varAttributeNumbers[], char *constValues[], int32 constFlags[],
+ Oid *AccessMethodOperatorClasses, Oid *operatorObjectIds,
+ int32 *varAttributeNumbers, char **constValues, int32 *constFlags,
float *idxPages, float *idxSelec);
int i;
HeapTuple indexTuple,
amopTuple;
- IndexTupleForm index;
+ Form_pg_index index;
Relation indexRelation;
uint16 amstrategy;
Oid relam;
heap_close(relation);
scan = (HeapScanDesc) NULL;
relation = (Relation) NULL;
- return (0);
+ return 0;
}
/* Extract info from the index tuple */
- index = (IndexTupleForm) GETSTRUCT(indexTuple);
+ index = (Form_pg_index) GETSTRUCT(indexTuple);
info->relid = index->indexrelid; /* index relation */
for (i = 0; i < 8; i++)
info->indexkeys[i] = index->indkey[i];
info->orderOprs[i] =
((Form_pg_amop) GETSTRUCT(amopTuple))->amopopr;
}
- return (TRUE);
+ return TRUE;
}
/*
elog(ERROR, "RestrictionClauseSelectivity: bad value %lf",
*result);
- return ((Cost) *result);
+ return (Cost) *result;
}
/*
elog(ERROR, "JoinClauseSelectivity: bad value %lf",
*result);
- return ((Cost) *result);
+ return (Cost) *result;
}
/*
scan = heap_beginscan(relation, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(inheritsTuple = heap_getnext(scan, 0)))
{
- inhrelid = ((InheritsTupleForm) GETSTRUCT(inheritsTuple))->inhrel;
+ inhrelid = ((Form_pg_inherits) GETSTRUCT(inheritsTuple))->inhrel;
list = lappendi(list, inhrelid);
}
heap_endscan(scan);
heap_close(relation);
- return (list);
+ return list;
}
/*
scan = heap_beginscan(relation, 0, SnapshotNow, 1, key);
while (HeapTupleIsValid(versionTuple = heap_getnext(scan, 0)))
{
- verbaseid = ((VersionTupleForm)
+ verbaseid = ((Form_pg_version)
GETSTRUCT(versionTuple))->verbaseid;
list = lconsi(verbaseid, list);
}
heap_endscan(scan);
heap_close(relation);
- return (list);
+ return list;
}
/*****************************************************************************
IndexSelectivity(Oid indexrelid,
Oid indrelid,
int32 nIndexKeys,
- Oid AccessMethodOperatorClasses[], /* XXX not used? */
- Oid operatorObjectIds[],
- int32 varAttributeNumbers[],
- char *constValues[],
- int32 constFlags[],
+ Oid *AccessMethodOperatorClasses, /* XXX not used? */
+ Oid *operatorObjectIds,
+ int32 *varAttributeNumbers,
+ char **constValues,
+ int32 *constFlags,
float *idxPages,
float *idxSelec)
{
HeapTuple indexTuple,
amopTuple,
indRel;
- IndexTupleForm index;
+ Form_pg_index index;
Form_pg_amop amop;
Oid indclass;
float64data npages,
if (!HeapTupleIsValid(indexTuple))
elog(ERROR, "IndexSelectivity: index %d not found",
indexrelid);
- index = (IndexTupleForm) GETSTRUCT(indexTuple);
+ index = (Form_pg_index) GETSTRUCT(indexTuple);
/*
* Hack for non-functional btree npages estimation: npages =
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.7 1998/08/10 02:26:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.8 1998/09/01 03:23:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
temprelid = ((RelOptInfo *) lfirst(temp))->relids;
if (same(temprelid, relid))
- return ((RelOptInfo *) (lfirst(temp)));
+ return (RelOptInfo *) (lfirst(temp));
}
}
- return (NULL);
+ return NULL;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.16 1998/07/20 21:18:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.17 1998/09/01 03:23:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
if (var_equal(var,
get_expr(lfirst(temp))))
- return ((TargetEntry *) lfirst(temp));
+ return (TargetEntry *) lfirst(temp);
}
}
- return (NULL);
+ return NULL;
}
/*
tlentry = tlistentry_member(var, targetlist);
if (tlentry)
- return ((Expr *) get_expr(tlentry));
+ return (Expr *) get_expr(tlentry);
- return ((Expr *) NULL);
+ return (Expr *) NULL;
}
/*
if (tlist == NULL)
{
elog(DEBUG, "calling get_actual_tlist with empty tlist");
- return (NIL);
+ return NIL;
}
/*
foreach(element, tlist)
result = lappend(result, lfirst((List *) lfirst(element)));
- return (result);
+ return result;
#endif
return tlist;
}
}
if (tl_elt != NULL)
- return (tl_elt->resdom);
+ return tl_elt->resdom;
else
- return ((Resdom *) NULL);
+ return (Resdom *) NULL;
}
- return ((Resdom *) NULL);
+ return (Resdom *) NULL;
}
/*
resdom = temp_tle->resdom;
/* Since resnos are supposed to be unique */
if (resnode->resno == resdom->resno)
- return (resdom);
+ return resdom;
}
- return ((Resdom *) NULL);
+ return (Resdom *) NULL;
}
{
if (tlvar->vartype == type_var)
- return (entry);
+ return entry;
}
}
- return (NULL);
+ return NULL;
}
tle->resdom->reskey = 0;
tle->resdom->reskeyop = (Oid) 0;
}
- return (new_targetlist);
+ return new_targetlist;
}
/*
result = lappend(result, temp);
}
- return (result);
+ return result;
}
/*
flat_tlist)));
}
- return (result);
+ return result;
}
/*
Assert(tle != NULL);
Assert(tle->expr != NULL);
- return ((Var *) tle->expr);
+ return (Var *) tle->expr;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.12 1998/06/15 19:28:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.13 1998/09/01 03:24:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*result = NIL;
if (me == NULL)
- return (NIL);
+ return NIL;
switch (nodeTag(me))
{
default:
break;
}
- return (result);
+ return result;
}
/*
List *retval = NIL;
if (clause == NULL)
- return (NIL);
+ return NIL;
else if (IsA(clause, Var))
retval = lcons(clause, NIL);
else if (IsA(clause, Iter))
else
retval = NIL;
- return (retval);
+ return retval;
}
/*
(((Var *) var1)->varattno == ((Var *) var2)->varattno))
{
Assert(((Var *) var1)->varlevelsup == 0);
- return (true);
+ return true;
}
else
- return (false);
+ return false;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.83 1998/08/26 05:22:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.84 1998/09/01 03:24:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pstate->p_target_relation->rd_att->constr &&
pstate->p_target_relation->rd_att->constr->num_defval > 0)
{
- AttributeTupleForm *att = pstate->p_target_relation->rd_att->attrs;
+ Form_pg_attribute *att = pstate->p_target_relation->rd_att->attrs;
AttrDefault *defval = pstate->p_target_relation->rd_att->constr->defval;
int ndef = pstate->p_target_relation->rd_att->constr->num_defval;
{
/* not enough room for next part? then return nothing */
if ((strlen(buf) + strlen(name)) >= (sizeof(buf) - 1))
- return (NULL);
+ return NULL;
if (strlen(buf) > 0)
strcat(buf, "_");
name = palloc(strlen(buf) + 1);
strcpy(name, buf);
- return (name);
+ return name;
}
static char *
sprintf(name2, "%s_%d", column_name, (pass + 1));
}
- return (iname);
+ return iname;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.31 1998/08/26 16:43:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.32 1998/09/01 03:24:04 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
elog(DEBUG, "flattened string is \"%s\"\n", s);
#endif
- return (s);
+ return s;
} /* FlattenStringList() */
elog(DEBUG, "AexprConst argument is \"%s\"\n", defval);
#endif
- return (result);
+ return result;
} /* makeConstantList() */
((cp == rawid)? "do not ": ""), rawid, cp);
#endif
- return (cp);
+ return cp;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.27 1998/08/26 05:22:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.28 1998/09/01 03:24:08 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
elog(DEBUG, "flattened string is \"%s\"\n", s);
#endif
- return (s);
+ return s;
} /* FlattenStringList() */
elog(DEBUG, "AexprConst argument is \"%s\"\n", defval);
#endif
- return (result);
+ return result;
} /* makeConstantList() */
((cp == rawid)? "do not ": ""), rawid, cp);
#endif
- return (cp);
+ return cp;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.42 1998/08/25 21:36:55 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.43 1998/09/01 03:24:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
middle = low + (high - low) / 2;
difference = strcmp(middle->name, text);
if (difference == 0)
- return (middle);
+ return middle;
else if (difference < 0)
low = middle + 1;
else
high = middle - 1;
}
- return (NULL);
+ return NULL;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.4 1998/08/14 16:06:52 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.5 1998/09/01 03:24:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
result = USER_TYPE;
break;
}
- return (result);
+ return result;
} /* TypeCategory() */
bool
IsPreferredType(CATEGORY category, Oid type)
{
- return (type == PreferredType(category, type));
+ return type == PreferredType(category, type);
} /* IsPreferredType() */
#ifdef PARSEDEBUG
printf("PreferredType- (%d) preferred type is %s\n", category, typeidTypeName(result));
#endif
- return (result);
+ return result;
} /* PreferredType() */
result = inType;
break;
}
- return (result);
+ return result;
} /* PromoteTypeToNext() */
result = inType;
break;
}
- return (result);
+ return result;
} /* DemoteType() */
result = PromoteTypeToNext(inType1);
inType1 = result;
*arg2 = result;
- return (result);
+ return result;
}
kind1 = ClassifyType(inType1);
if ((promotedType = PromoteBuiltInType(*arg1)) != *arg1)
{
*arg1 = promotedType;
- return (promotedType);
+ return promotedType;
}
else if (CanCoerceType(*arg1, *arg2))
{
*arg1 = *arg2;
- return (*arg2);
+ return *arg2;
}
}
else if (!isBuiltIn1 && isBuiltIn2)
if ((promotedType = PromoteBuiltInType(*arg2)) != *arg2)
{
*arg2 = promotedType;
- return (promotedType);
+ return promotedType;
}
else if (CanCoerceType(*arg2, *arg1))
{
*arg2 = *arg1;
- return (*arg1);
+ return *arg1;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.32 1998/07/12 21:29:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.33 1998/09/01 03:24:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
false, /* was omitted */
false, /* not a set */
true /* is cast */ );
- return ((Node *) adt);
+ return (Node *) adt;
}
cp = stringTypeString(tp, const_string, atttypmod);
if (string_palloced)
pfree(const_string);
- return ((Node *) adt);
+ return (Node *) adt;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.26 1998/08/25 21:25:42 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.27 1998/09/01 03:24:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
precedence);
}
- return (retval);
+ return retval;
}
/*
retval = (Node *) iter;
}
- return (retval);
+ return retval;
}
static Oid
funcrettype = (Oid)
((Form_pg_proc) GETSTRUCT(func_tuple))->prorettype;
- return (funcrettype);
+ return funcrettype;
}
}
if ((nmatch + nident) == nargs)
- return (current_candidate->args);
+ return current_candidate->args;
#ifdef PARSEDEBUG
printf("func_select_candidate- candidate has %d matches\n", nmatch);
}
if (ncandidates == 1)
- return (candidates->args);
+ return candidates->args;
- return (NULL);
+ return NULL;
} /* func_select_candidate() */
*rettype = pform->prorettype;
*retset = pform->proretset;
- return (true);
+ return true;
}
/* shouldn't reach here */
- return (false);
+ return false;
} /* func_get_detail() */
/*
}
/* return an ordered cross-product of the classes involved */
- return (gen_cross_product(arginh, nargs));
+ return gen_cross_product(arginh, nargs);
}
static int
inhrel = heap_openr(InheritsRelationName);
RelationSetLockForRead(inhrel);
- inhtupdesc = RelationGetTupleDescriptor(inhrel);
+ inhtupdesc = RelationGetDescr(inhrel);
/*
* Use queue to do a breadth-first traversal of the inheritance graph
else
*supervec = (Oid *) NULL;
- return (nvisited);
+ return nvisited;
}
static Oid **
if (i < 0)
{
*iter = NULL;
- return (result);
+ return result;
}
/* no, increment this column and zero the ones after it */
varnode = makeVar(-1, attno, typeid, type_mod, 0, -1, attno);
tle = makeTargetEntry(resnode, (Node *) varnode);
- return (lcons(tle, NIL));
+ return lcons(tle, NIL);
}
/*
varnode = makeVar(-1, 1, typeid, -1, 0, -1, 1);
tle = makeTargetEntry(resnode, (Node *) varnode);
- return (lcons(tle, NIL));
+ return lcons(tle, NIL);
}
/*
func->func_tlist =
setup_tlist(funcname, argrelid);
iter->itertype = attnumTypeId(rd, attnum);
- return ((Node *) iter);
+ return (Node *) iter;
}
else
{
newexpr->oper = (Node *) funcnode;
newexpr->args = lcons(first_arg, NIL);
- return ((Node *) newexpr);
+ return (Node *) newexpr;
}
}
{
param->paramtype = attnumTypeId(rd, attnum);
param->param_tlist = setup_tlist(funcname, relid);
- return ((Node *) param);
+ return (Node *) param;
}
}
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.19 1998/08/19 02:02:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.20 1998/09/01 03:24:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pstate->p_last_resno = 1;
pstate->parentParseState = parentParseState;
- return (pstate);
+ return pstate;
}
Oid ltypeId,
rtypeId;
Operator tup;
- OperatorTupleForm opform;
+ Form_pg_operator opform;
Oper *newop;
Node *left,
*right;
{
ltypeId = (ltree == NULL) ? UNKNOWNOID : exprType(ltree);
tup = right_oper(opname, ltypeId);
- opform = (OperatorTupleForm) GETSTRUCT(tup);
+ opform = (Form_pg_operator) GETSTRUCT(tup);
left = make_operand(opname, ltree, ltypeId, opform->oprleft);
right = NULL;
#ifdef PARSEDEBUG
printf("make_op: returned from left_oper() with structure at %p\n", (void *)tup);
#endif
- opform = (OperatorTupleForm) GETSTRUCT(tup);
+ opform = (Form_pg_operator) GETSTRUCT(tup);
#ifdef PARSEDEBUG
printf("make_op: calling make_operand()\n");
#endif
/* Won't return from oper_inexact() without a candidate... */
}
- opform = (OperatorTupleForm) GETSTRUCT(tup);
+ opform = (Form_pg_operator) GETSTRUCT(tup);
left = make_operand(opname, ltree, ltypeId, opform->oprleft);
right = make_operand(opname, rtree, rtypeId, opform->oprright);
}
{
Oid typearray;
HeapTuple type_tuple;
- TypeTupleForm type_struct_array,
+ Form_pg_type type_struct_array,
type_struct_element;
ArrayRef *aref;
Oid reftype;
typearray);
/* get the array type struct from the type tuple */
- type_struct_array = (TypeTupleForm) GETSTRUCT(type_tuple);
+ type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple);
if (type_struct_array->typelem == InvalidOid)
elog(ERROR, "make_array_ref: type %s is not an array",
elog(ERROR, "make_array_ref: Cache lookup failed for type %d\n",
typearray);
- type_struct_element = (TypeTupleForm) GETSTRUCT(type_tuple);
+ type_struct_element = (Form_pg_type) GETSTRUCT(type_tuple);
while (indirection != NIL)
{
{
Oid typearray;
HeapTuple type_tuple;
- TypeTupleForm type_struct_array;
- TypeTupleForm type_struct_element;
+ Form_pg_type type_struct_array;
+ Form_pg_type type_struct_element;
ArrayRef *aref;
Oid reftype;
typearray);
/* get the array type struct from the type tuple */
- type_struct_array = (TypeTupleForm) GETSTRUCT(type_tuple);
+ type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple);
if (type_struct_array->typelem == InvalidOid)
elog(ERROR, "make_array_ref: type %s is not an array",
elog(ERROR, "make_array_ref: Cache lookup failed for type %d\n",
typearray);
- type_struct_element = (TypeTupleForm) GETSTRUCT(type_tuple);
+ type_struct_element = (Form_pg_type) GETSTRUCT(type_tuple);
aref = makeNode(ArrayRef);
aref->refattrlength = type_struct_array->typlen;
false, /* not a set */
false);
- return (con);
+ return con;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.15 1998/08/19 02:02:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.16 1998/09/01 03:24:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Oid
oprid(Operator op)
{
- return (op->t_oid);
+ return op->t_oid;
}
Relation pg_operator_desc;
HeapScanDesc pg_operator_scan;
HeapTuple tup;
- OperatorTupleForm oper;
+ Form_pg_operator oper;
int nkeys;
int ncandidates = 0;
ScanKeyData opKey[3];
current_candidate = (CandidateList) palloc(sizeof(struct _CandidateList));
current_candidate->args = (Oid *) palloc(2 * sizeof(Oid));
- oper = (OperatorTupleForm) GETSTRUCT(tup);
+ oper = (Form_pg_operator) GETSTRUCT(tup);
current_candidate->args[0] = oper->oprleft;
current_candidate->args[1] = oper->oprright;
current_candidate->next = *candidates;
if (!can_coerce_type(1, &input_typeids[0], &candidates->args[0])
|| !can_coerce_type(1, &input_typeids[1], &candidates->args[1]))
ncandidates = 0;
- return ((ncandidates == 1)? candidates->args: NULL);
+ return (ncandidates == 1)? candidates->args: NULL;
}
/*
printf("oper_select_candidate- unable to coerce preferred candidate\n");
#endif
}
- return ((ncandidates == 1)? candidates->args: NULL);
+ return (ncandidates == 1)? candidates->args: NULL;
}
/*
nmatch++;
}
if (nmatch == nargs)
- return (candidates->args);
+ return candidates->args;
}
}
ncandidates++;
}
- return ((ncandidates == 1)? candidates->args: NULL);
+ return (ncandidates == 1)? candidates->args: NULL;
} /* oper_select_candidate() */
if (HeapTupleIsValid(tup))
{
- OperatorTupleForm opform;
+ Form_pg_operator opform;
#if PARSEDEBUG
printf("oper_exact: found possible commutative operator candidate\n");
#endif
- opform = (OperatorTupleForm) GETSTRUCT(tup);
+ opform = (Form_pg_operator) GETSTRUCT(tup);
if (opform->oprcom == tup->t_oid)
{
#if PARSEDEBUG
{
if (!noWarnings)
op_error(op, arg1, arg2);
- return (NULL);
+ return NULL;
}
/* Or found exactly one? Then proceed... */
"\n\tYou will have to retype this query using an explicit cast",
op, typeTypeName(typeidType(arg1)), typeTypeName(typeidType(arg2)));
}
- return (NULL);
+ return NULL;
}
}
- return ((Operator) tup);
+ return (Operator) tup;
} /* oper_inexact() */
opname, typeTypeName(typeidType(ltypeId)), typeTypeName(typeidType(rtypeId)));
}
- return ((Operator) tup);
+ return (Operator) tup;
} /* oper() */
Relation pg_operator_desc;
HeapScanDesc pg_operator_scan;
HeapTuple tup;
- OperatorTupleForm oper;
+ Form_pg_operator oper;
int ncandidates = 0;
static ScanKeyData opKey[2] = {
current_candidate = (CandidateList) palloc(sizeof(struct _CandidateList));
current_candidate->args = (Oid *) palloc(sizeof(Oid));
- oper = (OperatorTupleForm) GETSTRUCT(tup);
+ oper = (Form_pg_operator) GETSTRUCT(tup);
if (rightleft == 'r')
current_candidate->args[0] = oper->oprleft;
else
if (ncandidates == 0)
{
elog(ERROR, "Can't find right op '%s' for type %d", op, arg);
- return (NULL);
+ return NULL;
}
else if (ncandidates == 1)
{
{
elog(ERROR, "Unable to convert right operator '%s' from type %s to %s",
op, typeidTypeName(arg), typeidTypeName(*targetOid));
- return (NULL);
+ return NULL;
}
}
}
- return ((Operator) tup);
+ return (Operator) tup;
} /* right_oper() */
if (ncandidates == 0)
{
elog(ERROR, "Can't find left op '%s' for type %d", op, arg);
- return (NULL);
+ return NULL;
}
else if (ncandidates == 1)
{
{
elog(ERROR, "Unable to convert left operator '%s' from type %s to %s",
op, typeidTypeName(arg), typeidTypeName(*targetOid));
- return (NULL);
+ return NULL;
}
#ifdef PARSEDEBUG
printf("left_oper: searched cache for best left oper candidate '%s %s'\n",
#endif
}
}
- return ((Operator) tup);
+ return (Operator) tup;
} /* left_oper() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.14 1998/08/19 02:02:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.15 1998/09/01 03:24:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
heap_close(rel);
- return (te_head);
+ return te_head;
}
/*
for (i = 0; i < rd->rd_rel->relnatts; i++)
if (!namestrcmp(&(rd->rd_att->attrs[i]->attname), a))
- return (i + 1);
+ return i + 1;
for (i = 0; i < SPECIALS; i++)
if (!strcmp(special_attr[i].field, a))
- return (special_attr[i].code);
+ return special_attr[i].code;
/* on failure */
elog(ERROR, "Relation %s does not have attribute %s",
{
if (!strcmp(special_attr[i].field, name))
{
- return (false); /* no sys attr is a set */
+ return false; /* no sys attr is a set */
}
}
- return (get_attisset(RelationGetRelid(rd), name));
+ return get_attisset(RelationGetRelid(rd), name);
}
/*
int
attnumAttNelems(Relation rd, int attid)
{
- return (rd->rd_att->attrs[attid - 1]->attnelems);
+ return rd->rd_att->attrs[attid - 1]->attnelems;
}
/* given attribute id, return type of that attribute */
{
if (attid < 0)
- return (typeTypeId(typenameType(attnum_type[-attid - 1])));
+ return typeTypeId(typenameType(attnum_type[-attid - 1]));
/*
* -1 because varattno (where attid comes from) returns one more than
* index
*/
- return (rd->rd_att->attrs[attid - 1]->atttypid);
+ return rd->rd_att->attrs[attid - 1]->atttypid;
}
/* handleTargetColname()
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.25 1998/08/26 03:17:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.26 1998/09/01 03:24:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* this looks strange to me, returning an empty TargetEntry bjm 1998/08/24 */
if (target_colname == NULL || colname == NULL)
- return (tent);
+ return tent;
if (refname != NULL)
rte = refnameRangeTableEntry(pstate, refname);
tent->expr = expr;
}
- return (tent);
+ return tent;
} /* MakeTargetEntryIdent() */
{
int numcol;
int i;
- AttributeTupleForm *attr = pstate->p_target_relation->rd_att->attrs;
+ Form_pg_attribute *attr = pstate->p_target_relation->rd_att->attrs;
numcol = pstate->p_target_relation->rd_rel->relnatts;
for (i = 0; i < numcol; i++)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.14 1998/08/19 02:02:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.15 1998/09/01 03:24:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
typeidTypeName(Oid id)
{
HeapTuple tup;
- TypeTupleForm typetuple;
+ Form_pg_type typetuple;
if (!(tup = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(id),
0, 0, 0)))
{
elog(ERROR, "type id lookup of %u failed", id);
- return (NULL);
+ return NULL;
}
- typetuple = (TypeTupleForm) GETSTRUCT(tup);
+ typetuple = (Form_pg_type) GETSTRUCT(tup);
return (typetuple->typname).data;
}
0, 0, 0)))
{
elog(ERROR, "type id lookup of %u failed", id);
- return (NULL);
+ return NULL;
}
- return ((Type) tup);
+ return (Type) tup;
}
/* return a Type structure, given type name */
PointerGetDatum(s),
0, 0, 0)))
elog(ERROR, "type name lookup of %s failed", s);
- return ((Type) tup);
+ return (Type) tup;
}
/* given type, return the type OID */
{
if (tp == NULL)
elog(ERROR, "typeTypeId() called with NULL type struct");
- return (tp->t_oid);
+ return tp->t_oid;
}
/* given type (as type struct), return the length of type */
int16
typeLen(Type t)
{
- TypeTupleForm typ;
+ Form_pg_type typ;
- typ = (TypeTupleForm) GETSTRUCT(t);
- return (typ->typlen);
+ typ = (Form_pg_type) GETSTRUCT(t);
+ return typ->typlen;
}
/* given type (as type struct), return the value of its 'byval' attribute.*/
bool
typeByVal(Type t)
{
- TypeTupleForm typ;
+ Form_pg_type typ;
- typ = (TypeTupleForm) GETSTRUCT(t);
- return (typ->typbyval);
+ typ = (Form_pg_type) GETSTRUCT(t);
+ return typ->typbyval;
}
/* given type (as type struct), return the name of type */
char *
typeTypeName(Type t)
{
- TypeTupleForm typ;
+ Form_pg_type typ;
- typ = (TypeTupleForm) GETSTRUCT(t);
+ typ = (Form_pg_type) GETSTRUCT(t);
return (typ->typname).data;
}
char
typeTypeFlag(Type t)
{
- TypeTupleForm typ;
+ Form_pg_type typ;
- typ = (TypeTupleForm) GETSTRUCT(t);
- return (typ->typtype);
+ typ = (Form_pg_type) GETSTRUCT(t);
+ return typ->typtype;
}
/* Given a type structure and a string, returns the internal form of
Oid op;
Oid typelem;
- op = ((TypeTupleForm) GETSTRUCT(tp))->typinput;
- typelem = ((TypeTupleForm) GETSTRUCT(tp))->typelem; /* XXX - used for
+ op = ((Form_pg_type) GETSTRUCT(tp))->typinput;
+ typelem = ((Form_pg_type) GETSTRUCT(tp))->typelem; /* XXX - used for
* array_in */
- return ((char *) fmgr(op, string, typelem, atttypmod));
+ return (char *) fmgr(op, string, typelem, atttypmod);
}
/* Given a type id, returns the out-conversion function of the type */
typeidOutfunc(Oid type_id)
{
HeapTuple typeTuple;
- TypeTupleForm type;
+ Form_pg_type type;
Oid outfunc;
typeTuple = SearchSysCacheTuple(TYPOID,
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "typeidOutfunc: Invalid type - oid = %u", type_id);
- type = (TypeTupleForm) GETSTRUCT(typeTuple);
+ type = (Form_pg_type) GETSTRUCT(typeTuple);
outfunc = type->typoutput;
- return (outfunc);
+ return outfunc;
}
Oid
typeidTypeRelid(Oid type_id)
{
HeapTuple typeTuple;
- TypeTupleForm type;
+ Form_pg_type type;
Oid infunc;
typeTuple = SearchSysCacheTuple(TYPOID,
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "typeidTypeRelid: Invalid type - oid = %u", type_id);
- type = (TypeTupleForm) GETSTRUCT(typeTuple);
+ type = (Form_pg_type) GETSTRUCT(typeTuple);
infunc = type->typrelid;
- return (infunc);
+ return infunc;
}
Oid
typeTypeRelid(Type typ)
{
- TypeTupleForm typtup;
+ Form_pg_type typtup;
- typtup = (TypeTupleForm) GETSTRUCT(typ);
+ typtup = (Form_pg_type) GETSTRUCT(typ);
- return (typtup->typrelid);
+ return typtup->typrelid;
}
Oid
typeidTypElem(Oid type_id)
{
HeapTuple typeTuple;
- TypeTupleForm type;
+ Form_pg_type type;
if (!(typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
0, 0, 0)))
elog(ERROR, "type id lookup of %u failed", type_id);
- type = (TypeTupleForm) GETSTRUCT(typeTuple);
+ type = (Form_pg_type) GETSTRUCT(typeTuple);
- return (type->typelem);
+ return type->typelem;
}
/* Given the attribute type of an array return the arrtribute type of
GetArrayElementType(Oid typearray)
{
HeapTuple type_tuple;
- TypeTupleForm type_struct_array;
+ Form_pg_type type_struct_array;
type_tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(typearray),
typearray);
/* get the array type struct from the type tuple */
- type_struct_array = (TypeTupleForm) GETSTRUCT(type_tuple);
+ type_struct_array = (Form_pg_type) GETSTRUCT(type_tuple);
if (type_struct_array->typelem == InvalidOid)
{
type_struct_array->typname);
}
- return (type_struct_array->typelem);
+ return type_struct_array->typelem;
}
/* Given a type id, returns the in-conversion function of the type */
typeidInfunc(Oid type_id)
{
HeapTuple typeTuple;
- TypeTupleForm type;
+ Form_pg_type type;
Oid infunc;
typeTuple = SearchSysCacheTuple(TYPOID,
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "typeidInfunc: Invalid type - oid = %u", type_id);
- type = (TypeTupleForm) GETSTRUCT(typeTuple);
+ type = (Form_pg_type) GETSTRUCT(typeTuple);
infunc = type->typinput;
- return (infunc);
+ return infunc;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.34 1998/06/15 19:28:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.35 1998/09/01 03:24:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
clearerr(stdin);
if (yyresult) /* error */
- return ((QueryTreeList *) NULL);
+ return (QueryTreeList *) NULL;
queryList = parse_analyze(parsetree, NULL);
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.25 1998/08/30 23:25:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.26 1998/09/01 03:24:22 momjian Exp $
*/
#define FLEX_SCANNER
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.25 1998/08/30 23:25:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.26 1998/09/01 03:24:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
yylval.ival = strtol((char *)literal,&endptr,2);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad binary integer input '%s'",literal);
- return (ICONST);
+ return ICONST;
}
YY_BREAK
case 9:
yylval.ival = strtol((char *)literal,&endptr,16);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad hexadecimal integer input '%s'",literal);
- return (ICONST);
+ return ICONST;
}
YY_BREAK
case 15:
{
BEGIN(INITIAL);
yylval.str = pstrdup(scanstr(literal));
- return (SCONST);
+ return SCONST;
}
YY_BREAK
case 17:
{
BEGIN(INITIAL);
yylval.str = pstrdup(literal);
- return (IDENT);
+ return IDENT;
}
YY_BREAK
case 24:
#line 287 "scan.l"
{
BEGIN(INITIAL);
- return (yytext[0]);
+ return yytext[0];
}
YY_BREAK
case 27:
#line 295 "scan.l"
{
BEGIN(xm);
- return (yytext[0]);
+ return yytext[0];
}
YY_BREAK
case 29:
YY_RULE_SETUP
#line 299 "scan.l"
-{ return (yytext[0]); }
+{ return yytext[0]; }
+{ return yytext[0]; }
YY_BREAK
case 30:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
#line 300 "scan.l"
{
yylval.str = pstrdup((char*)yytext);
- return (Op);
+ return Op;
}
YY_BREAK
case 31:
yylval.str = pstrdup("<>"); /* compatability */
else
yylval.str = pstrdup((char*)yytext);
- return (Op);
+ return Op;
}
YY_BREAK
case 32:
#line 311 "scan.l"
{
yylval.ival = atoi((char*)&yytext[1]);
- return (PARAM);
+ return PARAM;
}
YY_BREAK
case 33:
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
yylval.str = pstrdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
YY_BREAK
elog(ERROR,"Bad integer input '%s'",yytext);
CheckFloat8Val(yylval.dval);
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
YY_BREAK
case 35:
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad float8 input '%s'",yytext);
CheckFloat8Val(yylval.dval);
- return (FCONST);
+ return FCONST;
}
YY_BREAK
case 36:
elog(ERROR,"Bad integer input '%s'",yytext);
CheckFloat8Val(yylval.dval);
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
YY_BREAK
case 37:
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad float input '%s'",yytext);
CheckFloat8Val(yylval.dval);
- return (FCONST);
+ return FCONST;
}
YY_BREAK
case 38:
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
yylval.str = pstrdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
YY_BREAK
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.42 1998/08/29 05:27:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.43 1998/09/01 03:24:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
yylval.ival = strtol((char *)literal,&endptr,2);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad binary integer input '%s'",literal);
- return (ICONST);
+ return ICONST;
}
{xhinside} |
{xbinside} {
yylval.ival = strtol((char *)literal,&endptr,16);
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad hexadecimal integer input '%s'",literal);
- return (ICONST);
+ return ICONST;
}
{xqstart} {
{xqstop} {
BEGIN(INITIAL);
yylval.str = pstrdup(scanstr(literal));
- return (SCONST);
+ return SCONST;
}
{xqdouble} |
{xqinside} {
{xdstop} {
BEGIN(INITIAL);
yylval.str = pstrdup(literal);
- return (IDENT);
+ return IDENT;
}
{xdinside} {
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
{space}* { /* ignore */ }
{xmstop} {
BEGIN(INITIAL);
- return (yytext[0]);
+ return yytext[0];
}
{self}/{space}*-[\.0-9] {
BEGIN(xm);
- return (yytext[0]);
+ return yytext[0];
}
-{self} { return (yytext[0]); }
+{self} { return yytext[0]; }
+{self} { return yytext[0]; }
{operator}/-[\.0-9] {
yylval.str = pstrdup((char*)yytext);
- return (Op);
+ return Op;
}
{operator} {
if (strcmp((char*)yytext,"!=") == 0)
yylval.str = pstrdup("<>"); /* compatability */
else
yylval.str = pstrdup((char*)yytext);
- return (Op);
+ return Op;
}
{param} {
yylval.ival = atoi((char*)&yytext[1]);
- return (PARAM);
+ return PARAM;
}
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
yylval.str = pstrdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
{integer}/{space}*-{number} {
elog(ERROR,"Bad integer input '%s'",yytext);
CheckFloat8Val(yylval.dval);
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
{real}/{space}*-{number} {
char* endptr;
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad float8 input '%s'",yytext);
CheckFloat8Val(yylval.dval);
- return (FCONST);
+ return FCONST;
}
{integer} {
char* endptr;
elog(ERROR,"Bad integer input '%s'",yytext);
CheckFloat8Val(yylval.dval);
elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
{real} {
char* endptr;
if (*endptr != '\0' || errno == ERANGE)
elog(ERROR,"Bad float input '%s'",yytext);
CheckFloat8Val(yylval.dval);
- return (FCONST);
+ return FCONST;
}
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
yylval.str = pstrdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
{space} { /* ignore */ }
-{other} { return (yytext[0]); }
+{other} { return yytext[0]; }
%%
strcpy(ret, error_message);
error_message[0] = 0;
- return ((ret[0] == 0) ? (char *) NULL : ret);
+ return (ret[0] == 0) ? (char *) NULL : ret;
}
void *
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
sprintf(error_message, "dlopen (%s) failed", file);
- return (vp);
+ return vp;
#endif
}
}
if ((vp = dlsym(handle, (char *) name)) == (void *) NULL)
sprintf(error_message, "dlsym (%s) failed", name);
- return (vp);
+ return vp;
#endif
}
#include "utils/elog.h"
#include "fmgr.h"
-extern char pg_pathname[];
+extern char *pg_pathname;
void *
pg_dlopen(char *filename)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.4 1998/06/15 19:28:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.5 1998/09/01 03:24:39 momjian Exp $
*
* NOTES
* all functions are defined here -- it's impossible to trace the
{
shl_t handle = shl_load(filename, BIND_DEFERRED, 0);
- return ((void *) handle);
+ return (void *) handle;
}
func_ptr
if (shl_findsym((shl_t *) & handle, funcname, TYPE_PROCEDURE, &f) == -1)
f = (func_ptr) NULL;
- return (f);
+ return f;
}
void
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.8 1998/06/15 19:28:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.9 1998/09/01 03:24:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "fmgr.h"
#if FALSE
-extern char pg_pathname[];
+extern char *pg_pathname;
void *
pg_dlopen(char *filename)
{
#ifndef HAVE_DLD_H
elog(ERROR, "dynamic load not supported");
- return (NULL);
+ return NULL;
#else
static int dl_initialized = 0;
pg_dlerror()
{
#ifndef HAVE_DLD_H
- return ("dynaloader unspported");
+ return "dynaloader unspported";
#else
return dld_strerror(dld_errno);
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/ultrix4.c,v 1.2 1998/06/15 19:28:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/ultrix4.c,v 1.3 1998/09/01 03:24:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "port-protos.h"
#include "utils/elog.h"
-extern char pg_pathname[];
+extern char *pg_pathname;
void *
pg_dlopen(char *filename)
-/* $Id: gethostname.c,v 1.3 1998/01/15 20:54:34 scrappy Exp $ */
+/* $Id: gethostname.c,v 1.4 1998/09/01 03:24:25 momjian Exp $ */
#include
#include
}
strncpy(name, mname.nodename, (SYS_NMLN < namelen ? SYS_NMLN : namelen));
- return (0);
+ return 0;
}
-/* $Id: getrusage.c,v 1.9 1998/07/13 16:39:07 momjian Exp $ */
+/* $Id: getrusage.c,v 1.10 1998/09/01 03:24:26 momjian Exp $ */
#include
#include "rusagestub.h"
if (rusage == (struct rusage *) NULL)
{
errno = EFAULT;
- return (-1);
+ return -1;
}
if (times(&tms) < 0)
{
/* errno set by times */
- return (-1);
+ return -1;
}
switch (who)
{
break;
default:
errno = EINVAL;
- return (-1);
+ return -1;
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate);
rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate);
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
- return (0);
+ return 0;
}
-/* $Id: inet_aton.c,v 1.14 1998/02/26 04:34:04 momjian Exp $
+/* $Id: inet_aton.c,v 1.15 1998/09/01 03:24:28 momjian Exp $
*
* This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this
* 16-bits) a.b (with b treated as 24 bits)
*/
if (pp >= parts + 3 || val > 0xff)
- return (0);
+ return 0;
*pp++ = val, cp++;
}
else
* Check for trailing characters.
*/
if (*cp && (!isascii(*cp) || !isspace(*cp)))
- return (0);
+ return 0;
/*
* Concoct the address according to the number of parts specified.
case 2: /* a.b -- 8.24 bits */
if (val > 0xffffff)
- return (0);
+ return 0;
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
if (val > 0xffff)
- return (0);
+ return 0;
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
if (val > 0xff)
- return (0);
+ return 0;
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
}
if (addr)
addr->s_addr = htonl(val);
- return (1);
+ return 1;
}
-/* $Id: isinf.c,v 1.5 1998/03/01 04:53:54 scrappy Exp $ */
+/* $Id: isinf.c,v 1.6 1998/09/01 03:24:29 momjian Exp $ */
#include
#include "config.h"
{
case FP_NINF:
case FP_PINF:
- return (1);
+ return 1;
default:
break;
}
- return (0);
+ return 0;
}
#else
#endif
if (fpclass == FP_POS_INF)
- return (1);
+ return 1;
if (fpclass == FP_NEG_INF)
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
#endif
int fpclass = class(x);
if (fpclass == FP_PLUS_INF)
- return (1);
+ return 1;
if (fpclass == FP_MINUS_INF)
- return (-1);
- return (0);
+ return -1;
+ return 0;
}
#endif
int
sigemptyset(int *set)
{
- return (*set = 0);
+ return *set = 0;
}
char *
-/* $Id: random.c,v 1.4 1998/02/26 04:34:11 momjian Exp $ */
+/* $Id: random.c,v 1.5 1998/09/01 03:24:30 momjian Exp $ */
#include /* for pow() prototype */
long
random()
{
- return (lrand48());
+ return lrand48();
}
static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: snprintf.c,v 1.1 1998/08/01 19:30:28 scrappy Exp $";
+ "$Id: snprintf.c,v 1.2 1998/09/01 03:24:31 momjian Exp $";
#endif /* LIBC_SCCS and not lint */
#include
if (on > 0)
*f._p = '\0';
va_end(ap);
- return (ret);
+ return ret;
}
-/* $Id: strerror.c,v 1.4 1997/12/19 13:34:32 scrappy Exp $ */
+/* $Id: strerror.c,v 1.5 1998/09/01 03:24:33 momjian Exp $ */
/*
* strerror - map error number to descriptive string
if (errnum < 0 || errnum > sys_nerr)
{
sprintf(buf, "unknown error %d", errnum);
- return (buf);
+ return buf;
}
- return (sys_errlist[errnum]);
+ return sys_errlist[errnum];
}
acc = -acc;
if (endptr != 0)
*endptr = any ? s - 1 : (char *) nptr;
- return (acc);
+ return acc;
}
acc = -acc;
if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr);
- return (acc);
+ return acc;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.95 1998/08/25 21:33:59 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.96 1998/09/01 03:24:45 momjian Exp $
*
* NOTES
*
continue;
fprintf(stderr, "%s: ServerLoop: select failed\n",
progname);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/*
nsocks = ServerSock_INET;
}
- return (nsocks + 1);
+ return nsocks + 1;
}
{
fprintf(stderr, "%s: BackendStartup: fork failed\n",
progname);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (DebugLvl)
ActiveBackends = TRUE;
- return (STATUS_OK);
+ return STATUS_OK;
}
/*
ch = ch % 62;
if (ch < 26)
- return ('A' + ch);
+ return 'A' + ch;
ch -= 26;
if (ch < 26)
- return ('a' + ch);
+ return 'a' + ch;
ch -= 26;
- return ('0' + ch);
+ return '0' + ch;
}
/*
/* === engine.c === */
static int
matcher(struct re_guts * g, pg_wchar *string, size_t nmatch,
- regmatch_t pmatch[], int eflags);
+ regmatch_t *pmatch, int eflags);
static pg_wchar *
dissect(struct match * m, pg_wchar *start, pg_wchar *stop,
sopno startst, sopno stopst);
/*
- matcher - the actual matching engine
== static int matcher(struct re_guts *g, pg_wchar *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
+ == size_t nmatch, regmatch_t *pmatch, int eflags);
*/
static int /* 0 success, REG_NOMATCH failure */
matcher(g, string, nmatch, pmatch, eflags)
struct re_guts *g;
pg_wchar *string;
size_t nmatch;
-regmatch_t pmatch[];
+regmatch_t *pmatch;
int eflags;
{
pg_wchar *endp;
#endif
}
if (stop < start)
- return (REG_INVARG);
+ return REG_INVARG;
/* prescreening; this does wonders for this rather slow code */
if (g->must != NULL)
#endif
break;
if (dp == stop) /* we didn't find g->must */
- return (REG_NOMATCH);
+ return REG_NOMATCH;
}
/* match struct setup */
if (endp == NULL)
{ /* a miss */
STATETEARDOWN(m);
- return (REG_NOMATCH);
+ return REG_NOMATCH;
}
if (nmatch == 0 && !g->backrefs)
break; /* no further info needed */
if (m->pmatch == NULL)
{
STATETEARDOWN(m);
- return (REG_ESPACE);
+ return REG_ESPACE;
}
for (i = 1; i <= m->g->nsub; i++)
m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
{
free(m->pmatch);
STATETEARDOWN(m);
- return (REG_ESPACE);
+ return REG_ESPACE;
}
NOTE("backref dissect");
dp = backref(m, m->coldp, endp, gf, gl, (sopno) 0);
if (m->lastpos != NULL)
free((pg_wchar *) m->lastpos);
STATETEARDOWN(m);
- return (0);
+ return 0;
}
/*
}
assert(sp == stop);
- return (sp);
+ return sp;
}
/*
{
case OCHAR:
if (sp == stop || *sp++ != (pg_wchar) OPND(s))
- return (NULL);
+ return NULL;
break;
case OANY:
if (sp == stop)
- return (NULL);
+ return NULL;
sp++;
break;
case OANYOF:
cs = &m->g->sets[OPND(s)];
if (sp == stop || !CHIN(cs, *sp++))
- return (NULL);
+ return NULL;
break;
case OBOL:
if ((sp == m->beginp && !(m->eflags & REG_NOTBOL)) ||
{ /* yes */
}
else
- return (NULL);
+ return NULL;
break;
case OEOL:
if ((sp == m->endp && !(m->eflags & REG_NOTEOL)) ||
{ /* yes */
}
else
- return (NULL);
+ return NULL;
break;
case OBOW:
if (((sp == m->beginp && !(m->eflags & REG_NOTBOL)) ||
{ /* yes */
}
else
- return (NULL);
+ return NULL;
break;
case OEOW:
if (((sp == m->endp && !(m->eflags & REG_NOTEOL)) ||
{ /* yes */
}
else
- return (NULL);
+ return NULL;
break;
case O_QUEST:
break;
if (!hard)
{ /* that was it! */
if (sp != stop)
- return (NULL);
- return (sp);
+ return NULL;
+ return sp;
}
ss--; /* adjust for the for's final increment */
i = OPND(s);
assert(0 < i && i <= m->g->nsub);
if (m->pmatch[i].rm_eo == -1)
- return (NULL);
+ return NULL;
assert(m->pmatch[i].rm_so != -1);
len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
assert(stop - m->beginp >= len);
if (sp > stop - len)
- return (NULL); /* not enough left to match */
+ return NULL; /* not enough left to match */
ssp = m->offp + m->pmatch[i].rm_so;
if (memcmp(sp, ssp, len) != 0)
- return (NULL);
+ return NULL;
while (m->g->strip[ss] != SOP(O_BACK, i))
ss++;
- return (backref(m, sp + len, stop, ss + 1, stopst, lev));
+ return backref(m, sp + len, stop, ss + 1, stopst, lev);
break;
case OQUEST_: /* to null or not */
dp = backref(m, sp, stop, ss + 1, stopst, lev);
if (dp != NULL)
- return (dp); /* not */
- return (backref(m, sp, stop, ss + OPND(s) + 1, stopst, lev));
+ return dp; /* not */
+ return backref(m, sp, stop, ss + OPND(s) + 1, stopst, lev);
break;
case OPLUS_:
assert(m->lastpos != NULL);
assert(lev + 1 <= m->g->nplus);
m->lastpos[lev + 1] = sp;
- return (backref(m, sp, stop, ss + 1, stopst, lev + 1));
+ return backref(m, sp, stop, ss + 1, stopst, lev + 1);
break;
case O_PLUS:
if (sp == m->lastpos[lev]) /* last pass matched null */
- return (backref(m, sp, stop, ss + 1, stopst, lev - 1));
+ return backref(m, sp, stop, ss + 1, stopst, lev - 1);
/* try another pass */
m->lastpos[lev] = sp;
dp = backref(m, sp, stop, ss - OPND(s) + 1, stopst, lev);
if (dp == NULL)
- return (backref(m, sp, stop, ss + 1, stopst, lev - 1));
+ return backref(m, sp, stop, ss + 1, stopst, lev - 1);
else
- return (dp);
+ return dp;
break;
case OCH_: /* find the right one, if any */
ssub = ss + 1;
{ /* find first matching branch */
dp = backref(m, sp, stop, ssub, esub, lev);
if (dp != NULL)
- return (dp);
+ return dp;
/* that one missed, try next one */
if (OP(m->g->strip[esub]) == O_CH)
- return (NULL); /* there is none */
+ return NULL; /* there is none */
esub++;
assert(OP(m->g->strip[esub]) == OOR2);
ssub = esub + 1;
m->pmatch[i].rm_so = sp - m->offp;
dp = backref(m, sp, stop, ss + 1, stopst, lev);
if (dp != NULL)
- return (dp);
+ return dp;
m->pmatch[i].rm_so = offsave;
- return (NULL);
+ return NULL;
break;
case ORPAREN: /* must undo assignment if rest fails */
i = OPND(s);
m->pmatch[i].rm_eo = sp - m->offp;
dp = backref(m, sp, stop, ss + 1, stopst, lev);
if (dp != NULL)
- return (dp);
+ return dp;
m->pmatch[i].rm_eo = offsave;
- return (NULL);
+ return NULL;
break;
default: /* uh oh */
assert(nope);
assert(coldp != NULL);
m->coldp = coldp;
if (ISSET(st, stopst))
- return (p + 1);
+ return p + 1;
else
- return (NULL);
+ return NULL;
}
/*
p++;
}
- return (matchp);
+ return matchp;
}
}
}
- return (aft);
+ return aft;
}
#ifdef REDEBUG
sprintf(pbuf, "%c", ch);
else
sprintf(pbuf, "\\%o", ch);
- return (pbuf);
+ return pbuf;
}
#endif
cflags = GOODFLAGS(cflags);
if ((cflags & REG_EXTENDED) && (cflags & REG_NOSPEC))
- return (REG_INVARG);
+ return REG_INVARG;
if (cflags & REG_PEND)
{
#ifdef MULTIBYTE
wcp = preg->patsave;
if (preg->re_endp < wcp)
- return (REG_INVARG);
+ return REG_INVARG;
len = preg->re_endp - wcp;
#else
if (preg->re_endp < pattern)
- return (REG_INVARG);
+ return REG_INVARG;
len = preg->re_endp - pattern;
#endif
}
#ifdef MULTIBYTE
wcp = (pg_wchar *)malloc((strlen(pattern)+1) * sizeof(pg_wchar));
if (wcp == NULL) {
- return (REG_ESPACE);
+ return REG_ESPACE;
}
preg->patsave = wcp;
(void)pg_mb2wchar((unsigned char *)pattern,wcp);
g = (struct re_guts *) malloc(sizeof(struct re_guts) +
(NC - 1) * sizeof(cat_t));
if (g == NULL)
- return (REG_ESPACE);
+ return REG_ESPACE;
p->ssize = len / (size_t) 2 *(size_t) 3 + (size_t) 1; /* ugh */
p->strip = (sop *) malloc(p->ssize * sizeof(sop));
if (p->strip == NULL)
{
free((char *) g);
- return (REG_ESPACE);
+ return REG_ESPACE;
}
/* set things up */
/* win or lose, we're done */
if (p->error != 0) /* lose */
pg95_regfree(preg);
- return (p->error);
+ return p->error;
}
/*
}
}
else if (c == (unsigned char) '$') /* $ (but not \$) ends it */
- return (1);
+ return 1;
- return (0);
+ return 0;
}
/*
}
REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return (count);
+ return count;
}
/*
REQUIRE(MORE(), REG_EBRACK);
if (!EATTWO('[', '.'))
- return (GETNEXT());
+ return GETNEXT();
/* collating symbol */
value = p_b_coll_elem(p, '.');
REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
- return (value);
+ return value;
}
/*
if (!MORE())
{
SETERROR(REG_EBRACK);
- return (0);
+ return 0;
}
len = p->next - sp;
for (cp = cnames; cp->name != NULL; cp++)
#else
if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
#endif
- return (cp->code); /* known name */
+ return cp->code; /* known name */
if (len == 1)
- return (*sp); /* single character */
+ return *sp; /* single character */
SETERROR(REG_ECOLLATE); /* neither */
- return (0);
+ return 0;
}
/*
{
assert(pg_isalpha(ch));
if (pg_isupper(ch))
- return (tolower(ch));
+ return tolower(ch);
else if (pg_islower(ch))
- return (toupper(ch));
+ return toupper(ch);
else
/* peculiar, but could happen */
- return (ch);
+ return ch;
}
/*
p->error = e;
p->next = nuls; /* try to bring things to a halt */
p->end = nuls;
- return (0); /* make the return value well-defined */
+ return 0; /* make the return value well-defined */
}
/*
cs->smultis = 0;
cs->multis = NULL;
- return (cs);
+ return cs;
}
/*
cs = cs2;
}
- return ((int) (cs - p->g->sets));
+ return (int) (cs - p->g->sets);
}
/*
for (i = 0; i < css; i++)
if (CHIN(cs, i))
- return (i);
+ return i;
assert(never);
- return (0); /* arbitrary */
+ return 0; /* arbitrary */
}
/*
for (i = 0; i < css; i++)
if (CHIN(cs, i))
n++;
- return (n);
+ return n;
}
/*
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
if (col[uc] != 0)
- return (1);
- return (0);
+ return 1;
+ return 0;
}
/*
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
if (col[uc1] != col[uc2])
- return (0);
- return (1);
+ return 0;
+ return 1;
}
/*
assert(finish >= start);
if (len == 0)
- return (ret);
+ return ret;
enlarge(p, p->ssize + len); /* this many unexpected additions */
assert(p->ssize >= p->slen + len);
memcpy((char *) (p->strip + p->slen),
(char *) (p->strip + start), (size_t) len * sizeof(sop));
p->slen += len;
- return (ret);
+ return ret;
}
/*
sopno maxnest = 0;
if (p->error != 0)
- return (0); /* there may not be an OEND */
+ return 0; /* there may not be an OEND */
scan = g->strip + 1;
do
} while (OP(s) != OEND);
if (plusnest != 0)
g->iflags |= BAD;
- return (maxnest);
+ return maxnest;
}
/*
}
}
- return (len);
+ return len;
}
/*
#endif
break;
if (r->code == 0)
- return ("0");
+ return "0";
sprintf(localbuf, "%d", r->code);
- return (localbuf);
+ return localbuf;
}
const regex_t *preg;
const char *string;
size_t nmatch;
-regmatch_t pmatch[];
+regmatch_t *pmatch;
int eflags;
{
struct re_guts *g = preg->re_g;
#endif
if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return (REG_BADPAT);
+ return REG_BADPAT;
assert(!(g->iflags & BAD));
if (g->iflags & BAD) /* backstop for no-debug case */
- return (REG_BADPAT);
+ return REG_BADPAT;
eflags = GOODFLAGS(eflags);
#ifdef MULTIBYTE
# else
if (g->nstates <= CHAR_BIT * sizeof(states1) && !(eflags & REG_LARGE))
- return (smatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags));
+ return smatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags);
else
- return (lmatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags));
+ return lmatcher(g, (pg_wchar *) string, nmatch, pmatch, eflags);
#endif
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.11 1998/08/24 01:37:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.12 1998/09/01 03:24:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
default:
break;
}
- return (FALSE);
+ return FALSE;
}
/*
if (parsetree->commandType != CMD_SELECT)
{
if (parsetree->resultRelation != varno)
- return (NULL);
+ return NULL;
}
nlocks = rulelocks->numLocks;
checkLockPerms(real_locks, parsetree, varno);
- return (real_locks);
+ return real_locks;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.19 1998/08/24 01:37:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.20 1998/09/01 03:24:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
pg_exec_query_acl_override(rulebuf);
- return (LastOidProcessed);
+ return LastOidProcessed;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.15 1998/07/19 05:49:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.16 1998/09/01 03:24:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
TargetEntry *tle = lfirst(i);
if (tle->resdom->resno == attno)
- return (tle->expr);
+ return tle->expr;
}
return NULL;
}
resname = tle->resdom->resname;
if (!strcmp(e_attname, resname))
- return (tle->expr);
+ return tle->expr;
}
return NULL;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.16 1998/08/19 02:02:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.17 1998/09/01 03:24:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ruleId = tuple->t_oid;
eventRelationOidDatum = heap_getattr(tuple,
Anum_pg_rewrite_ev_class,
- RelationGetTupleDescriptor(RewriteRelation),
+ RelationGetDescr(RewriteRelation),
&isNull);
if (isNull)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.26 1998/08/24 01:38:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.27 1998/09/01 03:24:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Node *rule_evqual = NULL;
ruleRelation = heap_openr(RewriteRelationName);
- ruleTupdesc = RelationGetTupleDescriptor(ruleRelation);
+ ruleTupdesc = RelationGetDescr(ruleRelation);
ruletuple = SearchSysCacheTuple(RULOID,
ObjectIdGetDatum(ruleoid),
0, 0, 0);
* return whether or not the rewrite rule existed
*/
heap_close(RewriteRelation);
- return (HeapTupleIsValid(tuple));
+ return HeapTupleIsValid(tuple);
}
static void
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_table.c,v 1.12 1998/06/30 19:09:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_table.c,v 1.13 1998/09/01 03:25:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bool found;
if (tagPtr->blockNum == P_NEW)
- return (NULL);
+ return NULL;
result = (LookupEnt *)
hash_search(SharedBufHash, (char *) tagPtr, HASH_FIND, &found);
if (!result)
{
elog(ERROR, "BufTableLookup: BufferLookup table corrupted");
- return (NULL);
+ return NULL;
}
if (!found)
- return (NULL);
- return (&(BufferDescriptors[result->id]));
+ return NULL;
+ return &(BufferDescriptors[result->id]);
}
/*
* BM_DELETED keeps us from removing buffer twice.
*/
if (buf->flags & BM_DELETED)
- return (TRUE);
+ return TRUE;
buf->flags |= BM_DELETED;
if (!(result && found))
{
elog(ERROR, "BufTableDelete: BufferLookup table corrupted");
- return (FALSE);
+ return FALSE;
}
- return (TRUE);
+ return TRUE;
}
bool
{
Assert(0);
elog(ERROR, "BufTableInsert: BufferLookup table corrupted");
- return (FALSE);
+ return FALSE;
}
/* found something else in the table ! */
if (found)
{
Assert(0);
elog(ERROR, "BufTableInsert: BufferLookup table corrupted");
- return (FALSE);
+ return FALSE;
}
result->id = buf->buf_id;
- return (TRUE);
+ return TRUE;
}
/* prints out collision stats for the buf table */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.41 1998/08/19 02:02:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.42 1998/09/01 03:25:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bufHdr->tag.relId.dbId == lrelId->dbId)
{
SpinRelease(BufMgrLock);
- return (buffer);
+ return buffer;
}
- return (ReadBufferWithBufferLock(relation, blockNumber, true));
+ return ReadBufferWithBufferLock(relation, blockNumber, true);
}
else
{
bufHdr = &LocalBufferDescriptors[-buffer - 1];
if (bufHdr->tag.relId.relId == RelationGetRelid(relation) &&
bufHdr->tag.blockNum == blockNumber)
- return (buffer);
+ return buffer;
}
}
- return (ReadBuffer(relation, blockNumber));
+ return ReadBuffer(relation, blockNumber);
}
/*
}
if (!bufHdr)
- return (InvalidBuffer);
+ return InvalidBuffer;
/* if its already in the buffer pool, we're done */
if (found)
smgrextend(DEFAULT_SMGR, reln,
(char *) MAKE_PTR(bufHdr->data));
}
- return (BufferDescriptorGetBuffer(bufHdr));
+ return BufferDescriptorGetBuffer(bufHdr);
}
}
if (isLocalBuf)
- return (BufferDescriptorGetBuffer(bufHdr));
+ return BufferDescriptorGetBuffer(bufHdr);
/* lock buffer manager again to update IO IN PROGRESS */
SpinAcquire(BufMgrLock);
SpinRelease(BufMgrLock);
if (status == SM_FAIL)
- return (InvalidBuffer);
+ return InvalidBuffer;
- return (BufferDescriptorGetBuffer(bufHdr));
+ return BufferDescriptorGetBuffer(bufHdr);
}
/*
SpinRelease(BufMgrLock);
- return (buf);
+ return buf;
}
*foundPtr = FALSE;
* again.
*/
if (buf == NULL)
- return (NULL);
+ return NULL;
/*
* There should be exactly one pin on the buffer after it is
SpinRelease(BufMgrLock);
- return (buf2);
+ return buf2;
}
}
}
SpinRelease(BufMgrLock);
- return (buf);
+ return buf;
}
/*
BufferDesc *bufHdr;
if (WriteMode == BUFFER_FLUSH_WRITE)
- return (FlushBuffer(buffer, TRUE));
+ return FlushBuffer(buffer, TRUE);
else
{
return WriteLocalBuffer(buffer, TRUE);
if (BAD_BUFFER_ID(buffer))
- return (FALSE);
+ return FALSE;
bufHdr = &BufferDescriptors[buffer - 1];
SpinRelease(BufMgrLock);
CommitInfoNeedsSave[buffer - 1] = 0;
}
- return (TRUE);
+ return TRUE;
}
#ifdef NOT_USED
return FlushLocalBuffer(buffer, release);
if (BAD_BUFFER_ID(buffer))
- return (STATUS_ERROR);
+ return STATUS_ERROR;
bufHdr = &BufferDescriptors[buffer - 1];
bufdb = bufHdr->tag.relId.dbId;
{
elog(ERROR, "FlushBuffer: cannot flush block %u of the relation %s",
bufHdr->tag.blockNum, bufHdr->sb_relname);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
BufferFlushCount++;
SpinRelease(BufMgrLock);
CommitInfoNeedsSave[buffer - 1] = 0;
- return (STATUS_OK);
+ return STATUS_OK;
}
/*
BufferDesc *bufHdr;
if (WriteMode == BUFFER_FLUSH_WRITE)
- return (FlushBuffer(buffer, FALSE));
+ return FlushBuffer(buffer, FALSE);
else
{
return WriteLocalBuffer(buffer, FALSE);
if (BAD_BUFFER_ID(buffer))
- return (STATUS_ERROR);
+ return STATUS_ERROR;
bufHdr = &BufferDescriptors[buffer - 1];
SpinRelease(BufMgrLock);
CommitInfoNeedsSave[buffer - 1] = 0;
}
- return (STATUS_OK);
+ return STATUS_OK;
}
}
}
- return (ReadBuffer(relation, blockNum));
+ return ReadBuffer(relation, blockNum);
}
/*
if (error)
{
PrintBufferDescs();
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
/* ------------------------------------------------
/* XXX should be a critical section */
if (BufferIsLocal(buffer))
- return (LocalBufferDescriptors[-buffer - 1].tag.blockNum);
+ return LocalBufferDescriptors[-buffer - 1].tag.blockNum;
else
- return (BufferDescriptors[buffer - 1].tag.blockNum);
+ return BufferDescriptors[buffer - 1].tag.blockNum;
}
/*
RelationIncrementReferenceCount(relation);
}
- return (relation);
+ return relation;
}
/*
RelationDecrementReferenceCount(reln);
if (status == SM_FAIL)
- return (FALSE);
+ return FALSE;
BufferFlushCount++;
- return (TRUE);
+ return TRUE;
}
/*
{
elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is dirty",
rel->rd_rel->relname.data, block, buf->tag.blockNum);
- return (-1);
+ return -1;
}
if (LocalRefCount[i] > 0)
{
elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is referenced (%d)",
rel->rd_rel->relname.data, block,
buf->tag.blockNum, LocalRefCount[i]);
- return (-2);
+ return -2;
}
buf->tag.relId.relId = InvalidOid;
}
}
- return (0);
+ return 0;
}
SpinAcquire(BufMgrLock);
buf->sb_relname, block, buf->tag.blockNum,
PrivateRefCount[i], LastRefCount[i], buf->refcount);
SpinRelease(BufMgrLock);
- return (-1);
+ return -1;
}
if (!(buf->flags & BM_FREE))
{
buf->sb_relname, block, buf->tag.blockNum,
PrivateRefCount[i], LastRefCount[i], buf->refcount);
SpinRelease(BufMgrLock);
- return (-2);
+ return -2;
}
BufTableDelete(buf);
}
}
SpinRelease(BufMgrLock);
- return (0);
+ return 0;
}
#undef ReleaseBuffer
{
Assert(LocalRefCount[-buffer - 1] > 0);
LocalRefCount[-buffer - 1]--;
- return (STATUS_OK);
+ return STATUS_OK;
}
if (BAD_BUFFER_ID(buffer))
- return (STATUS_ERROR);
+ return STATUS_ERROR;
bufHdr = &BufferDescriptors[buffer - 1];
SpinRelease(BufMgrLock);
}
- return (STATUS_OK);
+ return STATUS_OK;
}
#ifdef NOT_USED
old = WriteMode;
WriteMode = mode;
- return (old);
+ return old;
}
void
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.11 1998/06/15 19:29:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/freelist.c,v 1.12 1998/09/01 03:25:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* queue is empty. All buffers in the buffer pool are pinned. */
elog(ERROR, "out of free buffers: time to abort !\n");
- return (NULL);
+ return NULL;
}
buf = &(BufferDescriptors[SharedFreeList->freeNext]);
buf->flags &= ~(BM_FREE);
- return (buf);
+ return buf;
}
/*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Id: fd.c,v 1.32 1998/06/15 19:29:11 momjian Exp $
+ * $Id: fd.c,v 1.33 1998/09/01 03:25:06 momjian Exp $
*
* NOTES:
*
{
DO_DB(elog(DEBUG, "RE_OPEN FAILED: %d",
errno));
- return (vfdP->fd);
+ return vfdP->fd;
}
else
{
Insert(file);
- return (0);
+ return 0;
}
static void
printf("filepath: path is %s\n", buf);
#endif
- return (buf);
+ return buf;
}
static int
Insert(file);
}
- return (0);
+ return 0;
}
/*
fname = filepath(fileName);
fd = fileNameOpenFile(fname, fileFlags, fileMode);
pfree(fname);
- return (fd);
+ return fd;
}
/*
File
PathNameOpenFile(FileName fileName, int fileFlags, int fileMode)
{
- return (fileNameOpenFile(fileName, fileFlags, fileMode));
+ return fileNameOpenFile(fileName, fileFlags, fileMode);
}
void
return returnCode;
}
/* NOTREACHED */
- return (-1L);
+ return -1L;
}
/*
FileSync(file);
FileAccess(file);
returnCode = ftruncate(VfdCache[file].fd, offset);
- return (returnCode);
+ return returnCode;
}
int
fname = filepath(filename);
retval = unlink(fname);
pfree(fname);
- return (retval);
+ return retval;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.31 1998/08/25 21:34:01 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.32 1998/09/01 03:25:08 momjian Exp $
*
* NOTES
*
elog(ERROR, "PrivateMemoryCreate: not enough memory to malloc");
MemSet(IpcPrivateMem[memid].memptr, 0, size); /* XXX PURIFY */
- return (memid++);
+ return memid++;
}
static char *
PrivateMemoryAttach(IpcMemoryId memid)
{
- return (IpcPrivateMem[memid].memptr);
+ return IpcPrivateMem[memid].memptr;
}
on_proc_exit(void (*function) (), caddr_t arg)
{
if (on_proc_exit_index >= MAX_ON_EXITS)
- return (-1);
+ return -1;
on_proc_exit_list[on_proc_exit_index].function = function;
on_proc_exit_list[on_proc_exit_index].arg = arg;
++on_proc_exit_index;
- return (0);
+ return 0;
}
/* ----------------------------------------------------------------
on_shmem_exit(void (*function) (), caddr_t arg)
{
if (on_shmem_exit_index >= MAX_ON_EXITS)
- return (-1);
+ return -1;
on_shmem_exit_list[on_shmem_exit_index].function = function;
on_shmem_exit_list[on_shmem_exit_index].arg = arg;
++on_shmem_exit_index;
- return (0);
+ return 0;
}
/* ----------------------------------------------------------------
if (semNum > IPC_NMAXSEM || semNum <= 0)
{
*status = IpcInvalidArgument;
- return (2); /* returns the number of the invalid
+ return 2; /* returns the number of the invalid
* argument */
}
fflush(stdout);
fflush(stderr);
#endif
- return (semId);
+ return semId;
}
EPRINTF("IpcMemoryCreate: shmget failed (%s) "
"key=%d, size=%d, permission=%o",
strerror(errno), memKey, size, permission);
- return (IpcMemCreationFailed);
+ return IpcMemCreationFailed;
}
/* if (memKey == PrivateIPCKey) */
on_shmem_exit(IPCPrivateMemoryKill, (caddr_t) shmid);
- return (shmid);
+ return shmid;
}
/****************************************************************************/
EPRINTF("IpcMemoryIdGet: shmget failed (%s) "
"key=%d, size=%d, permission=%o",
strerror(errno), memKey, size, 0);
- return (IpcMemIdGetFailed);
+ return IpcMemIdGetFailed;
}
- return (shmid);
+ return shmid;
}
/****************************************************************************/
{
EPRINTF("IpcMemoryAttach: shmat failed (%s) id=%d",
strerror(errno), memId);
- return (IpcMemAttachFailed);
+ return IpcMemAttachFailed;
}
if (!UsePrivateMemory)
on_shmem_exit(IpcMemoryDetach, (caddr_t) memAddress);
- return ((char *) memAddress);
+ return (char *) memAddress;
}
bool
LockIsFree(int lockid)
{
- return (SLockArray[lockid].flag == NOLOCK);
+ return SLockArray[lockid].flag == NOLOCK;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.15 1998/06/27 15:47:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipci.c,v 1.16 1998/09/01 03:25:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
Assert(address < 32768); /* XXX */
- return (SystemPortAddressGetIPCKey(address));
+ return SystemPortAddressGetIPCKey(address);
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.29 1998/07/27 19:38:10 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.30 1998/09/01 03:25:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (sharedRegion == NULL)
{
elog(FATAL, "AttachSharedRegion: couldn't attach to shmem\n");
- return (FALSE);
+ return FALSE;
}
/* get pointers to the dimensions of shared memory */
* allocator and shmem index.
*/
if (!InitSpinLocks(ShmemBootstrap, IPCKeyGetSpinLockSemaphoreKey(key)))
- return (FALSE);
+ return FALSE;
/*
* We have just allocated additional space for two spinlocks. Now
if (!ShmemIndex)
{
elog(FATAL, "InitShmem: couldn't initialize Shmem Index");
- return (FALSE);
+ return FALSE;
}
/*
if (!result)
{
elog(FATAL, "InitShmem: corrupted shmem index");
- return (FALSE);
+ return FALSE;
}
if (!found)
Assert(result->location == MAKE_OFFSET(ShmemIndex->hctl));
- return (TRUE);
+ return TRUE;
}
/*
if (!newSpace)
elog(NOTICE, "ShmemAlloc: out of memory ");
- return (newSpace);
+ return newSpace;
}
/*
int
ShmemIsValid(unsigned long addr)
{
- return ((addr < ShmemEnd) && (addr >= ShmemBase));
+ return (addr < ShmemEnd) && (addr >= ShmemBase);
}
/*
* message since they have more information
*/
if (location == NULL)
- return (0);
+ return 0;
/*
* it already exists, attach to it rather than allocate and initialize
/* directory for hash lookup */
infoP->dir = (long *) (location + sizeof(HHDR));
- return (hash_create(init_size, infoP, hash_flags));;
+ return hash_create(init_size, infoP, hash_flags);;
}
/*
SpinRelease(ShmemIndexLock);
elog(ERROR, "ShmemInitPID: ShmemIndex corrupted");
- return (FALSE);
+ return FALSE;
}
result->location = *locationPtr;
SpinRelease(ShmemIndexLock);
- return (TRUE);
+ return TRUE;
}
/*
{
elog(ERROR, "ShmemPIDDestroy: PID table corrupted");
- return (INVALID_OFFSET);
+ return INVALID_OFFSET;
}
if (found)
- return (location);
+ return location;
else
- return (INVALID_OFFSET);
+ return INVALID_OFFSET;
}
/*
/* in POSTMASTER/Single process */
*foundPtr = FALSE;
- return ((long *) ShmemAlloc(size));
+ return (long *) ShmemAlloc(size);
}
else
{
Assert(ShmemIndexOffset);
*foundPtr = TRUE;
- return ((long *) MAKE_PTR(*ShmemIndexOffset));
+ return (long *) MAKE_PTR(*ShmemIndexOffset);
}
SpinRelease(ShmemIndexLock);
elog(ERROR, "ShmemInitStruct: Shmem Index corrupted");
- return (NULL);
+ return NULL;
}
else if (*foundPtr)
elog(NOTICE, "ShmemInitStruct: ShmemIndex entry size is wrong");
/* let caller print its message too */
- return (NULL);
+ return NULL;
}
structPtr = (long *) MAKE_PTR(result->location);
}
elog(NOTICE, "ShmemInitStruct: cannot allocate '%s'",
name);
- return (NULL);
+ return NULL;
}
result->size = size;
result->location = MAKE_OFFSET(structPtr);
Assert(ShmemIsValid((unsigned long) structPtr));
SpinRelease(ShmemIndexLock);
- return (structPtr);
+ return structPtr;
}
/*
if (result == (ShmemIndexEnt *) TRUE)
{
SpinRelease(ShmemIndexLock);
- return (false);
+ return false;
}
if (result->location == INVALID_OFFSET ||
strncmp(result->key, "PID ", 4) != 0)
if (proc->xid == xid)
{
SpinRelease(ShmemIndexLock);
- return (true);
+ return true;
}
}
SpinRelease(ShmemIndexLock);
elog(ERROR, "TransactionIdIsInProgress: ShmemIndex corrupted");
- return (false);
+ return false;
}
#ifdef LowLevelLocking
MyProc->xmin = snapshot->xmin;
SpinRelease(ShmemIndexLock);
snapshot->xip[count] = InvalidTransactionId;
- return (snapshot);
+ return snapshot;
}
if (result->location == INVALID_OFFSET ||
strncmp(result->key, "PID ", 4) != 0)
free(snapshot->xip);
free(snapshot);
elog(ERROR, "GetSnapshotData: ShmemIndex corrupted");
- return (NULL);
+ return NULL;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.7 1998/07/20 16:56:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmqueue.c,v 1.8 1998/09/01 03:25:13 momjian Exp $
*
* NOTES
*
SHMQueueIsDetached(SHM_QUEUE *queue)
{
Assert(SHM_PTR_VALID(queue));
- return ((queue)->prev == INVALID_OFFSET);
+ return (queue)->prev == INVALID_OFFSET;
}
#endif
if (queue->prev == MAKE_OFFSET(queue))
{
Assert(queue->next = MAKE_OFFSET(queue));
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.13 1998/08/25 21:31:18 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.14 1998/09/01 03:25:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
stateP->tag = backendTag;
- return (1 + stateP - &segInOutP->procState[0]);
+ return 1 + stateP - &segInOutP->procState[0];
}
oP->startSegment = A;
oP->offsetToFirstEntry = a; /* relatiove to A */
oP->offsetToEndOfSegemnt = totalSize; /* relative to A */
- return (oP);
+ return oP;
}
static Offset
SIGetStartEntrySection(SISeg *segP)
{
- return (segP->startEntrySection);
+ return segP->startEntrySection;
}
static Offset
SIGetEndEntryChain(SISeg *segP)
{
- return (segP->endEntryChain);
+ return segP->endEntryChain;
}
/************************************************************************/
static Offset
SIGetStartEntryChain(SISeg *segP)
{
- return (segP->startEntryChain);
+ return segP->startEntryChain;
}
/************************************************************************/
if (num <= MAXNUMMESSAGES)
{
segP->numEntries = num;
- return (true);
+ return true;
}
else
{
- return (false); /* table full */
+ return false; /* table full */
}
}
static int
SIGetNumEntries(SISeg *segP)
{
- return (segP->numEntries);
+ return segP->numEntries;
}
if (num <= MAXNUMMESSAGES)
{
segP->maxNumEntries = num;
- return (true);
+ return true;
}
else
{
- return (false); /* wrong number */
+ return false; /* wrong number */
}
}
static int
SIGetProcStateLimit(SISeg *segP, int i)
{
- return (segP->procState[i].limit);
+ return segP->procState[i].limit;
}
/************************************************************************/
if ((segP->numEntries + num) <= MAXNUMMESSAGES)
{
segP->numEntries = segP->numEntries + num;
- return (true);
+ return true;
}
else
{
- return (false); /* table full */
+ return false; /* table full */
}
}
if ((segP->numEntries - num) >= 0)
{
segP->numEntries = segP->numEntries - num;
- return (true);
+ return true;
}
else
{
- return (false); /* not enough entries in table */
+ return false; /* not enough entries in table */
}
}
static Offset
SIGetStartFreeSpace(SISeg *segP)
{
- return (segP->startFreeSpace);
+ return segP->startFreeSpace;
}
startChain = SIGetStartEntryChain(segP);
if (startChain == InvalidOffset)
- return (NULL);
+ return NULL;
eP = (SISegEntry *) ((Pointer) segP +
SIGetStartEntrySection(segP) +
startChain);
- return (eP);
+ return eP;
}
endChain = SIGetEndEntryChain(segP);
if (endChain == InvalidOffset)
- return (NULL);
+ return NULL;
eP = (SISegEntry *) ((Pointer) segP +
SIGetStartEntrySection(segP) +
endChain);
- return (eP);
+ return eP;
}
/************************************************************************/
SISegEntry *eP;
if (offset == InvalidOffset)
- return (NULL);
+ return NULL;
eP = (SISegEntry *) ((Pointer) segP +
SIGetStartEntrySection(segP) +
offset);
- return (eP);
+ return eP;
}
int i;
if (n <= 0)
- return (NULL);
+ return NULL;
eP = SIGetFirstDataEntry(segP);
for (i = 1; i < n; i++)
eP = SIGetNextDataEntry(segP, eP->next);
}
- return (eP);
+ return eP;
}
/************************************************************************/
*lastP;
if (!SIIncNumEntries(segP, 1))
- return (false); /* no space */
+ return false; /* no space */
/* get a free entry */
offsetToNewData = SIGetStartFreeSpace(segP);
lastP->next = SIEntryOffset(segP, eP);
}
SISetEndEntryChain(segP, SIEntryOffset(segP, eP));
- return (true);
+ return true;
}
if (!SIDecNumEntries(segP, 1))
{
/* no entries in buffer */
- return (false);
+ return false;
}
e1P = SIGetFirstDataEntry(segP);
e1P->next = SIGetStartFreeSpace(segP);
SISetStartFreeSpace(segP, SIEntryOffset(segP, e1P));
SIDecProcLimit(segP, 1);
- return (true);
+ return true;
}
shmid = IpcMemoryCreate(key, size, IPCProtection);
else
shmid = IpcMemoryIdGet(key, size);
- return (shmid);
+ return shmid;
}
/************************************************************************/
if (shmId < 0)
{
perror("SISegmentGet: failed");
- return (-1); /* an error */
+ return -1; /* an error */
}
/* Attach the shared cache invalidation segment */
if (shmId < 0)
{
perror("SISegmentGet: getting an existent segment failed");
- return (-1); /* an error */
+ return -1; /* an error */
}
/* Attach the shared cache invalidation segment */
SISegmentAttach(shmId);
}
- return (1);
+ return 1;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.15 1998/08/25 21:34:03 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.16 1998/09/01 03:25:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
CreateSpinlocks(IPCKey key)
{
/* the spin lock shared memory must have been created by now */
- return (TRUE);
+ return TRUE;
}
bool
MMCacheLock = (SPINLOCK) MMCACHELOCKID;
#endif
- return (TRUE);
+ return TRUE;
}
#ifdef LOCKDEBUG
int semval;
semval = IpcSemaphoreGetValue(SpinLockId, lock);
- return (semval < IpcSemaphoreDefaultStartValue);
+ return semval < IpcSemaphoreDefaultStartValue;
}
/*
if (semid >= 0)
{
SpinLockId = semid;
- return (TRUE);
+ return TRUE;
}
/* cannot create spinlocks */
elog(FATAL, "CreateSpinlocks: cannot create spin locks");
- return (FALSE);
+ return FALSE;
}
/*
}
/* cannot create spinlocks */
elog(FATAL, "AttachSpinlocks: cannot create spin locks");
- return (FALSE);
+ return FALSE;
}
SpinLockId = id;
- return (TRUE);
+ return TRUE;
}
/*
if (!AttachSpinLocks(key))
{
elog(FATAL, "InitSpinLocks: couldnt attach spin locks");
- return (FALSE);
+ return FALSE;
}
}
MMCacheLock = (SPINLOCK) MMCACHELOCKID;
#endif
- return (TRUE);
+ return TRUE;
}
#endif /* HAS_TEST_AND_SET */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.36 1998/08/27 01:04:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.37 1998/09/01 03:25:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
retval->heap_r = r;
retval->index_r = indr;
retval->iscan = (IndexScanDesc) NULL;
- retval->hdesc = RelationGetTupleDescriptor(r);
- retval->idesc = RelationGetTupleDescriptor(indr);
+ retval->hdesc = RelationGetDescr(r);
+ retval->idesc = RelationGetDescr(indr);
retval->offset = retval->lowbyte =
retval->highbyte = 0;
ItemPointerSetInvalid(&(retval->htid));
}
retval->flags |= IFS_ATEOF;
- return (retval);
+ return retval;
}
LargeObjectDesc *
r = heap_open(lobjId);
if (!RelationIsValid(r))
- return ((LargeObjectDesc *) NULL);
+ return (LargeObjectDesc *) NULL;
indname = pstrdup((r->rd_rel->relname).data);
indrel = index_openr(indname);
if (!RelationIsValid(indrel))
- return ((LargeObjectDesc *) NULL);
+ return (LargeObjectDesc *) NULL;
retval = (LargeObjectDesc *) palloc(sizeof(LargeObjectDesc));
retval->heap_r = r;
retval->index_r = indrel;
retval->iscan = (IndexScanDesc) NULL;
- retval->hdesc = RelationGetTupleDescriptor(r);
- retval->idesc = RelationGetTupleDescriptor(indrel);
+ retval->hdesc = RelationGetDescr(r);
+ retval->idesc = RelationGetDescr(indrel);
retval->offset = retval->lowbyte = retval->highbyte = 0;
ItemPointerSetInvalid(&(retval->htid));
retval->flags = IFS_RDLOCK;
}
- return (retval);
+ return retval;
}
/*
/* we have no good way of computing access times right now */
stbuf->st_atime_s = stbuf->st_mtime_s = stbuf->st_ctime_s = 0;
- return (0);
+ return 0;
}
#endif
if (whence == SEEK_CUR)
{
offset += obj_desc->offset; /* calculate absolute position */
- return (inv_seek(obj_desc, offset, SEEK_SET));
+ return inv_seek(obj_desc, offset, SEEK_SET);
}
/*
offset += _inv_getsize(obj_desc->heap_r,
obj_desc->hdesc,
obj_desc->index_r);
- return (inv_seek(obj_desc, offset, SEEK_SET));
+ return inv_seek(obj_desc, offset, SEEK_SET);
}
/*
&& offset <= obj_desc->highbyte
&& oldOffset <= obj_desc->highbyte
&& obj_desc->iscan != (IndexScanDesc) NULL)
- return (offset);
+ return offset;
/*
* To do a seek on an inversion file, we start an index scan that will
&skey);
}
- return (offset);
+ return offset;
}
int
{
Assert(PointerIsValid(obj_desc));
- return (obj_desc->offset);
+ return obj_desc->offset;
}
int
/* if we're already at EOF, we don't need to do any work here */
if (obj_desc->flags & IFS_ATEOF)
- return (0);
+ return 0;
/* make sure we obey two-phase locking */
if (!(obj_desc->flags & IFS_RDLOCK))
obj_desc->offset += ncopy;
}
- return (nread);
+ return nread;
}
int
}
/* that's it */
- return (nwritten);
+ return nwritten;
}
/*
if (res == (RetrieveIndexResult) NULL)
{
ItemPointerSetInvalid(&(obj_desc->htid));
- return ((HeapTuple) NULL);
+ return (HeapTuple) NULL;
}
/*
/* new tuple is inserted */
WriteBuffer(buffer);
- return (nwritten);
+ return nwritten;
}
static int
&& obj_desc->lowbyte + nbytes >= obj_desc->highbyte)
{
WriteBuffer(buffer);
- return (inv_wrnew(obj_desc, dbuf, nbytes));
+ return inv_wrnew(obj_desc, dbuf, nbytes);
}
/*
WriteBuffer(newbuf);
/* done */
- return (nwritten);
+ return nwritten;
}
static HeapTuple
obj_desc->highbyte = obj_desc->offset + nwrite - 1;
/* new tuple is filled -- return it */
- return (ntup);
+ return ntup;
}
static void
ItemPointerGetOffsetNumber(pointer));
}
- return (itemPointerString);
+ return itemPointerString;
}
*/
{
index_endscan(iscan);
pfree(iscan);
- return (0);
+ return 0;
}
/*
size = DatumGetInt32(d) + 1;
ReleaseBuffer(buffer);
- return (size);
+ return size;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.34 1998/08/28 12:08:03 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.35 1998/09/01 03:25:19 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
{
elog(NOTICE, "LockMethodTableInit: too many lock types %d greater than %d",
numModes, MAX_LOCKMODES);
- return (INVALID_LOCKMETHOD);
+ return INVALID_LOCKMETHOD;
}
/* allocate a string for the shmem index table lookup */
if (!shmemName)
{
elog(NOTICE, "LockMethodTableInit: couldn't malloc string %s \n", tabName);
- return (INVALID_LOCKMETHOD);
+ return INVALID_LOCKMETHOD;
}
/* each lock table has a non-shared header */
{
elog(NOTICE, "LockMethodTableInit: couldn't malloc lock table %s\n", tabName);
pfree(shmemName);
- return (INVALID_LOCKMETHOD);
+ return INVALID_LOCKMETHOD;
}
/* ------------------------
pfree(shmemName);
if (status)
- return (lockMethodTable->ctl->lockmethod);
+ return lockMethodTable->ctl->lockmethod;
else
- return (INVALID_LOCKMETHOD);
+ return INVALID_LOCKMETHOD;
}
/*
LOCKMETHOD newLockMethod;
if (NumLockMethods >= MAX_LOCK_METHODS)
- return (INVALID_LOCKMETHOD);
+ return INVALID_LOCKMETHOD;
if (LockMethodTable[lockmethod] == INVALID_LOCKMETHOD)
- return (INVALID_LOCKMETHOD);
+ return INVALID_LOCKMETHOD;
/* other modules refer to the lock table by a lockmethod */
newLockMethod = NumLockMethods;
NumLockMethods++;
LockMethodTable[newLockMethod] = LockMethodTable[lockmethod];
- return (newLockMethod);
+ return newLockMethod;
}
/*
if (!lockMethodTable)
{
elog(NOTICE, "LockAcquire: bad lock table %d", lockmethod);
- return (FALSE);
+ return FALSE;
}
if (LockingIsDisabled)
- return (TRUE);
+ return TRUE;
masterLock = lockMethodTable->ctl->masterLock;
{
SpinRelease(masterLock);
elog(FATAL, "LockAcquire: lock table %d is corrupted", lockmethod);
- return (FALSE);
+ return FALSE;
}
/* --------------------
if (!result)
{
elog(NOTICE, "LockAcquire: xid table corrupted");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/*
Assert((result->nHolding > 0) && (result->holders[lockmode] > 0));
GrantLock(lock, lockmode);
SpinRelease(masterLock);
- return (TRUE);
+ return TRUE;
}
status = LockResolveConflicts(lockmethod, lock, lockmode, xid, result);
Assert((lock->nHolding > 0) && (lock->holders[lockmode] >= 0));
Assert(lock->nActive <= lock->nHolding);
SpinRelease(masterLock);
- return (FALSE);
+ return FALSE;
}
#endif
status = WaitOnLock(lockmethod, lock, lockmode, xid);
XID_PRINT_AUX("LockAcquire: INCONSISTENT ", result);
LOCK_PRINT_AUX("LockAcquire: INCONSISTENT ", lock, lockmode);
/* Should we retry ? */
- return (FALSE);
+ return FALSE;
}
XID_PRINT("LockAcquire: granted", result);
LOCK_PRINT("LockAcquire: granted", lock, lockmode);
SpinRelease(masterLock);
- return (status == STATUS_OK);
+ return status == STATUS_OK;
}
/* ----------------------------
if (!result)
{
elog(NOTICE, "LockResolveConflicts: xid table corrupted");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/*
result->nHolding++;
XID_PRINT("LockResolveConflicts: no conflict", result);
Assert((result->nHolding > 0) && (result->holders[lockmode] > 0));
- return (STATUS_OK);
+ return STATUS_OK;
}
/* ------------------------
result->nHolding++;
XID_PRINT("LockResolveConflicts: resolved", result);
Assert((result->nHolding > 0) && (result->holders[lockmode] > 0));
- return (STATUS_OK);
+ return STATUS_OK;
}
XID_PRINT("LockResolveConflicts: conflicting", result);
- return (STATUS_FOUND);
+ return STATUS_FOUND;
}
/*
PS_SET_STATUS(old_status);
LOCK_PRINT_AUX("WaitOnLock: wakeup on lock", lock, lockmode);
- return (STATUS_OK);
+ return STATUS_OK;
}
/*
if (!lockMethodTable)
{
elog(NOTICE, "lockMethodTable is null in LockRelease");
- return (FALSE);
+ return FALSE;
}
if (LockingIsDisabled)
- return (TRUE);
+ return TRUE;
masterLock = lockMethodTable->ctl->masterLock;
SpinAcquire(masterLock);
{
SpinRelease(masterLock);
elog(NOTICE, "LockRelease: locktable corrupted");
- return (FALSE);
+ return FALSE;
}
if (!found)
#ifdef USER_LOCKS
if (is_user_lock) {
TPRINTF(TRACE_USERLOCKS, "LockRelease: no lock with this tag");
- return (FALSE);
+ return FALSE;
}
#endif
elog(NOTICE, "LockRelease: locktable lookup failed, no lock");
- return (FALSE);
+ return FALSE;
}
LOCK_PRINT("LockRelease: found", lock, lockmode);
Assert((lock->nHolding > 0) && (lock->holders[lockmode] >= 0));
} else
#endif
elog(NOTICE, "LockReplace: xid table corrupted");
- return (FALSE);
+ return FALSE;
}
XID_PRINT("LockRelease: found", result);
Assert(result->tag.lock == MAKE_OFFSET(lock));
elog(NOTICE, "LockRelease: you don't own a lock of type %s",
lock_types[lockmode]);
Assert(result->holders[lockmode] >= 0);
- return (FALSE);
+ return FALSE;
}
Assert(result->nHolding > 0);
{
SpinRelease(masterLock);
elog(NOTICE, "LockRelease: remove xid, table corrupted");
- return (FALSE);
+ return FALSE;
}
}
}
SpinRelease(masterLock);
- return (TRUE);
+ return TRUE;
}
/*
lockMethodTable = LockMethodTable[lockmethod];
if (!lockMethodTable) {
elog(NOTICE, "LockAcquire: bad lockmethod %d", lockmethod);
- return (FALSE);
+ return FALSE;
}
if (SHMQueueEmpty(lockQueue))
{
SpinRelease(masterLock);
elog(NOTICE, "LockReleaseAll: xid table corrupted");
- return (FALSE);
+ return FALSE;
}
if (!lock->nHolding)
{
SpinRelease(masterLock);
elog(NOTICE, "LockReleaseAll: cannot remove lock from HTAB");
- return (FALSE);
+ return FALSE;
}
}
else
if (!lockMethodTable)
{
elog(NOTICE, "lockMethodTable is null in LockOwners");
- return ((ArrayType *) &empty_array);
+ return (ArrayType *) &empty_array;
}
if (LockingIsDisabled)
{
- return ((ArrayType *) &empty_array);
+ return (ArrayType *) &empty_array;
}
masterLock = lockMethodTable->ctl->masterLock;
{
SpinRelease(masterLock);
elog(NOTICE, "LockOwners: locktable corrupted");
- return ((ArrayType *) &empty_array);
+ return (ArrayType *) &empty_array;
}
if (!found)
#ifdef USER_LOCKS
if (is_user_lock) {
TPRINTF(TRACE_USERLOCKS, "LockOwners: no lock with this tag");
- return ((ArrayType *) &empty_array);
+ return (ArrayType *) &empty_array;
}
#endif
elog(NOTICE, "LockOwners: locktable lookup failed, no lock");
- return ((ArrayType *) &empty_array);
+ return (ArrayType *) &empty_array;
}
LOCK_PRINT("LockOwners: found", lock, 0);
Assert((lock->nHolding > 0) && (lock->nActive > 0));
memmove((char *) array, (char *) &size, sizeof(int));
memmove((char *) ARR_DIMS(array), (char *) hbounds, ndims * sizeof(int));
- return (array);
+ return array;
}
#ifdef DEADLOCK_DEBUG
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.23 1998/08/25 21:20:28 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/multi.c,v 1.24 1998/09/01 03:25:23 momjian Exp $
*
* NOTES:
* (1) The lock.c module assumes that the caller here is doing
MemSet(&tag, 0, sizeof(tag));
tag.relId = lockinfo->lockRelId.relId;
tag.dbId = lockinfo->lockRelId.dbId;
- return (MultiAcquire(MultiTableId, &tag, lockmode, RELN_LEVEL));
+ return MultiAcquire(MultiTableId, &tag, lockmode, RELN_LEVEL);
}
/*
/* not locking any valid Tuple, just the page */
tag.tupleId = *tidPtr;
- return (MultiAcquire(MultiTableId, &tag, lockmode, TUPLE_LEVEL));
+ return MultiAcquire(MultiTableId, &tag, lockmode, TUPLE_LEVEL);
}
/*
tag.relId = lockinfo->lockRelId.relId;
tag.dbId = lockinfo->lockRelId.dbId;
BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
- return (MultiAcquire(MultiTableId, &tag, lockmode, PAGE_LEVEL));
+ return MultiAcquire(MultiTableId, &tag, lockmode, PAGE_LEVEL);
}
/*
break;
default:
elog(ERROR, "MultiAcquire: bad lock level");
- return (FALSE);
+ return FALSE;
}
/*
}
}
}
- return (retStatus);
+ return retStatus;
}
/* ------------------
tag.dbId = lockinfo->lockRelId.dbId;
BlockIdCopy(&(tag.tupleId.ip_blkid), &(tidPtr->ip_blkid));
- return (MultiRelease(MultiTableId, &tag, lockmode, PAGE_LEVEL));
+ return MultiRelease(MultiTableId, &tag, lockmode, PAGE_LEVEL);
}
#endif
tag.relId = lockinfo->lockRelId.relId;
tag.dbId = lockinfo->lockRelId.dbId;
- return (MultiRelease(MultiTableId, &tag, lockmode, RELN_LEVEL));
+ return MultiRelease(MultiTableId, &tag, lockmode, RELN_LEVEL);
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.41 1998/08/25 21:20:29 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.42 1998/09/01 03:25:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.41 1998/08/25 21:20:29 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.42 1998/09/01 03:25:24 momjian Exp $
*/
#include
#include
location = ShmemPIDDestroy(pid);
if (location == INVALID_OFFSET)
- return (FALSE);
+ return FALSE;
proc = (PROC *) MAKE_PTR(location);
SpinAcquire(ProcStructLock);
SpinRelease(ProcStructLock);
- return (TRUE);
+ return TRUE;
}
/*
ShmemInitStruct(name, (unsigned) sizeof(PROC_QUEUE), &found);
if (!queue)
- return (NULL);
+ return NULL;
if (!found)
ProcQueueInit(queue);
- return (queue);
+ return queue;
}
#endif
MyProc->waitLock = (LOCK *)NULL;
#endif
- return (MyProc->errType);
+ return MyProc->errType;
}
if (proc->links.prev == INVALID_OFFSET ||
proc->links.next == INVALID_OFFSET)
- return ((PROC *) NULL);
+ return (PROC *) NULL;
retProc = (PROC *) MAKE_PTR(proc->links.prev);
Assert(queue->size >= 0);
if (!queue->size)
- return (STATUS_NOT_FOUND);
+ return STATUS_NOT_FOUND;
proc = (PROC *) MAKE_PTR(queue->links.prev);
count = 0;
Assert(queue->size >= 0);
if (count)
- return (STATUS_OK);
+ return STATUS_OK;
else {
/* Something is still blocking us. May have deadlocked. */
trace_flag = (lock->tag.lockmethod == USER_LOCKMETHOD) ? \
if (pg_options[trace_flag] >= 2)
DumpAllLocks();
#endif
- return (STATUS_NOT_FOUND);
+ return STATUS_NOT_FOUND;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.8 1998/07/13 16:34:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/Attic/single.c,v 1.9 1998/09/01 03:25:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
tag.tupleId.ip_posid = InvalidOffsetNumber;
if (action == UNLOCK)
- return (LockRelease(MultiTableId, &tag, lockmode));
+ return LockRelease(MultiTableId, &tag, lockmode);
else
- return (LockAcquire(MultiTableId, &tag, lockmode));
+ return LockAcquire(MultiTableId, &tag, lockmode);
}
/*
if (action == UNLOCK)
- return (LockRelease(MultiTableId, &tag, lockmode));
+ return LockRelease(MultiTableId, &tag, lockmode);
else
- return (LockAcquire(MultiTableId, &tag, lockmode));
+ return LockAcquire(MultiTableId, &tag, lockmode);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.18 1998/06/15 19:29:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.19 1998/09/01 03:25:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
((*itemId).lp_len != 0))
{
elog(ERROR, "PageAddItem: tried overwrite of used ItemId");
- return (InvalidOffsetNumber);
+ return InvalidOffsetNumber;
}
}
}
upper = ((PageHeader) page)->pd_upper - alignedSize;
if (lower > upper)
- return (InvalidOffsetNumber);
+ return InvalidOffsetNumber;
itemId = &((PageHeader) page)->pd_linp[offsetNumber - 1];
(*itemId).lp_off = upper;
((PageHeader) page)->pd_lower = lower;
((PageHeader) page)->pd_upper = upper;
- return (offsetNumber);
+ return offsetNumber;
}
/*
thdr->pd_lower = sizeof(PageHeaderData) - sizeof(ItemIdData);
thdr->pd_upper = pageSize - DOUBLEALIGN(specialSize);
- return (temp);
+ return temp;
}
/*
{
if (((struct itemIdSortData *) itemidp1)->itemiddata.lp_off ==
((struct itemIdSortData *) itemidp2)->itemiddata.lp_off)
- return (0);
+ return 0;
else if (((struct itemIdSortData *) itemidp1)->itemiddata.lp_off <
((struct itemIdSortData *) itemidp2)->itemiddata.lp_off)
- return (1);
+ return 1;
else
- return (-1);
+ return -1;
}
/*
space = ((PageHeader) page)->pd_upper - ((PageHeader) page)->pd_lower;
if (space < sizeof(ItemIdData))
- return (0);
+ return 0;
space -= sizeof(ItemIdData);/* XXX not always true */
- return (space);
+ return space;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/page/itemptr.c,v 1.3 1997/09/07 04:49:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/page/itemptr.c,v 1.4 1998/09/01 03:25:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
ItemPointerGetBlockNumber(pointer2) &&
ItemPointerGetOffsetNumber(pointer1) ==
ItemPointerGetOffsetNumber(pointer2))
- return (true);
+ return true;
else
- return (false);
+ return false;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.37 1998/08/24 01:13:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.38 1998/09/01 03:25:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
MdCxt = (MemoryContext) CreateGlobalMemory("MdSmgr");
if (MdCxt == (MemoryContext) NULL)
- return (SM_FAIL);
+ return SM_FAIL;
oldcxt = MemoryContextSwitchTo(MdCxt);
Md_fdvec = (MdfdVec *) palloc(Nfds * sizeof(MdfdVec));
MemoryContextSwitchTo(oldcxt);
if (Md_fdvec == (MdfdVec *) NULL)
- return (SM_FAIL);
+ return SM_FAIL;
MemSet(Md_fdvec, 0, Nfds * sizeof(MdfdVec));
Md_Free = 0;
Md_fdvec[Nfds - 1].mdfd_nextFree = -1;
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
int
if (fd < 0)
{
if (!IsBootstrapProcessingMode())
- return (-1);
+ return -1;
fd = FileNameOpenFile(path, O_RDWR, 0600); /* Bootstrap */
if (fd < 0)
- return (-1);
+ return -1;
}
vfd = _fdvec_alloc();
if (vfd < 0)
- return (-1);
+ return -1;
Md_fdvec[vfd].mdfd_vfd = fd;
Md_fdvec[vfd].mdfd_flags = (uint16) 0;
#endif
Md_fdvec[vfd].mdfd_lstbcnt = 0;
- return (vfd);
+ return vfd;
}
/*
StrNCpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN);
if (FileNameUnlink(fname) < 0)
- return (SM_FAIL);
+ return SM_FAIL;
/* unlink all the overflow files for large relations */
for (i = 1;; i++)
_fdvec_free(fd);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
v = _mdfd_getseg(reln, nblocks, O_CREAT);
if ((pos = FileSeek(v->mdfd_vfd, 0L, SEEK_END)) < 0)
- return (SM_FAIL);
+ return SM_FAIL;
if (FileWrite(v->mdfd_vfd, buffer, BLCKSZ) != BLCKSZ)
- return (SM_FAIL);
+ return SM_FAIL;
/* remember that we did a write, so we can sync at xact commit */
v->mdfd_flags |= MDFD_DIRTY;
v->mdfd_lstbcnt = ++nblocks;
#endif
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
vfd = _fdvec_alloc();
if (vfd < 0)
- return (-1);
+ return -1;
Md_fdvec[vfd].mdfd_vfd = fd;
Md_fdvec[vfd].mdfd_flags = (uint16) 0;
#endif
#endif
- return (vfd);
+ return vfd;
}
/*
_fdvec_free(fd);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
#endif
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
- return (SM_FAIL);
+ return SM_FAIL;
status = SM_SUCCESS;
if ((nbytes = FileRead(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
status = SM_FAIL;
}
- return (status);
+ return status;
}
/*
#endif
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
- return (SM_FAIL);
+ return SM_FAIL;
status = SM_SUCCESS;
if (FileWrite(v->mdfd_vfd, buffer, BLCKSZ) != BLCKSZ)
v->mdfd_flags |= MDFD_DIRTY;
- return (status);
+ return status;
}
/*
#endif
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
- return (SM_FAIL);
+ return SM_FAIL;
/* write and sync the block */
status = SM_SUCCESS;
v->mdfd_flags &= ~MDFD_DIRTY;
- return (status);
+ return status;
}
/*
#endif
if ((fd = open(path, O_RDWR, 0600)) < 0)
- return (SM_FAIL);
+ return SM_FAIL;
/* seek to the right spot */
#ifndef LET_OS_MANAGE_FILESIZE
if (lseek(fd, seekpos, SEEK_SET) != seekpos)
{
close(fd);
- return (SM_FAIL);
+ return SM_FAIL;
}
status = SM_SUCCESS;
pfree(path);
- return (status);
+ return status;
}
/*
v = v->mdfd_chain;
}
else
- return ((segno * RELSEG_SIZE) + nblocks);
+ return (segno * RELSEG_SIZE) + nblocks;
}
#else
- return (_mdnblocks(v->mdfd_vfd, BLCKSZ));
+ return _mdnblocks(v->mdfd_vfd, BLCKSZ);
#endif
}
{
elog(NOTICE, "Can't truncate multi-segments relation %s",
reln->rd_rel->relname.data);
- return (curnblk);
+ return curnblk;
}
#endif
v = &Md_fdvec[fd];
if (FileTruncate(v->mdfd_vfd, nblocks * BLCKSZ) < 0)
- return (-1);
+ return -1;
- return (nblocks);
+ return nblocks;
} /* mdtruncate */
if (v->mdfd_flags & MDFD_DIRTY)
{
if (FileSync(v->mdfd_vfd) < 0)
- return (SM_FAIL);
+ return SM_FAIL;
v->mdfd_flags &= ~MDFD_DIRTY;
}
}
}
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
v->mdfd_flags &= ~MDFD_DIRTY;
}
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
Assert(fdvec == CurFd);
CurFd++;
}
- return (fdvec);
+ return fdvec;
}
/* Must allocate more room */
CurFd++;
Md_fdvec[fdvec].mdfd_flags = 0;
- return (fdvec);
+ return fdvec;
}
/*
pfree(fullpath);
if (fd < 0)
- return ((MdfdVec *) NULL);
+ return (MdfdVec *) NULL;
/* allocate an mdfdvec entry for it */
oldcxt = MemoryContextSwitchTo(MdCxt);
#endif
/* all done */
- return (v);
+ return v;
}
static MdfdVec *
v = &Md_fdvec[fd];
#endif
- return (v);
+ return v;
}
static BlockNumber
long len;
len = FileSeek(file, 0L, SEEK_END) - 1;
- return ((BlockNumber) ((len < 0) ? 0 : 1 + len / blcksz));
+ return (BlockNumber) ((len < 0) ? 0 : 1 + len / blcksz);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.10 1998/08/19 02:02:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/Attic/mm.c,v 1.11 1998/09/01 03:25:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (mmcacheblk == (char *) NULL)
{
SpinRelease(MMCacheLock);
- return (SM_FAIL);
+ return SM_FAIL;
}
info.keysize = sizeof(MMCacheTag);
if (MMCacheHT == (HTAB *) NULL)
{
SpinRelease(MMCacheLock);
- return (SM_FAIL);
+ return SM_FAIL;
}
info.keysize = sizeof(MMRelTag);
if (MMRelCacheHT == (HTAB *) NULL)
{
SpinRelease(MMCacheLock);
- return (SM_FAIL);
+ return SM_FAIL;
}
if (IsUnderPostmaster) /* was IsPostmaster bjm */
{
MemSet(mmcacheblk, 0, mmsize);
SpinRelease(MMCacheLock);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
SpinRelease(MMCacheLock);
mmcacheblk += (MMNBUFFERS * sizeof(MMCacheTag));
MMBlockCache = mmcacheblk;
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
int
mmshutdown()
{
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
int
if (*MMCurRelno == MMNRELATIONS)
{
SpinRelease(MMCacheLock);
- return (SM_FAIL);
+ return SM_FAIL;
}
(*MMCurRelno)++;
{
/* already exists */
SpinRelease(MMCacheLock);
- return (SM_FAIL);
+ return SM_FAIL;
}
entry->mmrhe_nblocks = 0;
SpinRelease(MMCacheLock);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
if (i == MMNBUFFERS)
{
SpinRelease(MMCacheLock);
- return (SM_FAIL);
+ return SM_FAIL;
}
}
else
SpinRelease(MMCacheLock);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
mmopen(Relation reln)
{
/* automatically successful */
- return (0);
+ return 0;
}
/*
mmclose(Relation reln)
{
/* automatically successful */
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
/* reading nonexistent pages is defined to fill them with zeroes */
SpinRelease(MMCacheLock);
MemSet(buffer, 0, BLCKSZ);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
offset = (entry->mmhe_bufno * BLCKSZ);
SpinRelease(MMCacheLock);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
SpinRelease(MMCacheLock);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
int
mmflush(Relation reln, BlockNumber blocknum, char *buffer)
{
- return (mmwrite(reln, blocknum, buffer));
+ return mmwrite(reln, blocknum, buffer);
}
/*
BlockNumber blkno,
char *buffer)
{
- return (SM_FAIL);
+ return SM_FAIL;
}
/*
SpinRelease(MMCacheLock);
- return (nblocks);
+ return nblocks;
}
/*
int
mmcommit()
{
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
int
mmabort()
{
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
size += MAXALIGN(sizeof(*MMCurRelno));
size += MAXALIGN(MMNBUFFERS * sizeof(MMCacheTag));
- return (size);
+ return size;
}
#endif /* STABLE_MEMORY_STORAGE */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.18 1998/07/20 16:14:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.19 1998/09/01 03:25:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* register the shutdown proc */
on_proc_exit(smgrshutdown, NULL);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
static void
if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
elog(ERROR, "cannot create %s", reln->rd_rel->relname.data);
- return (fd);
+ return fd;
}
/*
if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
elog(ERROR, "cannot unlink %s", reln->rd_rel->relname.data);
- return (status);
+ return status;
}
/*
if (status == SM_FAIL)
elog(ERROR, "%s: cannot extend", reln->rd_rel->relname.data);
- return (status);
+ return status;
}
/*
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0)
elog(ERROR, "cannot open %s", reln->rd_rel->relname.data);
- return (fd);
+ return fd;
}
/*
if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
elog(ERROR, "cannot close %s", reln->rd_rel->relname.data);
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
/*
elog(ERROR, "cannot read block %d of %s",
blocknum, reln->rd_rel->relname.data);
- return (status);
+ return status;
}
/*
elog(ERROR, "cannot write block %d of %s",
blocknum, reln->rd_rel->relname.data);
- return (status);
+ return status;
}
/*
elog(ERROR, "cannot flush block %d of %s to stable store",
blocknum, reln->rd_rel->relname.data);
- return (status);
+ return status;
}
/*
pfree(dbstr);
pfree(relstr);
- return (status);
+ return status;
}
/*
if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
elog(ERROR, "cannot count blocks for %s", reln->rd_rel->relname.data);
- return (nblocks);
+ return nblocks;
}
/*
reln->rd_rel->relname.data, nblocks);
}
- return (newblks);
+ return newblks;
}
/*
}
}
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
#ifdef NOT_USED
}
}
- return (SM_SUCCESS);
+ return SM_SUCCESS;
}
#endif
if (smgrno < 0 || smgrno >= NSmgr)
elog(ERROR, "illegal storage manager number %d", smgrno);
- return (smgrwo[smgrno]);
+ return smgrwo[smgrno];
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.9 1998/06/23 15:35:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.10 1998/09/01 03:25:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < NStorageManagers; i++)
{
if (strcmp(s, StorageManager[i].smgr_name) == 0)
- return ((int2) i);
+ return (int2) i;
}
elog(ERROR, "smgrin: illegal storage manager name %s", s);
return 0;
s = (char *) palloc(strlen(StorageManager[i].smgr_name) + 1);
strcpy(s, StorageManager[i].smgr_name);
- return (s);
+ return s;
}
bool
smgreq(int2 a, int2 b)
{
if (a == b)
- return (true);
- return (false);
+ return true;
+ return false;
}
bool
smgrne(int2 a, int2 b)
{
if (a == b)
- return (false);
- return (true);
+ return false;
+ return true;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.21 1998/07/20 16:56:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.22 1998/09/01 03:25:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
CommandDest dest)
{
PortalEntry *entry;
- AttributeTupleForm *attrs = tupdesc->attrs;
+ Form_pg_attribute *attrs = tupdesc->attrs;
int natts = tupdesc->natts;
int i;
char *p;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.19 1998/08/19 02:02:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.20 1998/09/01 03:25:40 momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
Oid rettype;
HeapTuple func_htp,
type_htp;
- TypeTupleForm tp;
+ Form_pg_type tp;
Form_pg_proc pp;
int i;
elog(ERROR, "update_fp_info: bad argument type %d for %d",
argtypes[i], func_id);
}
- tp = (TypeTupleForm) GETSTRUCT(type_htp);
+ tp = (Form_pg_type) GETSTRUCT(type_htp);
fip->argbyval[i] = tp->typbyval;
fip->arglen[i] = tp->typlen;
} /* else it had better be VAR_LENGTH_ARG */
elog(ERROR, "update_fp_info: bad return type %d for %d",
rettype, func_id);
}
- tp = (TypeTupleForm) GETSTRUCT(type_htp);
+ tp = (Form_pg_type) GETSTRUCT(type_htp);
fip->retbyval = tp->typbyval;
fip->retlen = tp->typlen;
} /* else it had better by VAR_LENGTH_RESULT */
- return (0);
+ return 0;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.87 1998/08/30 21:05:27 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.88 1998/09/01 03:25:41 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
if (EchoQuery)
printf("query: %s\n", inBuf);
- return ('Q');
+ return 'Q';
}
/* ----------------
if (queryListP)
*queryListP = querytree_list;
- return (plan_list);
+ return plan_list;
}
/* ----------------------------------------------------------------
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.87 $ $Date: 1998/08/30 21:05:27 $");
+ puts("$Revision: 1.88 $ $Date: 1998/09/01 03:25:41 $");
}
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.29 1998/08/19 02:02:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.30 1998/09/01 03:25:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
n[len] = '\0';
while (isspace(*s))
++s;
- return (s);
+ return s;
}
/*
elog(DEBUG, "aclparse: correctly read [%x %d %x], modechg=%x",
aip->ai_idtype, aip->ai_id, aip->ai_mode, *modechg);
#endif
- return (s);
+ return s;
}
/*
new_acl->flags = 0;
ARR_LBOUND(new_acl)[0] = 0;
ARR_DIMS(new_acl)[0] = n;
- return (new_acl);
+ return new_acl;
}
/*
++s;
if (*s)
elog(ERROR, "aclitemin: extra garbage at end of specification");
- return (aip);
+ return aip;
}
/*
*p++ = ACL_MODE_STR[i];
*p = '\0';
- return (out);
+ return out;
}
/*
aclitemeq(AclItem *a1, AclItem *a2)
{
if (!a1 && !a2)
- return (1);
+ return 1;
if (!a1 || !a2)
- return (0);
- return (a1->ai_idtype == a2->ai_idtype && a1->ai_id == a2->ai_id);
+ return 0;
+ return a1->ai_idtype == a2->ai_idtype && a1->ai_id == a2->ai_id;
}
static int32
aclitemgt(AclItem *a1, AclItem *a2)
{
if (a1 && !a2)
- return (1);
+ return 1;
if (!a1 || !a2)
- return (0);
+ return 0;
return ((a1->ai_idtype > a2->ai_idtype) ||
(a1->ai_idtype == a2->ai_idtype && a1->ai_id > a2->ai_id));
}
aip[1].ai_idtype = ACL_IDTYPE_UID;
aip[1].ai_id = ownerid;
aip[1].ai_mode = ACL_OWNER_DEFAULT;
- return (acl);
+ return acl;
}
Acl *
aip[0].ai_idtype = ACL_IDTYPE_WORLD;
aip[0].ai_id = ACL_ID_WORLD;
aip[0].ai_mode = IsSystemRelationName(relname) ? ACL_RD : ACL_WORLD_DEFAULT;
- return (acl);
+ return acl;
}
Acl *
if (!old_acl || ACL_NUM(old_acl) < 1)
{
new_acl = makeacl(0);
- return (new_acl);
+ return new_acl;
}
if (!mod_aip)
{
new_acl = makeacl(ACL_NUM(old_acl));
memmove((char *) new_acl, (char *) old_acl, ACL_SIZE(old_acl));
- return (new_acl);
+ return new_acl;
}
num = ACL_NUM(old_acl);
}
}
- return (new_acl);
+ return new_acl;
}
/*
Acl *
aclinsert(Acl *old_acl, AclItem *mod_aip)
{
- return (aclinsert3(old_acl, mod_aip, ACL_MODECHG_EQL));
+ return aclinsert3(old_acl, mod_aip, ACL_MODECHG_EQL);
}
Acl *
if (!old_acl || ACL_NUM(old_acl) < 1)
{
new_acl = makeacl(0);
- return (new_acl);
+ return new_acl;
}
if (!mod_aip)
{
new_acl = makeacl(ACL_NUM(old_acl));
memmove((char *) new_acl, (char *) old_acl, ACL_SIZE(old_acl));
- return (new_acl);
+ return new_acl;
}
old_num = ACL_NUM(old_acl);
(new_num - dst) * sizeof(AclItem));
}
}
- return (new_acl);
+ return new_acl;
}
int32
AclItem *aidat;
if (!acl || !aip || ((num = ACL_NUM(acl)) < 1))
- return (0);
+ return 0;
aidat = ACL_DAT(acl);
for (i = 0; i < num; ++i)
if (aclitemeq(aip, aidat + i))
- return (1);
- return (0);
+ return 1;
+ return 0;
}
/* parser support routines */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.32 1998/08/19 02:02:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.33 1998/09/01 03:25:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
/*-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-*/
-static int _ArrayCount(char *str, int dim[], int typdelim);
+static int _ArrayCount(char *str, int *dim, int typdelim);
static char *
-_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
+_ReadArrayStr(char *arrayStr, int nitems, int ndim, int *dim,
FmgrInfo *inputproc, Oid typelem, int32 typmod,
char typdelim, int typlen, bool typbyval,
char typalign, int *nbytes);
#ifdef LOARRAY
static char *
_ReadLOArray(char *str, int *nbytes, int *fd, bool *chunkFlag,
- int ndim, int dim[], int baseSize);
+ int ndim, int *dim, int baseSize);
#endif
static void
#endif
static void
-_ArrayRange(int st[], int endp[], int bsize, char *destPtr,
+_ArrayRange(int *st, int *endp, int bsize, char *destPtr,
ArrayType *array, int from);
-static int _ArrayClipCount(int stI[], int endpI[], ArrayType *array);
+static int _ArrayClipCount(int *stI, int *endpI, ArrayType *array);
static void
-_LOArrayRange(int st[], int endp[], int bsize, int srcfd,
+_LOArrayRange(int *st, int *endp, int bsize, int srcfd,
int destfd, ArrayType *array, int isSrcLO, bool *isNull);
static void
-_ReadArray(int st[], int endp[], int bsize, int srcfd, int destfd,
+_ReadArray(int *st, int *endp, int bsize, int srcfd, int destfd,
ArrayType *array, int isDestLO, bool *isNull);
static int ArrayCastAndSet(char *src, bool typbyval, int typlen, char *dest);
-static int SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[]);
+static int SanityCheckInput(int ndim, int n, int *dim, int *lb, int *indx);
static int array_read(char *destptr, int eltsize, int nitems, char *srcptr);
static char *array_seek(char *ptr, int eltsize, int nitems);
elog(ERROR, "large object arrays not supported");
}
pfree(string_save);
- return ((char *) retval);
+ return (char *) retval;
}
/*-----------------------------------------------------------------------------
* _ArrayCount --
- * Counts the number of dimensions and the dim[] array for an array string.
+ * Counts the number of dimensions and the *dim array for an array string.
* The syntax for array input is C-like nested curly braces
*-----------------------------------------------------------------------------
*/
static int
-_ArrayCount(char *str, int dim[], int typdelim)
+_ArrayCount(char *str, int *dim, int typdelim)
{
int nest_level = 0,
i;
temp[i] = dim[i] = 0;
if (strncmp(str, "{}", 2) == 0)
- return (0);
+ return 0;
q = str;
while (eoArray != true)
for (i = 0; i < ndim; ++i)
dim[i] = temp[i];
- return (ndim);
+ return ndim;
}
/*---------------------------------------------------------------------------
_ReadArrayStr(char *arrayStr,
int nitems,
int ndim,
- int dim[],
+ int *dim,
FmgrInfo *inputproc, /* function used for the
* conversion */
Oid typelem,
}
}
}
- return ((char *) values);
+ return (char *) values;
}
int *fd,
bool *chunkFlag,
int ndim,
- int dim[],
+ int *dim,
int baseSize)
{
char *inputfile,
chunkfile);
FreeFile(afd);
}
- return (retStr);
+ return retStr;
}
#endif
*dim;
if (v == (ArrayType *) NULL)
- return ((char *) NULL);
+ return (char *) NULL;
if (ARR_IS_LO(v) == true)
{
strcat(save_p, ASSGN);
strcat(save_p, ARR_DATA_PTR(v));
pfree(p);
- return (save_p);
+ return save_p;
}
system_cache_lookup(element_type, false, &typlen, &typbyval,
} while (j != -1);
pfree(values);
- return (retval);
+ return retval;
}
/*-----------------------------------------------------------------------------
}
nbytes = strlen(save_p + VARHDRSZ) + VARHDRSZ;
memmove(save_p, &nbytes, VARHDRSZ);
- return (save_p);
+ return save_p;
}
/*---------------------------------------------------------------------------
Datum
array_ref(ArrayType *array,
int n,
- int indx[],
+ int *indx,
int reftype,
int elmlen,
int arraylen,
Datum
array_clip(ArrayType *array,
int n,
- int upperIndx[],
- int lowerIndx[],
+ int *upperIndx,
+ int *lowerIndx,
int reftype,
int len,
bool *isNull)
newArr = NULL;
}
/* timer_end(); */
- return ((Datum) newArr);
+ return (Datum) newArr;
}
if (len > 0)
char *
array_set(ArrayType *array,
int n,
- int indx[],
+ int *indx,
char *dataPtr,
int reftype,
int elmlen,
elog(ERROR, "array_ref: array bound exceeded");
pos = (char *) array + indx[0] * elmlen;
ArrayCastAndSet(dataPtr, (bool) reftype, elmlen, pos);
- return ((char *) array);
+ return (char *) array;
}
dim = ARR_DIMS(array);
lb = ARR_LBOUND(array);
if (!SanityCheckInput(ndim, n, dim, lb, indx))
{
elog(ERROR, "array_set: array bound exceeded");
- return ((char *) array);
+ return (char *) array;
}
offset = GetOffset(n, dim, lb, indx);
lo_name = ARR_DATA_PTR(array);
if ((fd = LOopen(lo_name, ARR_IS_INV(array) ? INV_WRITE : O_WRONLY)) < 0)
- return ((char *) array);
+ return (char *) array;
#endif
if (lo_lseek(fd, offset, SEEK_SET) < 0)
- return ((char *) array);
+ return (char *) array;
v = (struct varlena *) palloc(elmlen + VARHDRSZ);
VARSIZE(v) = elmlen + VARHDRSZ;
ArrayCastAndSet(dataPtr, (bool) reftype, elmlen, VARDATA(v));
*/
pfree(v);
lo_close(fd);
- return ((char *) array);
+ return (char *) array;
}
if (elmlen > 0)
{
offset = offset * elmlen;
/* off the end of the array */
if (nbytes - offset < 1)
- return ((char *) array);
+ return (char *) array;
pos = ARR_DATA_PTR(array) + offset;
}
else
{
/* new element with same size, overwrite old data */
ArrayCastAndSet(dataPtr, (bool) reftype, elmlen, elt_ptr);
- return ((char *) array);
+ return (char *) array;
}
/* new element with different size, reallocate the array */
(char *) array + lth0 + lth1 + oldlen, lth2);
/* ??? who should free this storage ??? */
- return ((char *) newarray);
+ return (char *) newarray;
}
ArrayCastAndSet(dataPtr, (bool) reftype, elmlen, pos);
- return ((char *) array);
+ return (char *) array;
}
/*----------------------------------------------------------------------------
char *
array_assgn(ArrayType *array,
int n,
- int upperIndx[],
- int lowerIndx[],
+ int *upperIndx,
+ int *lowerIndx,
ArrayType *newArr,
int reftype,
int len,
if (!SanityCheckInput(ndim, n, dim, lb, upperIndx) ||
!SanityCheckInput(ndim, n, dim, lb, lowerIndx))
- return ((char *) array);
+ return (char *) array;
for (i = 0; i < n; i++)
if (lowerIndx[i] > upperIndx[i])
lo_name = (char *) ARR_DATA_PTR(array);
if ((fd = LOopen(lo_name, ARR_IS_INV(array) ? INV_WRITE : O_WRONLY)) < 0)
- return ((char *) array);
+ return (char *) array;
#endif
if (ARR_IS_LO(newArr))
{
#ifdef LOARRAY
lo_name = (char *) ARR_DATA_PTR(newArr);
if ((newfd = LOopen(lo_name, ARR_IS_INV(newArr) ? INV_READ : O_RDONLY)) < 0)
- return ((char *) array);
+ return (char *) array;
#endif
_LOArrayRange(lowerIndx, upperIndx, len, fd, newfd, array, 1, isNull);
lo_close(newfd);
array, 0, isNull);
}
lo_close(fd);
- return ((char *) array);
+ return (char *) array;
}
_ArrayRange(lowerIndx, upperIndx, len, ARR_DATA_PTR(newArr), array, 0);
return (char *) array;
array_eq(ArrayType *array1, ArrayType *array2)
{
if ((array1 == NULL) || (array2 == NULL))
- return (0);
+ return 0;
if (*(int *) array1 != *(int *) array2)
- return (0);
+ return 0;
if (memcmp(array1, array2, *(int *) array1))
- return (0);
- return (1);
+ return 0;
+ return 1;
}
/***************************************************************************/
char *typalign)
{
HeapTuple typeTuple;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(element_type),
element_type);
return;
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTuple);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
*typlen = typeStruct->typlen;
*typbyval = typeStruct->typbyval;
*typdelim = typeStruct->typdelim;
switch (len)
{
case 1:
- return ((Datum) *value);
+ return (Datum) *value;
case 2:
- return ((Datum) *(int16 *) value);
+ return (Datum) *(int16 *) value;
case 3:
case 4:
- return ((Datum) *(int32 *) value);
+ return (Datum) *(int32 *) value;
default:
elog(ERROR, "array_ref: byval and elt len > 4!");
break;
memmove(dest, src, *(int32 *) src);
inc = (INTALIGN(*(int32 *) src));
}
- return (inc);
+ return inc;
}
#ifdef LOARRAY
#endif
static int
-SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[])
+SanityCheckInput(int ndim, int n, int *dim, int *lb, int *indx)
{
int i;
}
static void
-_ArrayRange(int st[],
- int endp[],
+_ArrayRange(int *st,
+ int *endp,
int bsize,
char *destPtr,
ArrayType *array,
}
static int
-_ArrayClipCount(int stI[], int endpI[], ArrayType *array)
+_ArrayClipCount(int *stI, int *endpI, ArrayType *array)
{
int n,
*dim,
int i;
if (eltsize > 0)
- return (ptr + eltsize * nitems);
+ return ptr + eltsize * nitems;
for (i = 0; i < nitems; i++)
ptr += INTALIGN(*(int32 *) ptr);
- return (ptr);
+ return ptr;
}
static int
if (eltsize > 0)
{
memmove(destptr, srcptr, eltsize * nitems);
- return (eltsize * nitems);
+ return eltsize * nitems;
}
for (i = inc = 0; i < nitems; i++)
{
destptr += tmp;
inc += tmp;
}
- return (inc);
+ return inc;
}
static void
-_LOArrayRange(int st[],
- int endp[],
+_LOArrayRange(int *st,
+ int *endp,
int bsize,
int srcfd,
int destfd,
static void
-_ReadArray(int st[],
- int endp[],
+_ReadArray(int *st,
+ int *endp,
int bsize,
int srcfd,
int destfd,
if (VARSIZE(v) - VARHDRSZ < inc)
{
pfree(v);
- return (-1);
+ return -1;
}
tmp += LOwrite((int) *destfd, v);
#endif
*srcfd += inc;
*destfd += inc;
}
- return (tmp);
+ return tmp;
#undef MAX_READ
}
if ((*fd = LOcreat(saveName, 0600, flag)) < 0)
elog(ERROR, "Large object create failed");
#endif
- return (p);
+ return p;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayutils.c,v 1.5 1997/09/08 02:30:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayutils.c,v 1.6 1998/09/01 03:25:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "utils/array.h"
int
-GetOffset(int n, int dim[], int lb[], int indx[])
+GetOffset(int n, int *dim, int *lb, int *indx)
{
int i,
scale,
}
int
-getNitems(int n, int a[])
+getNitems(int n, int *a)
{
int i,
ret;
}
int
-compute_size(int st[], int endp[], int n, int base)
+compute_size(int *st, int *endp, int n, int base)
{
int i,
ret;
}
void
-mda_get_offset_values(int n, int dist[], int PC[], int span[])
+mda_get_offset_values(int n, int *dist, int *PC, int *span)
{
int i,
j;
}
void
-mda_get_range(int n, int span[], int st[], int endp[])
+mda_get_range(int n, int *span, int *st, int *endp)
{
int i;
}
void
-mda_get_prod(int n, int range[], int P[])
+mda_get_prod(int n, int *range, int *P)
{
int i;
}
int
-tuple2linear(int n, int tup[], int scale[])
+tuple2linear(int n, int *tup, int *scale)
{
int i,
lin;
}
void
-array2chunk_coord(int n, int C[], int a_coord[], int c_coord[])
+array2chunk_coord(int n, int *C, int *a_coord, int *c_coord)
{
int i;
1 otherwise
-----------------------------------------------------------------------------*/
int
-next_tuple(int n, int curr[], int span[])
+next_tuple(int n, int *curr, int *span)
{
int i;
if (!n)
- return (-1);
+ return -1;
curr[n - 1] = (curr[n - 1] + 1) % span[n - 1];
for (i = n - 1; i * (!curr[i]); i--)
curr[i - 1] = (curr[i - 1] + 1) % span[i - 1];
if (i)
- return (i);
+ return i;
if (curr[0])
- return (0);
- return (-1);
+ return 0;
+ return -1;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.14 1998/02/26 04:36:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.15 1998/09/01 03:25:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
case 't':
case 'T':
if (strncasecmp(b, "true", strlen(b)) == 0)
- return (TRUE);
+ return TRUE;
break;
case 'f':
case 'F':
if (strncasecmp(b, "false", strlen(b)) == 0)
- return (FALSE);
+ return FALSE;
break;
case 'y':
case 'Y':
if (strncasecmp(b, "yes", strlen(b)) == 0)
- return (TRUE);
+ return TRUE;
break;
case '1':
if (strncasecmp(b, "1", strlen(b)) == 0)
- return (TRUE);
+ return TRUE;
break;
case 'n':
case 'N':
if (strncasecmp(b, "no", strlen(b)) == 0)
- return (FALSE);
+ return FALSE;
break;
case '0':
if (strncasecmp(b, "0", strlen(b)) == 0)
- return (FALSE);
+ return FALSE;
break;
default:
elog(ERROR, "Bad boolean external representation '%s'", b);
/* not reached */
- return (FALSE);
+ return FALSE;
} /* boolin() */
/*
*result = (b) ? 't' : 'f';
result[1] = '\0';
- return (result);
+ return result;
} /* boolout() */
bool
booleq(bool arg1, bool arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
boolne(bool arg1, bool arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
boollt(bool arg1, bool arg2)
{
- return (arg1 < arg2);
+ return arg1 < arg2;
}
bool
boolgt(bool arg1, bool arg2)
{
- return (arg1 > arg2);
+ return arg1 > arg2;
}
bool
istrue(bool arg1)
{
- return (arg1 == TRUE);
+ return arg1 == TRUE;
} /* istrue() */
bool
isfalse(bool arg1)
{
- return (arg1 != TRUE);
+ return arg1 != TRUE;
} /* isfalse() */
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.24 1998/06/15 19:29:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.25 1998/09/01 03:25:49 momjian Exp $
*/
#include
printf( "cashin- result is %d\n", *result);
#endif
- return (result);
+ return result;
} /* cash_in() */
strcpy(result, buf + count);
}
- return (result);
+ return result;
} /* cash_out() */
cash_eq(Cash *c1, Cash *c2)
{
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (FALSE);
+ return FALSE;
- return (*c1 == *c2);
+ return *c1 == *c2;
} /* cash_eq() */
bool
cash_ne(Cash *c1, Cash *c2)
{
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (FALSE);
+ return FALSE;
- return (*c1 != *c2);
+ return *c1 != *c2;
} /* cash_ne() */
bool
cash_lt(Cash *c1, Cash *c2)
{
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (FALSE);
+ return FALSE;
- return (*c1 < *c2);
+ return *c1 < *c2;
} /* cash_lt() */
bool
cash_le(Cash *c1, Cash *c2)
{
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (FALSE);
+ return FALSE;
- return (*c1 <= *c2);
+ return *c1 <= *c2;
} /* cash_le() */
bool
cash_gt(Cash *c1, Cash *c2)
{
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (FALSE);
+ return FALSE;
- return (*c1 > *c2);
+ return *c1 > *c2;
} /* cash_gt() */
bool
cash_ge(Cash *c1, Cash *c2)
{
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (FALSE);
+ return FALSE;
- return (*c1 >= *c2);
+ return *c1 >= *c2;
} /* cash_ge() */
Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't add cash", NULL);
*result = (*c1 + *c2);
- return (result);
+ return result;
} /* cash_pl() */
Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't subtract cash", NULL);
*result = (*c1 - *c2);
- return (result);
+ return result;
} /* cash_mi() */
Cash *result;
if (!PointerIsValid(f) || !PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't multiply cash", NULL);
*result = ((*f) * (*c));
- return (result);
+ return result;
} /* cash_mul_flt8() */
Cash *
flt8_mul_cash(float8 *f, Cash *c)
{
- return (cash_mul_flt8(c, f));
+ return cash_mul_flt8(c, f);
} /* flt8_mul_cash() */
Cash *result;
if (!PointerIsValid(f) || !PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't divide cash", NULL);
*result = rint(*c / *f);
- return (result);
+ return result;
} /* cash_div_flt8() */
/* cash_mul_flt4()
Cash *result;
if (!PointerIsValid(f) || !PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't multiply cash", NULL);
*result = ((*f) * (*c));
- return (result);
+ return result;
} /* cash_mul_flt4() */
Cash *
flt4_mul_cash(float4 *f, Cash *c)
{
- return (cash_mul_flt4(c, f));
+ return cash_mul_flt4(c, f);
} /* flt4_mul_cash() */
Cash *result;
if (!PointerIsValid(f) || !PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't divide cash", NULL);
*result = rint(*c / *f);
- return (result);
+ return result;
} /* cash_div_flt4() */
Cash *result;
if (!PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't multiply cash", NULL);
*result = ((i) * (*c));
- return (result);
+ return result;
} /* cash_mul_int4() */
Cash *
int4_mul_cash(int4 i, Cash *c)
{
- return (cash_mul_int4(c, i));
+ return cash_mul_int4(c, i);
} /* int4_mul_cash() */
Cash *result;
if (!PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't divide cash", NULL);
*result = rint(*c / i);
- return (result);
+ return result;
} /* cash_div_int4() */
Cash *result;
if (!PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't multiply cash", NULL);
*result = ((s) * (*c));
- return (result);
+ return result;
} /* cash_mul_int2() */
Cash *
int2_mul_cash(int2 s, Cash *c)
{
- return (cash_mul_int2(c, s));
+ return cash_mul_int2(c, s);
} /* int2_mul_cash() */
Cash *result;
if (!PointerIsValid(c))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't divide cash", NULL);
*result = rint(*c / s);
- return (result);
+ return result;
} /* cash_div_int2() */
Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't return larger cash", NULL);
*result = ((*c1 > *c2) ? *c1 : *c2);
- return (result);
+ return result;
} /* cashlarger() */
Cash *result;
if (!PointerIsValid(c1) || !PointerIsValid(c2))
- return (NULL);
+ return NULL;
if (!PointerIsValid(result = palloc(sizeof(Cash))))
elog(ERROR, "Memory allocation failed, can't return smaller cash", NULL);
*result = ((*c1 < *c2) ? *c1 : *c2);
- return (result);
+ return result;
} /* cashsmaller() */
strcat(buf, num_word(m0));
strcat(buf, m0 == 1 ? " cent" : " cents");
*buf = toupper(*buf);
- return (buf);
+ return buf;
} /* cash_words_out() */
/* deal with the simple cases first */
if (value <= 20)
- return (small[value]);
+ return small[value];
/* is it an even multiple of 100? */
if (!tu)
{
sprintf(buf, "%s hundred", small[value / 100]);
- return (buf);
+ return buf;
}
/* more than 99? */
sprintf(buf, "%s %s", big[tu / 10], small[tu % 10]);
}
- return (buf);
+ return buf;
} /* num_word() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.18 1998/04/26 04:07:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.19 1998/09/01 03:25:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
charin(char *ch)
{
if (ch == NULL)
- return ((int32) NULL);
- return ((int32) *ch);
+ return (int32) NULL;
+ return (int32) *ch;
}
/*
result[0] = (char) ch;
result[1] = '\0';
- return (result);
+ return result;
}
/*
else
c = atoi(s);
- return ((int32) c);
+ return (int32) c;
}
/*
result = palloc(12);
c2 = (CommandId) c;
sprintf(result, "%u", (unsigned) (c2));
- return (result);
+ return result;
}
bool
chareq(int8 arg1, int8 arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
charne(int8 arg1, int8 arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
charlt(int8 arg1, int8 arg2)
{
- return ((uint8) arg1 < (uint8) arg2);
+ return (uint8) arg1 < (uint8) arg2;
}
bool
charle(int8 arg1, int8 arg2)
{
- return ((uint8) arg1 <= (uint8) arg2);
+ return (uint8) arg1 <= (uint8) arg2;
}
bool
chargt(int8 arg1, int8 arg2)
{
- return ((uint8) arg1 > (uint8) arg2);
+ return (uint8) arg1 > (uint8) arg2;
}
bool
charge(int8 arg1, int8 arg2)
{
- return ((uint8) arg1 >= (uint8) arg2);
+ return (uint8) arg1 >= (uint8) arg2;
}
int8
charpl(int8 arg1, int8 arg2)
{
- return (arg1 + arg2);
+ return arg1 + arg2;
}
int8
charmi(int8 arg1, int8 arg2)
{
- return (arg1 - arg2);
+ return arg1 - arg2;
}
int8
charmul(int8 arg1, int8 arg2)
{
- return (arg1 * arg2);
+ return arg1 * arg2;
}
int8
chardiv(int8 arg1, int8 arg2)
{
- return (arg1 / arg2);
+ return arg1 / arg2;
}
bool
cideq(int8 arg1, int8 arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.16 1998/02/26 04:36:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.17 1998/09/01 03:25:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* non-export function prototypes */
static int
-_FindBestChunk(int size, int dmax[], int dbest[], int dim,
+_FindBestChunk(int size, int *dmax, int *dbest, int dim,
int A[MAXPAT][MAXDIM + 1], int N);
-static int get_next(int d[], int k, int C, int dmax[]);
-static void initialize_info(CHUNK_INFO *A, int ndim, int dim[], int chunk[]);
+static int get_next(int *d, int k, int C, int *dmax);
+static void initialize_info(CHUNK_INFO *A, int ndim, int *dim, int *chunk);
#ifdef LOARRAY
static void
-_ConvertToChunkFile(int n, int baseSize, int dim[], int C[],
+_ConvertToChunkFile(int n, int baseSize, int *dim, int *C,
int srcfd, int destfd);
static void
-read_chunk(int chunk_no[], int C[], char a_chunk[], int srcfd,
- int n, int baseSize, int PX[], int dist[]);
+read_chunk(int *chunk_no, int *C, char *a_chunk, int srcfd,
+ int n, int baseSize, int *PX, int *dist);
static int write_chunk(struct varlena * a_chunk, int ofile);
-static int seek_and_read(int pos, int size, char buff[], int fp, int from);
+static int seek_and_read(int pos, int size, char *buff, int fp, int from);
#endif
static int
_ChunkArray(int fd,
FILE *afd,
int ndim,
- int dim[],
+ int *dim,
int baseSize,
int *nbytes,
char *chunkfile)
*/
static int
_FindBestChunk(int size,
- int dmax[],
- int dbest[],
+ int *dmax,
+ int *dbest,
int dim,
int A[MAXPAT][MAXDIM + 1],
int N)
{
/*
- * compute the number of page fetches for a given chunk size (d[])
- * and access pattern (A[][])
+ * compute the number of page fetches for a given chunk size (*d)
+ * and access pattern (**A)
*/
int i,
j,
;
}
}
- return (mintc);
+ return mintc;
}
/*----------------------------------------------------------------------
*---------------------------------------------------------------------
*/
static int
-get_next(int d[], int k, int C, int dmax[])
+get_next(int *d, int k, int C, int *dmax)
{
int i,
j,
d[j] = min(temp, dmax[j]);
temp = max(1, temp / d[j]);
}
- return (1);
+ return 1;
}
for (j = 0, temp = 1; j < k; j++)
break;
}
if (i < 0)
- return (0);
+ return 0;
d[i]++;
j = C / temp;
d[j] = min(temp, dmax[j]);
temp = max(1, temp / d[j]);
}
- return (1);
+ return 1;
}
#ifdef LOARRAY
#endif
static void
-initialize_info(CHUNK_INFO *A, int ndim, int dim[], int chunk[])
+initialize_info(CHUNK_INFO *A, int ndim, int *dim, int *chunk)
{
int i;
static void
_ConvertToChunkFile(int n,
int baseSize,
- int dim[],
- int C[],
+ int *dim,
+ int *C,
int srcfd,
int destfd)
{
*--------------------------------------------------------------------------
*/
static void
-read_chunk(int chunk_no[],
- int C[],
- char a_chunk[],
+read_chunk(int *chunk_no,
+ int *C,
+ char *a_chunk,
int srcfd,
int n,
int baseSize,
- int PX[],
- int dist[])
+ int *PX,
+ int *dist)
{
int i,
j,
#ifdef LOARRAY
got_n = LOwrite(ofile, a_chunk);
#endif
- return (got_n);
+ return got_n;
}
/*--------------------------------------------------------------------------
*--------------------------------------------------------------------------
*/
static int
-seek_and_read(int pos, int size, char buff[], int fp, int from)
+seek_and_read(int pos, int size, char *buff, int fp, int from)
{
struct varlena *v = NULL;
elog(ERROR, "File read error");
memmove(buff, VARDATA(v), size);
pfree(v);
- return (1);
+ return 1;
}
*---------------------------------------------------------------------------
*/
int
-_ReadChunkArray(int st[],
- int endp[],
+_ReadChunkArray(int *st,
+ int *endp,
int bsize,
int fp,
char *destfp,
block_seek += (to_read / bsize);
/*
- * compute next tuple in range[]
+ * compute next tuple in *range
*/
{
int x;
range_end[i] = min((chunk_st[i] + chunk_off[i]) * C[i] + C[i] - 1, endp[i]);
}
} while (jj != -1);
- return (words_read);
+ return words_read;
}
/*------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
struct varlena *
-_ReadChunkArray1El(int st[],
+_ReadChunkArray1El(int *st,
int bsize,
int fp,
ArrayType *array,
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.25 1998/06/15 18:39:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.26 1998/09/01 03:25:53 momjian Exp $
*
* NOTES
* This code is actually (almost) unused.
static void reltime2tm(int32 time, struct tm * tm);
#if FALSE
-static int correct_unit(char unit[], int *unptr);
-static int correct_dir(char direction[], int *signptr);
+static int correct_unit(char *unit, int *unptr);
+static int correct_dir(char *direction, int *signptr);
#endif
case DTK_DELTA:
result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec);
result += (((tm->tm_year * 365) + (tm->tm_mon * 30) + tm->tm_mday) * (24 * 60 * 60));
- return (result);
+ return result;
default:
- return (INVALID_RELTIME);
+ return INVALID_RELTIME;
}
elog(ERROR, "Bad reltime (internal coding error) '%s'", str);
- return (INVALID_RELTIME);
+ return INVALID_RELTIME;
} /* reltimein() */
result = palloc(strlen(buf) + 1);
strcpy(result, buf);
- return (result);
+ return result;
} /* reltimeout() */
if (timevalue == INVALID_RELTIME)
{
strcpy(timestring, INVALID_RELTIME_STR);
- return (timestring);
+ return timestring;
}
if (timevalue == 0)
else
sprintf(timestring, "%c %lu %s %s", RELTIME_LABEL,
(quantity * -1), unit_tab[unitnr], RELTIME_PAST);
-return (timestring);
+return timestring;
}
#endif
interval->data[1] = i_end;
interval->status = T_INTERVAL_VALID;
}
- return (interval);
+ return interval;
}
pfree(p);
}
strcat(i_str, "\"]\0");
- return (i_str);
+ return i_str;
}
time = (((span > INT_MIN) && (span < INT_MAX)) ? span : INVALID_RELTIME);
}
- return (time);
+ return time;
} /* timespan_reltime() */
result->month = ((12 * year) + month);
}
- return (result);
+ return result;
} /* reltime_timespan() */
RelativeTimeIsValid(t2) &&
((t2 > 0) ? (t1 < NOEND_ABSTIME - t2)
: (t1 > NOSTART_ABSTIME - t2))) /* prevent overflow */
- return (t1 + t2);
+ return t1 + t2;
- return (INVALID_ABSTIME);
+ return INVALID_ABSTIME;
}
RelativeTimeIsValid(t2) &&
((t2 > 0) ? (t1 > NOSTART_ABSTIME + t2)
: (t1 < NOEND_ABSTIME + t2))) /* prevent overflow */
- return (t1 - t2);
+ return t1 - t2;
- return (INVALID_ABSTIME);
+ return INVALID_ABSTIME;
}
if (AbsoluteTimeIsReal(t1) &&
AbsoluteTimeIsReal(t2))
- return (t1 - t2);
+ return t1 - t2;
- return (INVALID_RELTIME);
+ return INVALID_RELTIME;
}
if (interval->status == T_INTERVAL_VALID && t != INVALID_ABSTIME)
return (abstimege(t, interval->data[0]) &&
abstimele(t, interval->data[1]));
- return (0);
+ return 0;
}
/*
intervalrel(TimeInterval interval)
{
if (interval->status == T_INTERVAL_VALID)
- return (abstimemi(interval->data[1], interval->data[0]));
+ return abstimemi(interval->data[1], interval->data[0]);
else
- return (INVALID_RELTIME);
+ return INVALID_RELTIME;
}
/*
time_t sec;
if (time(&sec) < 0)
- return (INVALID_ABSTIME);
- return ((AbsoluteTime) sec);
+ return INVALID_ABSTIME;
+ return (AbsoluteTime) sec;
}
/*
{
if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
return 0;
- return (t1 == t2);
+ return t1 == t2;
}
bool
{
if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
return 0;
- return (t1 != t2);
+ return t1 != t2;
}
bool
{
if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
return 0;
- return (t1 < t2);
+ return t1 < t2;
}
bool
{
if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
return 0;
- return (t1 > t2);
+ return t1 > t2;
}
bool
{
if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
return 0;
- return (t1 <= t2);
+ return t1 <= t2;
}
bool
{
if (t1 == INVALID_RELTIME || t2 == INVALID_RELTIME)
return 0;
- return (t1 >= t2);
+ return t1 >= t2;
}
intervalsame(TimeInterval i1, TimeInterval i2)
{
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
return (abstimeeq(i1->data[0], i2->data[0]) &&
abstimeeq(i1->data[1], i2->data[1]));
} /* intervalsame() */
t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
t10 = i1->data[0];
t11 = i1->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
|| (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
- return (FALSE);
+ return FALSE;
if (t10 == CURRENT_ABSTIME)
t10 = GetCurrentTransactionStartTime();
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11 - t10) == (t21 - t20));
+ return (t11 - t10) == (t21 - t20);
} /* intervaleq() */
/*
t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
t10 = i1->data[0];
t11 = i1->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
|| (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
- return (FALSE);
+ return FALSE;
if (t10 == CURRENT_ABSTIME)
t10 = GetCurrentTransactionStartTime();
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11 - t10) != (t21 - t20));
+ return (t11 - t10) != (t21 - t20);
} /* intervalne() */
/*
t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
t10 = i1->data[0];
t11 = i1->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
|| (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
- return (FALSE);
+ return FALSE;
if (t10 == CURRENT_ABSTIME)
t10 = GetCurrentTransactionStartTime();
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11 - t10) < (t21 - t20));
+ return (t11 - t10) < (t21 - t20);
} /* intervallt() */
/*
t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
t10 = i1->data[0];
t11 = i1->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
|| (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
- return (FALSE);
+ return FALSE;
if (t10 == CURRENT_ABSTIME)
t10 = GetCurrentTransactionStartTime();
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11 - t10) <= (t21 - t20));
+ return (t11 - t10) <= (t21 - t20);
} /* intervalle() */
/*
t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
t10 = i1->data[0];
t11 = i1->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
|| (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
- return (FALSE);
+ return FALSE;
if (t10 == CURRENT_ABSTIME)
t10 = GetCurrentTransactionStartTime();
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11 - t10) > (t21 - t20));
+ return (t11 - t10) > (t21 - t20);
} /* intervalgt() */
/*
t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (FALSE); /* invalid interval */
+ return FALSE; /* invalid interval */
t10 = i1->data[0];
t11 = i1->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
|| (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
- return (FALSE);
+ return FALSE;
if (t10 == CURRENT_ABSTIME)
t10 = GetCurrentTransactionStartTime();
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11 - t10) >= (t21 - t20));
+ return (t11 - t10) >= (t21 - t20);
} /* intervalge() */
RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
- return (0);
+ return 0;
rt = intervalrel(i);
- return (rt != INVALID_RELTIME && rt == t);
+ return rt != INVALID_RELTIME && rt == t;
}
/*
RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
- return (0);
+ return 0;
rt = intervalrel(i);
- return (rt != INVALID_RELTIME && rt != t);
+ return rt != INVALID_RELTIME && rt != t;
}
/*
RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
- return (0);
+ return 0;
rt = intervalrel(i);
- return (rt != INVALID_RELTIME && rt < t);
+ return rt != INVALID_RELTIME && rt < t;
}
/*
RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
- return (0);
+ return 0;
rt = intervalrel(i);
- return (rt != INVALID_RELTIME && rt > t);
+ return rt != INVALID_RELTIME && rt > t;
}
/*
RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
- return (0);
+ return 0;
rt = intervalrel(i);
- return (rt != INVALID_RELTIME && rt <= t);
+ return rt != INVALID_RELTIME && rt <= t;
}
/*
RelativeTime rt;
if ((i->status == T_INTERVAL_INVAL) || (t == INVALID_RELTIME))
- return (0);
+ return 0;
rt = intervalrel(i);
- return (rt != INVALID_RELTIME && rt >= t);
+ return rt != INVALID_RELTIME && rt >= t;
}
/*
intervalct(TimeInterval i1, TimeInterval i2)
{
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (0);
+ return 0;
return (abstimele(i1->data[0], i2->data[0]) &&
abstimege(i1->data[1], i2->data[1]));
}
intervalov(TimeInterval i1, TimeInterval i2)
{
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
- return (0);
+ return 0;
return (!(abstimelt(i1->data[1], i2->data[0]) ||
abstimegt(i1->data[0], i2->data[1])));
}
{
if (i->status == T_INTERVAL_INVAL)
return INVALID_ABSTIME;
- return (i->data[0]);
+ return i->data[0];
}
/*
{
if (i->status == T_INTERVAL_INVAL)
return INVALID_ABSTIME;
- return (i->data[1]);
+ return i->data[1];
}
switch (dtype)
{
case (DTK_DELTA):
- return ((abs(tm->tm_year) <= 68) ? 1 : 0);
+ return (abs(tm->tm_year) <= 68) ? 1 : 0;
break;
case (DTK_INVALID):
/* Test whether 'invalid time' identifier or not */
if (!strncmp(INVALID_RELTIME_STR, p, strlen(INVALID_RELTIME_STR) + 1))
- return (2); /* correct 'invalid time' identifier found */
+ return 2; /* correct 'invalid time' identifier found */
/* handle label of relative time */
if (c != RELTIME_LABEL)
- return (0); /* syntax error */
+ return 0; /* syntax error */
c = *++p;
if (c != ' ')
- return (0); /* syntax error */
+ return 0; /* syntax error */
p++;
/* handle the quantity */
*quantity = 0;
if (c == ' ')
break; /* correct quantity found */
else
- return (0); /* syntax error */
+ return 0; /* syntax error */
}
}
&& correct_unit(unit, unitnr))
break; /* correct unit found */
else
- return (0); /* syntax error */
+ return 0; /* syntax error */
}
}
break; /* correct direction found */
}
else
- return (0); /* syntax error */
+ return 0; /* syntax error */
}
}
-return (1);
+return 1;
}
/*
* (see function isreltime())
*/
static int
-correct_unit(char unit[], int *unptr)
+correct_unit(char *unit, int *unptr)
{
int j = 0;
if (strncmp(unit, unit_tab[j], strlen(unit_tab[j])) == 0)
{
*unptr = j;
- return (1);
+ return 1;
}
j++;
}
- return (0); /* invalid unit descriptor */
+ return 0; /* invalid unit descriptor */
}
/*
* else to 1
*/
static int
-correct_dir(char direction[], int *signptr)
+correct_dir(char *direction, int *signptr)
{
*signptr = 1;
if (strncmp(RELTIME_PAST, direction, strlen(RELTIME_PAST) + 1) == 0)
{
*signptr = -1;
- return (1);
+ return 1;
}
else
- return (0); /* invalid direction descriptor */
+ return 0; /* invalid direction descriptor */
}
#endif
if (IsSpace(c))
p++;
else if (c != '[')
- return (0); /* syntax error */
+ return 0; /* syntax error */
else
break;
}
if (IsSpace(c))
p++;
else if (c != '"')
- return (0); /* syntax error */
+ return 0; /* syntax error */
else
break;
}
p++;
if (strncmp(INVALID_INTERVAL_STR, p, strlen(INVALID_INTERVAL_STR)) == 0)
- return (0); /* undefined range, handled like a syntax
+ return 0; /* undefined range, handled like a syntax
* err. */
/* search for the end of the first date and change it to a NULL */
p1 = p;
if (IsSpace(c))
p++;
else if (c != '"')
- return (0); /* syntax error */
+ return 0; /* syntax error */
else
break;
}
if (IsSpace(c))
p++;
else if (c != ']')
- return (0); /* syntax error */
+ return 0; /* syntax error */
else
break;
}
p++;
c = *p;
if (c != '\0')
- return (0); /* syntax error */
+ return 0; /* syntax error */
/* it seems to be a valid interval */
- return (1);
+ return 1;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.24 1998/08/19 02:02:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.25 1998/09/01 03:25:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
date = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1));
- return (date);
+ return date;
} /* date_in() */
/* date_out()
strcpy(result, buf);
- return (result);
+ return result;
} /* date_out() */
bool
date_eq(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 == dateVal2);
+ return dateVal1 == dateVal2;
}
bool
date_ne(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 != dateVal2);
+ return dateVal1 != dateVal2;
}
bool
date_lt(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 < dateVal2);
+ return dateVal1 < dateVal2;
} /* date_lt() */
bool
date_le(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 <= dateVal2);
+ return dateVal1 <= dateVal2;
} /* date_le() */
bool
date_gt(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 > dateVal2);
+ return dateVal1 > dateVal2;
} /* date_gt() */
bool
date_ge(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 >= dateVal2);
+ return dateVal1 >= dateVal2;
} /* date_ge() */
int
DateADT
date_larger(DateADT dateVal1, DateADT dateVal2)
{
- return (date_gt(dateVal1, dateVal2) ? dateVal1 : dateVal2);
+ return date_gt(dateVal1, dateVal2) ? dateVal1 : dateVal2;
} /* date_larger() */
DateADT
date_smaller(DateADT dateVal1, DateADT dateVal2)
{
- return (date_lt(dateVal1, dateVal2) ? dateVal1 : dateVal2);
+ return date_lt(dateVal1, dateVal2) ? dateVal1 : dateVal2;
} /* date_smaller() */
/* Compute difference between two dates in days.
int4
date_mi(DateADT dateVal1, DateADT dateVal2)
{
- return (dateVal1 - dateVal2);
+ return dateVal1 - dateVal2;
} /* date_mi() */
/* Add a number of days to a date, giving a new date.
DateADT
date_pli(DateADT dateVal, int4 days)
{
- return (dateVal + days);
+ return dateVal + days;
} /* date_pli() */
/* Subtract a number of days from a date, giving a new date.
DateADT
date_mii(DateADT dateVal, int4 days)
{
- return (date_pli(dateVal, -days));
+ return date_pli(dateVal, -days);
} /* date_mii() */
if (tm2datetime(tm, fsec, &tz, result) != 0)
elog(ERROR, "Datetime out of range", NULL);
- return (result);
+ return result;
} /* date_datetime() */
result = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1));
- return (result);
+ return result;
} /* datetime_date() */
break;
}
- return (result);
+ return result;
} /* abstime_date() */
*time = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec + fsec);
- return (time);
+ return time;
} /* time_in() */
strcpy(result, buf);
- return (result);
+ return result;
} /* time_out() */
time_eq(TimeADT *time1, TimeADT *time2)
{
if (!PointerIsValid(time1) || !PointerIsValid(time2))
- return (FALSE);
+ return FALSE;
- return (*time1 == *time2);
+ return *time1 == *time2;
} /* time_eq() */
bool
time_ne(TimeADT *time1, TimeADT *time2)
{
if (!PointerIsValid(time1) || !PointerIsValid(time2))
- return (FALSE);
+ return FALSE;
- return (*time1 != *time2);
+ return *time1 != *time2;
} /* time_eq() */
bool
time_lt(TimeADT *time1, TimeADT *time2)
{
if (!PointerIsValid(time1) || !PointerIsValid(time2))
- return (FALSE);
+ return FALSE;
- return (*time1 < *time2);
+ return *time1 < *time2;
} /* time_eq() */
bool
time_le(TimeADT *time1, TimeADT *time2)
{
if (!PointerIsValid(time1) || !PointerIsValid(time2))
- return (FALSE);
+ return FALSE;
- return (*time1 <= *time2);
+ return *time1 <= *time2;
} /* time_eq() */
bool
time_gt(TimeADT *time1, TimeADT *time2)
{
if (!PointerIsValid(time1) || !PointerIsValid(time2))
- return (FALSE);
+ return FALSE;
- return (*time1 > *time2);
+ return *time1 > *time2;
} /* time_eq() */
bool
time_ge(TimeADT *time1, TimeADT *time2)
{
if (!PointerIsValid(time1) || !PointerIsValid(time2))
- return (FALSE);
+ return FALSE;
- return (*time1 >= *time2);
+ return *time1 >= *time2;
} /* time_eq() */
int
time_cmp(TimeADT *time1, TimeADT *time2)
{
- return ((*time1 < *time2) ? -1 : (((*time1 > *time2) ? 1 : 0)));
+ return (*time1 < *time2) ? -1 : (((*time1 > *time2) ? 1 : 0));
} /* time_cmp() */
*result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec + fsec);
- return (result);
+ return result;
} /* datetime_time() */
*result += *time;
}
- return (result);
+ return result;
} /* datetime_datetime() */
int32 /* RelativeTime */
int4reltime(int32 timevalue)
{
- return (timevalue);
+ return timevalue;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.10 1998/06/15 19:29:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.11 1998/09/01 03:25:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
}
- return (size);
+ return size;
}
/*-------------------------------------------------------------------------
else
{
if (value == 0)
- return ((Datum) NULL);
+ return (Datum) NULL;
realSize = datumGetSize(value, type, byVal, len);
/*
memmove(s, DatumGetPointer(value), realSize);
res = (Datum) s;
}
- return (res);
+ return res;
}
/*-------------------------------------------------------------------------
* are aligned inside the "Datum".
*/
if (value1 == value2)
- return (true);
+ return true;
else
- return (false);
+ return false;
}
else
{
size1 = datumGetSize(value1, type, byVal, len);
size2 = datumGetSize(value2, type, byVal, len);
if (size1 != size2)
- return (false);
+ return false;
s1 = (char *) DatumGetPointer(value1);
s2 = (char *) DatumGetPointer(value2);
if (!memcmp(s1, s2, size1))
- return (true);
+ return true;
else
- return (false);
+ return false;
}
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.55 1998/06/15 19:29:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.56 1998/09/01 03:25:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
elog(ERROR, "Internal coding error, can't input datetime '%s'", str);
}
- return (result);
+ return result;
} /* datetime_in() */
/* datetime_out()
char buf[MAXDATELEN + 1];
if (!PointerIsValid(dt))
- return (NULL);
+ return NULL;
if (DATETIME_IS_RESERVED(*dt))
{
strcpy(result, buf);
- return (result);
+ return result;
} /* datetime_out() */
elog(ERROR, "Internal coding error, can't input timespan '%s'", str);
}
- return (span);
+ return span;
} /* timespan_in() */
/* timespan_out()
char buf[MAXDATELEN + 1];
if (!PointerIsValid(span))
- return (NULL);
+ return NULL;
if (timespan2tm(*span, tm, &fsec) != 0)
- return (NULL);
+ return NULL;
if (EncodeTimeSpan(tm, fsec, DateStyle, buf) != 0)
elog(ERROR, "Unable to format timespan", NULL);
result = palloc(strlen(buf) + 1);
strcpy(result, buf);
- return (result);
+ return result;
} /* timespan_out() */
if (!PointerIsValid(datetime))
return FALSE;
- return (!DATETIME_NOT_FINITE(*datetime));
+ return !DATETIME_NOT_FINITE(*datetime);
} /* datetime_finite() */
bool
if (!PointerIsValid(timespan))
return FALSE;
- return (!TIMESPAN_NOT_FINITE(*timespan));
+ return !TIMESPAN_NOT_FINITE(*timespan);
} /* timespan_finite() */
#endif
}
- return (dt);
+ return dt;
} /* SetDateTime() */
/* datetime_relop - is datetime1 relop datetime2
if (DATETIME_IS_RELATIVE(dt2))
dt2 = SetDateTime(dt2);
- return (dt1 == dt2);
+ return dt1 == dt2;
} /* datetime_eq() */
bool
if (DATETIME_IS_RELATIVE(dt2))
dt2 = SetDateTime(dt2);
- return (dt1 != dt2);
+ return dt1 != dt2;
} /* datetime_ne() */
bool
if (DATETIME_IS_RELATIVE(dt2))
dt2 = SetDateTime(dt2);
- return (dt1 < dt2);
+ return dt1 < dt2;
} /* datetime_lt() */
bool
#ifdef DATEDEBUG
printf("datetime_gt- %f %s greater than %f\n", dt1, ((dt1 > dt2) ? "is" : "is not"), dt2);
#endif
- return (dt1 > dt2);
+ return dt1 > dt2;
} /* datetime_gt() */
bool
if (DATETIME_IS_RELATIVE(dt2))
dt2 = SetDateTime(dt2);
- return (dt1 <= dt2);
+ return dt1 <= dt2;
} /* datetime_le() */
bool
if (DATETIME_IS_RELATIVE(dt2))
dt2 = SetDateTime(dt2);
- return (dt1 >= dt2);
+ return dt1 >= dt2;
} /* datetime_ge() */
if (DATETIME_IS_INVALID(dt1))
{
- return ((DATETIME_IS_INVALID(dt2) ? 0 : 1));
+ return (DATETIME_IS_INVALID(dt2) ? 0 : 1);
}
else if (DATETIME_IS_INVALID(dt2))
{
- return (-1);
+ return -1;
}
else
dt2 = SetDateTime(dt2);
}
- return (((dt1 < dt2) ? -1 : ((dt1 > dt2) ? 1 : 0)));
+ return ((dt1 < dt2) ? -1 : ((dt1 > dt2) ? 1 : 0));
} /* datetime_cmp() */
if (timespan2->month != 0)
span2 += (timespan2->month * (30.0 * 86400));
- return (span1 < span2);
+ return span1 < span2;
} /* timespan_lt() */
bool
if (timespan2->month != 0)
span2 += (timespan2->month * (30.0 * 86400));
- return (span1 > span2);
+ return span1 > span2;
} /* timespan_gt() */
bool
if (timespan2->month != 0)
span2 += (timespan2->month * (30.0 * 86400));
- return (span1 <= span2);
+ return span1 <= span2;
} /* timespan_le() */
bool
if (timespan2->month != 0)
span2 += (timespan2->month * (30.0 * 86400));
- return (span1 >= span2);
+ return span1 >= span2;
} /* timespan_ge() */
if (TIMESPAN_IS_INVALID(*timespan1))
{
- return (TIMESPAN_IS_INVALID(*timespan2) ? 0 : 1);
+ return TIMESPAN_IS_INVALID(*timespan2) ? 0 : 1;
}
else if (TIMESPAN_IS_INVALID(*timespan2))
- return (-1);
+ return -1;
span1 = timespan1->time;
if (timespan1->month != 0)
if (timespan2->month != 0)
span2 += (timespan2->month * (30.0 * 86400));
- return ((span1 < span2) ? -1 : (span1 > span2) ? 1 : 0);
+ return (span1 < span2) ? -1 : (span1 > span2) ? 1 : 0;
} /* timespan_cmp() */
else
*result = ((dt2 < dt1) ? dt2 : dt1);
- return (result);
+ return result;
} /* datetime_smaller() */
DateTime *
else
*result = ((dt2 > dt1) ? dt2 : dt1);
- return (result);
+ return result;
} /* datetime_larger() */
result->time = JROUND(dt1 - dt2);
result->month = 0;
- return (result);
+ return result;
} /* datetime_mi() */
*result = dt;
}
- return (result);
+ return result;
} /* datetime_pl_span() */
DateTime *
result = datetime_pl_span(datetime, &tspan);
- return (result);
+ return result;
} /* datetime_mi_span() */
result->time = -(timespan->time);
result->month = -(timespan->month);
- return (result);
+ return result;
} /* timespan_um() */
}
}
- return (result);
+ return result;
} /* timespan_smaller() */
TimeSpan *
}
}
- return (result);
+ return result;
} /* timespan_larger() */
result->month = (span1->month + span2->month);
result->time = JROUND(span1->time + span2->time);
- return (result);
+ return result;
} /* timespan_pl() */
TimeSpan *
result->month = (span1->month - span2->month);
result->time = JROUND(span1->time - span2->time);
- return (result);
+ return result;
} /* timespan_mi() */
TimeSpan *
result->month = rint(span1->month / *arg2);
result->time = JROUND(span1->time / *arg2);
- return (result);
+ return result;
} /* timespan_div() */
/* datetime_age()
else
elog(ERROR, "Unable to decode datetime", NULL);
- return (result);
+ return result;
} /* datetime_age() */
pfree(str);
- return (result);
+ return result;
} /* datetime_text() */
result = datetime_in(dstr);
- return (result);
+ return result;
} /* text_datetime() */
pfree(str);
- return (result);
+ return result;
} /* timespan_text() */
result = timespan_in(dstr);
- return (result);
+ return result;
} /* text_timespan() */
/* datetime_trunc()
}
}
- return (result);
+ return result;
} /* datetime_trunc() */
/* timespan_trunc()
result = NULL;
}
- return (result);
+ return result;
} /* timespan_trunc() */
}
}
- return (result);
+ return result;
} /* datetime_part() */
*result = 0;
}
- return (result);
+ return result;
} /* timespan_part() */
result = NULL;
}
- return (result);
+ return result;
} /* datetime_zone() */
day = (date + 1) % 7;
- return (day);
+ return day;
} /* j2day() */
/* Julian day routines are not correct for negative Julian days */
if (!IS_VALID_JULIAN(tm->tm_year, tm->tm_mon, tm->tm_mday))
- return (-1);
+ return -1;
date = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1);
time = time2t(tm->tm_hour, tm->tm_min, (tm->tm_sec + fsec));
{
dt -= tz;
dt = JROUND(dt);
- return (dt);
+ return dt;
} /* dt2local() */
double
time2t(const int hour, const int min, const double sec)
{
- return ((((hour * 60) + min) * 60) + sec);
+ return (((hour * 60) + min) * 60) + sec;
} /* time2t() */
static void
*/
int
ParseDateTime(char *timestr, char *lowstr,
- char *field[], int ftype[], int maxfields, int *numfields)
+ char **field, int *ftype, int maxfields, int *numfields)
{
int nf = 0;
char *cp = timestr;
* then assume GMT time zone. - tgl 97/05/27
*/
int
-DecodeDateTime(char *field[], int ftype[], int nf,
+DecodeDateTime(char **field, int *ftype, int nf,
int *dtype, struct tm * tm, double *fsec, int *tzp)
{
int fmask = 0,
#endif
if ((*dtype == DTK_DATE) && ((fmask & DTK_DATE_M) != DTK_DATE_M))
- return (((fmask & DTK_TIME_M) == DTK_TIME_M) ? 1 : -1);
+ return ((fmask & DTK_TIME_M) == DTK_TIME_M) ? 1 : -1;
/* timezone not specified? then find local timezone if possible */
if ((*dtype == DTK_DATE) && ((fmask & DTK_DATE_M) == DTK_DATE_M)
* Interpret parsed string as time fields only.
*/
int
-DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, double *fsec)
+DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct tm * tm, double *fsec)
{
int fmask,
tmask,
tz = -tz;
*tzp = -tz;
- return (*cp != '\0');
+ return *cp != '\0';
} /* DecodeTimezone() */
}
}
- return (type);
+ return type;
} /* DecodeSpecial() */
* preceeding an hh:mm:ss field. - thomas 1998-04-30
*/
int
-DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, double *fsec)
+DecodeDateDelta(char **field, int *ftype, int nf, int *dtype, struct tm * tm, double *fsec)
{
int is_before = FALSE;
#endif
/* ensure that at least one time field has been found */
- return ((fmask != 0) ? 0 : -1);
+ return (fmask != 0) ? 0 : -1;
} /* DecodeDateDelta() */
*val = tp->value;
}
- return (type);
+ return type;
} /* DecodeUnits() */
#endif
strcpy(str, INVALID);
}
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
} /* EncodeSpecialDateTime() */
printf("EncodeDateOnly- date result is %s\n", str);
#endif
- return (TRUE);
+ return TRUE;
} /* EncodeDateOnly() */
printf("EncodeTimeOnly- time result is %s\n", str);
#endif
- return (TRUE);
+ return TRUE;
} /* EncodeTimeOnly() */
printf("EncodeDateTime- date result is %s\n", str);
#endif
- return (TRUE);
+ return TRUE;
} /* EncodeDateTime() */
u.c[0] = 0x80; /* sign bit */
u.c[1] = 0x10; /* DBL_MIN */
- return (j == u.epoch);
+ return j == u.epoch;
}
int
datetime_is_current(double j)
u.c[1] = 0x10; /* DBL_MIN */
- return (j == u.current);
+ return j == u.current;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.15 1998/06/15 19:29:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.16 1998/09/01 03:25:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
else
ind = 0;
strcat(str, file + ind);
- return (str);
+ return str;
}
char *
char *ret;
if (!s)
- return ((char *) NULL);
+ return (char *) NULL;
ret = (char *) palloc(strlen(s) + 1);
if (!ret)
elog(ERROR, "filename_out: palloc failed");
- return (strcpy(ret, s));
+ return strcpy(ret, s);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.31 1998/04/27 14:43:38 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.32 1998/09/01 03:25:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
return strcpy(ascii, "(null)");
sprintf(ascii, "%.*g", FLT_DIG, *num);
- return (ascii);
+ return ascii;
}
CheckFloat8Val(val);
*result = val;
- return (result);
+ return result;
}
return strcpy(ascii, "Infinity");
sprintf(ascii, "%.*g", DBL_DIG, *num);
- return (ascii);
+ return ascii;
}
/* ========== PUBLIC ROUTINES ========== */
result = (float32) palloc(sizeof(float32data));
*result = val;
- return (result);
+ return result;
}
/*
result = (float32) palloc(sizeof(float32data));
*result = val;
- return (result);
+ return result;
}
float32
val = fabs(*arg1);
CheckFloat8Val(val);
*result = val;
- return (result);
+ return result;
}
CheckFloat8Val(val);
result = (float64) palloc(sizeof(float64data));
*result = val;
- return (result);
+ return result;
}
float64
result = (float32) palloc(sizeof(float32data));
*result = val;
- return (result);
+ return result;
}
float32
CheckFloat4Val(val);
result = (float32) palloc(sizeof(float32data));
*result = val;
- return (result);
+ return result;
}
float32
CheckFloat4Val(val);
result = (float32) palloc(sizeof(float32data));
*result = val;
- return (result);
+ return result;
}
float32
CheckFloat4Val(val);
result = (float32) palloc(sizeof(float32data));
*result = *arg1 / *arg2;
- return (result);
+ return result;
}
float32
val = *arg1 + *arg2;
CheckFloat8Val(val);
*result = val;
- return (result);
+ return result;
}
float64
val = *arg1 - *arg2;
CheckFloat8Val(val);
*result = val;
- return (result);
+ return result;
}
float64
val = *arg1 * *arg2;
CheckFloat8Val(val);
*result = val;
- return (result);
+ return result;
}
float64
val = *arg1 / *arg2;
CheckFloat8Val(val);
*result = val;
- return (result);
+ return result;
}
float64
val = *arg1 + (float64data) 1.0;
CheckFloat8Val(val);
*arg1 = val;
- return (arg1);
+ return arg1;
}
if (!arg1 || !arg2)
return 0;
- return (*arg1 == *arg2);
+ return *arg1 == *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 != *arg2);
+ return *arg1 != *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 < *arg2);
+ return *arg1 < *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 <= *arg2);
+ return *arg1 <= *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 > *arg2);
+ return *arg1 > *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 >= *arg2);
+ return *arg1 >= *arg2;
}
/*
if (!arg1 || !arg2)
return 0;
- return (*arg1 == *arg2);
+ return *arg1 == *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 != *arg2);
+ return *arg1 != *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 < *arg2);
+ return *arg1 < *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 <= *arg2);
+ return *arg1 <= *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 > *arg2);
+ return *arg1 > *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 >= *arg2);
+ return *arg1 >= *arg2;
}
result = (float64) palloc(sizeof(float64data));
*result = *num;
- return (result);
+ return result;
}
result = (float32) palloc(sizeof(float32data));
*result = *num;
- return (result);
+ return result;
}
elog(ERROR, "dtoi4: integer out of range", NULL);
result = rint(*num);
- return (result);
+ return result;
}
elog(ERROR, "dtoi2: integer out of range", NULL);
result = rint(*num);
- return (result);
+ return result;
}
result = (float64) palloc(sizeof(float64data));
*result = num;
- return (result);
+ return result;
}
result = (float64) palloc(sizeof(float64data));
*result = num;
- return (result);
+ return result;
}
elog(ERROR, "ftoi4: integer out of range", NULL);
result = rint(*num);
- return (result);
+ return result;
}
elog(ERROR, "ftoi2: integer out of range", NULL);
result = rint(*num);
- return (result);
+ return result;
}
result = (float32) palloc(sizeof(float32data));
*result = num;
- return (result);
+ return result;
}
result = (float32) palloc(sizeof(float32data));
*result = num;
- return (result);
+ return result;
}
tmp = *arg1;
*result = (float64data) rint(tmp);
- return (result);
+ return result;
}
*result = (float64data) floor(tmp);
else
*result = (float64data) -(floor(-tmp));
- return (result);
+ return result;
}
tmp = *arg1;
*result = (float64data) sqrt(tmp);
- return (result);
+ return result;
}
tmp = *arg1;
*result = (float64data) cbrt(tmp);
- return (result);
+ return result;
}
elog(ERROR, "pow() result is out of range");
CheckFloat8Val(*result);
- return (result);
+ return result;
}
elog(ERROR, "exp() result is out of range");
CheckFloat8Val(*result);
- return (result);
+ return result;
}
*result = (float64data) log(tmp);
CheckFloat8Val(*result);
- return (result);
+ return result;
}
*result = *arg1 + *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
float64
*result = *arg1 - *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
float64
*result = *arg1 * *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
float64
*result = *arg1 / *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
/*
*result = *arg1 + *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
float64
*result = *arg1 - *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
float64
*result = *arg1 * *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
float64
*result = *arg1 / *arg2;
CheckFloat8Val(*result);
- return (result);
+ return result;
}
/*
if (!arg1 || !arg2)
return 0;
- return (*arg1 == (float) *arg2);
+ return *arg1 == (float) *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 != (float) *arg2);
+ return *arg1 != (float) *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 < (float) *arg2);
+ return *arg1 < (float) *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 <= (float) *arg2);
+ return *arg1 <= (float) *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 > (float) *arg2);
+ return *arg1 > (float) *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return (*arg1 >= (float) *arg2);
+ return *arg1 >= (float) *arg2;
}
/*
if (!arg1 || !arg2)
return 0;
- return ((float) *arg1 == *arg2);
+ return (float) *arg1 == *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return ((float) *arg1 != *arg2);
+ return (float) *arg1 != *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return ((float) *arg1 < *arg2);
+ return (float) *arg1 < *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return ((float) *arg1 <= *arg2);
+ return (float) *arg1 <= *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return ((float) *arg1 > *arg2);
+ return (float) *arg1 > *arg2;
}
bool
if (!arg1 || !arg2)
return 0;
- return ((float) *arg1 >= *arg2);
+ return (float) *arg1 >= *arg2;
}
/* ========== PRIVATE ROUTINES ========== */
int isneg = (x < 0.0);
double tmpres = pow(fabs(x), (double) 1.0 / (double) 3.0);
- return (isneg ? -tmpres : tmpres);
+ return isneg ? -tmpres : tmpres;
}
#endif /* !HAVE_CBRT */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.35 1998/08/16 04:06:55 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.36 1998/09/01 03:26:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* Internal routines
*/
-static int point_inside(Point *p, int npts, Point plist[]);
+static int point_inside(Point *p, int npts, Point *plist);
static int lseg_crossing(double x, double y, double px, double py);
static BOX *box_construct(double x1, double x2, double y1, double y2);
static BOX *box_copy(BOX *box);
static double lseg_dt(LSEG *l1, LSEG *l2);
static void make_bound_box(POLYGON *poly);
static PATH *path_copy(PATH *path);
-static bool plist_same(int npts, Point p1[], Point p2[]);
+static bool plist_same(int npts, Point *p1, Point *p2);
static Point *point_construct(double x, double y);
static Point *point_copy(Point *pt);
static int single_decode(char *str, float8 *x, char **ss);
char *cp;
if (!PointerIsValid(str))
- return (FALSE);
+ return FALSE;
while (isspace(*str))
str++;
fprintf(stderr, "single_decode- (%x) try decoding %s to %g\n", (cp - str), str, *x);
#endif
if (cp <= str)
- return (FALSE);
+ return FALSE;
while (isspace(*cp))
cp++;
if (s != NULL)
*s = cp;
- return (TRUE);
+ return TRUE;
} /* single_decode() */
static int
single_encode(float8 x, char *str)
{
sprintf(str, "%.*g", digits8, x);
- return (TRUE);
+ return TRUE;
} /* single_encode() */
static int
char *cp;
if (!PointerIsValid(str))
- return (FALSE);
+ return FALSE;
while (isspace(*str))
str++;
str++;
*x = strtod(str, &cp);
if (cp <= str)
- return (FALSE);
+ return FALSE;
while (isspace(*cp))
cp++;
if (*cp++ != DELIM)
- return (FALSE);
+ return FALSE;
while (isspace(*cp))
cp++;
*y = strtod(cp, &str);
if (str <= cp)
- return (FALSE);
+ return FALSE;
while (isspace(*str))
str++;
if (has_delim)
{
if (*str != RDELIM)
- return (FALSE);
+ return FALSE;
str++;
while (isspace(*str))
str++;
if (s != NULL)
*s = str;
- return (TRUE);
+ return TRUE;
}
static int
pair_encode(float8 x, float8 y, char *str)
{
sprintf(str, "%.*g,%.*g", digits8, x, digits8, y);
- return (TRUE);
+ return TRUE;
}
static int
{
/* no open delimiter allowed? */
if (!opentype)
- return (FALSE);
+ return FALSE;
depth++;
s++;
while (isspace(*s))
#if FALSE
/* nested delimiters with only one point? */
if (npts <= 1)
- return (FALSE);
+ return FALSE;
#endif
depth++;
s = cp;
for (i = 0; i < npts; i++)
{
if (!pair_decode(s, &(p->x), &(p->y), &s))
- return (FALSE);
+ return FALSE;
if (*s == DELIM)
s++;
s++;
}
else
- return (FALSE);
+ return FALSE;
}
*ss = s;
- return (TRUE);
+ return TRUE;
} /* path_decode() */
static char *
}
*cp = '\0';
- return (result);
+ return result;
} /* path_encode() */
/*-------------------------------------------------------------
ndelim++;
s++;
}
- return ((ndelim % 2) ? ((ndelim + 1) / 2) : -1);
+ return (ndelim % 2) ? ((ndelim + 1) / 2) : -1;
}
/***********************************************************************
box->low.y = y;
}
- return (box);
+ return box;
} /* box_in() */
/* box_out - convert a box to external form.
box_out(BOX *box)
{
if (!PointerIsValid(box))
- return (NULL);
+ return NULL;
- return (path_encode(-1, 2, (Point *) &(box->high)));
+ return path_encode(-1, 2, (Point *) &(box->high));
} /* box_out() */
{
BOX *result = palloc(sizeof(BOX));
- return (box_fill(result, x1, x2, y1, y2));
+ return box_fill(result, x1, x2, y1, y2);
}
result->low.y = y1;
}
- return (result);
+ return result;
}
memmove((char *) result, (char *) box, sizeof(BOX));
- return (result);
+ return result;
}
bool
box_overleft(BOX *box1, BOX *box2)
{
- return (FPle(box1->high.x, box2->high.x));
+ return FPle(box1->high.x, box2->high.x);
}
/* box_left - is box1 strictly left of box2?
bool
box_left(BOX *box1, BOX *box2)
{
- return (FPlt(box1->high.x, box2->low.x));
+ return FPlt(box1->high.x, box2->low.x);
}
/* box_right - is box1 strictly right of box2?
bool
box_right(BOX *box1, BOX *box2)
{
- return (FPgt(box1->low.x, box2->high.x));
+ return FPgt(box1->low.x, box2->high.x);
}
/* box_overright - is the left edge of box1 to the right of
bool
box_overright(BOX *box1, BOX *box2)
{
- return (box1->low.x >= box2->low.x);
+ return box1->low.x >= box2->low.x;
}
/* box_contained - is box1 contained by box2?
bool
box_below(BOX *box1, BOX *box2)
{
- return (FPle(box1->high.y, box2->low.y));
+ return FPle(box1->high.y, box2->low.y);
}
bool
box_above(BOX *box1, BOX *box2)
{
- return (FPge(box1->low.y, box2->high.y));
+ return FPge(box1->low.y, box2->high.y);
}
bool
box_lt(BOX *box1, BOX *box2)
{
- return (FPlt(box_ar(box1), box_ar(box2)));
+ return FPlt(box_ar(box1), box_ar(box2));
}
bool
box_gt(BOX *box1, BOX *box2)
{
- return (FPgt(box_ar(box1), box_ar(box2)));
+ return FPgt(box_ar(box1), box_ar(box2));
}
bool
box_eq(BOX *box1, BOX *box2)
{
- return (FPeq(box_ar(box1), box_ar(box2)));
+ return FPeq(box_ar(box1), box_ar(box2));
}
bool
box_le(BOX *box1, BOX *box2)
{
- return (FPle(box_ar(box1), box_ar(box2)));
+ return FPle(box_ar(box1), box_ar(box2));
}
bool
box_ge(BOX *box1, BOX *box2)
{
- return (FPge(box_ar(box1), box_ar(box2)));
+ return FPge(box_ar(box1), box_ar(box2));
}
*result = box_wd(box) * box_ht(box);
- return (result);
+ return result;
}
*result = box->high.x - box->low.x;
- return (result);
+ return result;
} /* box_width() */
*result = box->high.y - box->low.y;
- return (result);
+ return result;
}
pfree(a);
pfree(b);
- return (result);
+ return result;
}
result->x = (box->high.x + box->low.x) / 2.0;
result->y = (box->high.y + box->low.y) / 2.0;
- return (result);
+ return result;
}
static double
box_ar(BOX *box)
{
- return (box_wd(box) * box_ht(box));
+ return box_wd(box) * box_ht(box);
}
static double
box_wd(BOX *box)
{
- return (box->high.x - box->low.x);
+ return box->high.x - box->low.x;
}
static double
box_ht(BOX *box)
{
- return (box->high.y - box->low.y);
+ return box->high.y - box->low.y;
}
pfree(a);
pfree(b);
- return (result);
+ return result;
}
#endif
BOX *result;
if (!box_overlap(box1, box2))
- return (NULL);
+ return NULL;
result = palloc(sizeof(BOX));
result->high.y = Min(box1->high.y, box2->high.y);
result->low.y = Max(box1->low.y, box2->low.y);
- return (result);
+ return result;
}
p1.y = box->high.y;
p2.x = box->low.x;
p2.y = box->low.y;
- return (lseg_construct(&p1, &p2));
+ return lseg_construct(&p1, &p2);
}
/***********************************************************************
line = NULL;
#endif
- return (line);
+ return line;
} /* line_in() */
#endif
if (!PointerIsValid(line))
- return (NULL);
+ return NULL;
#ifdef ENABLE_LINE_TYPE
if (FPzero(line->B))
{
}
- return (path_encode(TRUE, 2, (Point *) &(ls->p[0])));
+ return path_encode(TRUE, 2, (Point *) &(ls->p[0]));
#else
elog(ERROR, "line not yet implemented");
result = NULL;
#endif
- return (result);
+ return result;
} /* line_out() */
result->m = m;
#endif
- return (result);
+ return result;
} /* line_construct_pm() */
result->m = result->A;
#endif
}
- return (result);
+ return result;
} /* line_construct_pp() */
bool
line_intersect(LINE *l1, LINE *l2)
{
- return (!line_parallel(l1, l2));
+ return !line_parallel(l1, l2);
}
bool
line_parallel(LINE *l1, LINE *l2)
{
#if FALSE
- return (FPeq(l1->m, l2->m));
+ return FPeq(l1->m, l2->m);
#endif
if (FPzero(l1->B))
- return (FPzero(l2->B));
+ return FPzero(l2->B);
- return (FPeq(l2->A, l1->A * (l2->B / l1->B)));
+ return FPeq(l2->A, l1->A * (l2->B / l1->B));
} /* line_parallel() */
bool
{
#if FALSE
if (l1->m)
- return (FPeq(l2->m / l1->m, -1.0));
+ return FPeq(l2->m / l1->m, -1.0);
else if (l2->m)
- return (FPeq(l1->m / l2->m, -1.0));
+ return FPeq(l1->m / l2->m, -1.0);
#endif
if (FPzero(l1->A))
- return (FPzero(l2->B));
+ return FPzero(l2->B);
else if (FPzero(l1->B))
- return (FPzero(l2->A));
+ return FPzero(l2->A);
- return (FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0));
+ return FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0);
} /* line_perp() */
bool
line_vertical(LINE *line)
{
#if FALSE
- return (FPeq(line->A, -1.0) && FPzero(line->B));
+ return FPeq(line->A, -1.0) && FPzero(line->B);
#endif
- return (FPzero(line->B));
+ return FPzero(line->B);
} /* line_vertical() */
bool
line_horizontal(LINE *line)
{
#if FALSE
- return (FPzero(line->m));
+ return FPzero(line->m);
#endif
- return (FPzero(line->A));
+ return FPzero(line->A);
} /* line_horizontal() */
bool
if (line_intersect(l1, l2))
{
*result = 0.0;
- return (result);
+ return result;
}
if (line_vertical(l1))
*result = fabs(l1->C - l2->C);
result = dist_pl(tmp, l2);
pfree(tmp);
}
- return (result);
+ return result;
}
/* line_interpt()
y;
if (line_parallel(l1, l2))
- return (NULL);
+ return NULL;
#if FALSE
if (line_vertical(l1))
result = point_construct(l2->m * l1->C + l2->C, l1->C);
digits8, l1->A, digits8, l1->B, digits8, l1->C, digits8, l2->A, digits8, l2->B, digits8, l2->C);
printf("line_interpt- lines intersect at (%.*g,%.*g)\n", digits8, x, digits8, y);
#endif
- return (result);
+ return result;
} /* line_interpt() */
path->closed = (!isopen);
- return (path);
+ return path;
} /* path_in() */
if (!PointerIsValid(path))
return NULL;
- return (path_encode(path->closed, path->npts, (Point *) &(path->p[0])));
+ return path_encode(path->closed, path->npts, (Point *) &(path->p[0]));
} /* path_out() */
bool
path_n_lt(PATH *p1, PATH *p2)
{
- return ((p1->npts < p2->npts));
+ return (p1->npts < p2->npts);
}
bool
path_n_gt(PATH *p1, PATH *p2)
{
- return ((p1->npts > p2->npts));
+ return (p1->npts > p2->npts);
}
bool
path_n_eq(PATH *p1, PATH *p2)
{
- return ((p1->npts == p2->npts));
+ return (p1->npts == p2->npts);
}
bool
path_n_le(PATH *p1, PATH *p2)
{
- return ((p1->npts <= p2->npts));
+ return (p1->npts <= p2->npts);
}
bool
path_n_ge(PATH *p1, PATH *p2)
{
- return ((p1->npts >= p2->npts));
+ return (p1->npts >= p2->npts);
}
if (!PointerIsValid(path))
return FALSE;
- return (path->closed);
+ return path->closed;
} /* path_isclosed() */
bool
if (!PointerIsValid(path))
return FALSE;
- return (!path->closed);
+ return !path->closed;
} /* path_isopen() */
if (!PointerIsValid(path))
return 0;
- return (path->npts);
+ return path->npts;
} /* path_npoints() */
PATH *
PATH *result;
if (!PointerIsValid(path))
- return (NULL);
+ return NULL;
result = path_copy(path);
result->closed = TRUE;
- return (result);
+ return result;
} /* path_close() */
PATH *result;
if (!PointerIsValid(path))
- return (NULL);
+ return NULL;
result = path_copy(path);
result->closed = FALSE;
- return (result);
+ return result;
} /* path_open() */
result = palloc(size);
memmove((char *) result, (char *) path, size);
- return (result);
+ return result;
} /* path_copy() */
b2.low.y = Min(p2->p[i].y, b2.low.y);
}
if (!box_overlap(&b1, &b2))
- return (FALSE);
+ return FALSE;
/* pairwise check lseg intersections */
for (i = 0; i < p1->npts - 1; i++)
statlseg_construct(&seg1, &p1->p[i], &p1->p[i + 1]);
statlseg_construct(&seg2, &p2->p[j], &p2->p[j + 1]);
if (lseg_intersect(&seg1, &seg2))
- return (TRUE);
+ return TRUE;
}
}
/* if we dropped through, no two segs intersected */
- return (FALSE);
+ return FALSE;
} /* path_inter() */
/* path_distance()
pfree(tmp);
}
- return (min);
+ return min;
} /* path_distance() */
for (i = 0; i < (path->npts - 1); i++)
*result += point_dt(&path->p[i], &path->p[i + 1]);
- return (result);
+ return result;
} /* path_length() */
for (i = 0; i < (path->npts - 1); i++)
result += point_dt(&path->p[i], &path->p[i + 1]);
- return (result);
+ return result;
} /* path_ln() */
#endif
point->x = x;
point->y = y;
- return (point);
+ return point;
} /* point_in() */
char *
point_out(Point *pt)
{
if (!PointerIsValid(pt))
- return (NULL);
+ return NULL;
- return (path_encode(-1, 1, pt));
+ return path_encode(-1, 1, pt);
} /* point_out() */
result->x = x;
result->y = y;
- return (result);
+ return result;
}
Point *result;
if (!PointerIsValid(pt))
- return (NULL);
+ return NULL;
result = palloc(sizeof(Point));
result->x = pt->x;
result->y = pt->y;
- return (result);
+ return result;
}
bool
point_left(Point *pt1, Point *pt2)
{
- return (FPlt(pt1->x, pt2->x));
+ return FPlt(pt1->x, pt2->x);
}
bool
point_right(Point *pt1, Point *pt2)
{
- return (FPgt(pt1->x, pt2->x));
+ return FPgt(pt1->x, pt2->x);
}
bool
point_above(Point *pt1, Point *pt2)
{
- return (FPgt(pt1->y, pt2->y));
+ return FPgt(pt1->y, pt2->y);
}
bool
point_below(Point *pt1, Point *pt2)
{
- return (FPlt(pt1->y, pt2->y));
+ return FPlt(pt1->y, pt2->y);
}
bool
point_vert(Point *pt1, Point *pt2)
{
- return (FPeq(pt1->x, pt2->x));
+ return FPeq(pt1->x, pt2->x);
}
bool
point_horiz(Point *pt1, Point *pt2)
{
- return (FPeq(pt1->y, pt2->y));
+ return FPeq(pt1->y, pt2->y);
}
bool
point_eq(Point *pt1, Point *pt2)
{
- return (point_horiz(pt1, pt2) && point_vert(pt1, pt2));
+ return point_horiz(pt1, pt2) && point_vert(pt1, pt2);
}
bool
point_ne(Point *pt1, Point *pt2)
{
- return (!point_eq(pt1, pt2));
+ return !point_eq(pt1, pt2);
}
/*----------------------------------------------------------
int32 result;
result = point_dt(p1, p2);
- return (result);
+ return result;
}
double *
double *result = palloc(sizeof(double));
*result = HYPOT(pt1->x - pt2->x, pt1->y - pt2->y);
- return (result);
+ return result;
}
printf("point_dt- segment (%f,%f),(%f,%f) length is %f\n",
pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y));
#endif
- return (HYPOT(pt1->x - pt2->x, pt1->y - pt2->y));
+ return HYPOT(pt1->x - pt2->x, pt1->y - pt2->y);
}
double *
*result = (double) DBL_MAX;
else
*result = (pt1->y - pt2->y) / (pt1->x - pt1->x);
- return (result);
+ return result;
}
lseg->m = point_sl(&lseg->p[0], &lseg->p[1]);
#endif
- return (lseg);
+ return lseg;
} /* lseg_in() */
lseg_out(LSEG *ls)
{
if (!PointerIsValid(ls))
- return (NULL);
+ return NULL;
- return (path_encode(FALSE, 2, (Point *) &(ls->p[0])));
+ return path_encode(FALSE, 2, (Point *) &(ls->p[0]));
} /* lseg_out() */
result->m = point_sl(pt1, pt2);
#endif
- return (result);
+ return result;
}
/* like lseg_construct, but assume space already allocated */
double *result;
if (!PointerIsValid(lseg))
- return (NULL);
+ return NULL;
result = point_distance(&lseg->p[0], &lseg->p[1]);
- return (result);
+ return result;
} /* lseg_length() */
/*----------------------------------------------------------
if (interpt != NULL)
pfree(interpt);
pfree(ln);
- return (retval);
+ return retval;
}
bool
lseg_parallel(LSEG *l1, LSEG *l2)
{
#if FALSE
- return (FPeq(l1->m, l2->m));
+ return FPeq(l1->m, l2->m);
#endif
return (FPeq(point_sl(&(l1->p[0]), &(l1->p[1])),
point_sl(&(l2->p[0]), &(l2->p[1]))));
printf("lseg_perp- slopes are %g and %g\n", m1, m2);
#endif
if (FPzero(m1))
- return (FPeq(m2, DBL_MAX));
+ return FPeq(m2, DBL_MAX);
else if (FPzero(m2))
- return (FPeq(m1, DBL_MAX));
+ return FPeq(m1, DBL_MAX);
- return (FPeq(m1 / m2, -1.0));
+ return FPeq(m1 / m2, -1.0);
} /* lseg_perp() */
bool
lseg_vertical(LSEG *lseg)
{
- return (FPeq(lseg->p[0].x, lseg->p[1].x));
+ return FPeq(lseg->p[0].x, lseg->p[1].x);
}
bool
lseg_horizontal(LSEG *lseg)
{
- return (FPeq(lseg->p[0].y, lseg->p[1].y));
+ return FPeq(lseg->p[0].y, lseg->p[1].y);
}
bool
lseg_lt(LSEG *l1, LSEG *l2)
{
- return (FPlt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
+ return FPlt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]));
} /* lseg_lt() */
bool
lseg_le(LSEG *l1, LSEG *l2)
{
- return (FPle(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
+ return FPle(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]));
} /* lseg_le() */
bool
lseg_gt(LSEG *l1, LSEG *l2)
{
- return (FPgt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
+ return FPgt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]));
} /* lseg_gt() */
bool
lseg_ge(LSEG *l1, LSEG *l2)
{
- return (FPge(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
+ return FPge(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1]));
} /* lseg_ge() */
*result = lseg_dt(l1, l2);
- return (result);
+ return result;
}
/* lseg_dt()
result;
if (lseg_intersect(l1, l2))
- return (0.0);
+ return 0.0;
d = dist_ps(&l1->p[0], l2);
result = *d;
result = Min(result, *d);
pfree(d);
- return (result);
+ return result;
} /* lseg_dt() */
Point *result;
if (!PointerIsValid(lseg))
- return (NULL);
+ return NULL;
result = palloc(sizeof(Point));
result->x = (lseg->p[0].x - lseg->p[1].x) / 2;
result->y = (lseg->p[0].y - lseg->p[1].y) / 2;
- return (result);
+ return result;
} /* lseg_center() */
*tmp2;
if (!PointerIsValid(l1) || !PointerIsValid(l2))
- return (NULL);
+ return NULL;
tmp1 = line_construct_pp(&l1->p[0], &l1->p[1]);
tmp2 = line_construct_pp(&l2->p[0], &l2->p[1]);
pfree(tmp1);
pfree(tmp2);
- return (result);
+ return result;
} /* lseg_interpt() */
/***********************************************************************
*result = (line->A * pt->x + line->B * pt->y + line->C) /
HYPOT(line->A, line->B);
- return (result);
+ return result;
}
double *
if (ip != NULL)
pfree(ip);
pfree(ln);
- return (result);
+ return result;
}
}
break;
}
- return (result);
+ return result;
}
double *
result = point_distance(tmp, pt);
pfree(tmp);
- return (result);
+ return result;
}
pfree(d2);
}
- return (result);
+ return result;
}
pfree(tmp);
}
- return (result);
+ return result;
}
pfree(tmp);
}
- return (result);
+ return result;
}
result = palloc(sizeof(double));
*result = 0;
- return (result);
+ return result;
}
/* initialize distance with segment between first and last points */
if (*result < 0)
*result = 0;
- return (result);
+ return result;
} /* dist_cpoly() */
}
pfree(tmp);
- return (p);
+ return p;
}
{
result->x = line->C;
result->y = pt->y;
- return (result);
+ return result;
#if FALSE
}
{
result->x = pt->x;
result->y = line->C;
- return (result);
+ return result;
}
/* drop a perpendicular and find the intersection point */
#if FALSE
invm = line->B / line->A;
tmp = line_construct_pm(pt, invm);
result = line_interpt(tmp, line);
- return (result);
+ return result;
} /* close_pl() */
else if (pt->y > lseg->p[yh].y)
result = point_copy(&lseg->p[yh]); /* above the lseg */
if (result != NULL)
- return (result);
+ return result;
/* point lines along (to left or right) of the vertical lseg. */
result = palloc(sizeof(*result));
result->x = lseg->p[0].x;
result->y = pt->y;
- return (result);
+ return result;
}
else if (lseg_horizontal(lseg))
{
else if (pt->x > lseg->p[xh].x)
result = point_copy(&lseg->p[xh]); /* right of the lseg */
if (result != NULL)
- return (result);
+ return result;
/* point lines along (at top or below) the horiz. lseg. */
result = palloc(sizeof(*result));
result->x = pt->x;
result->y = lseg->p[0].y;
- return (result);
+ return result;
}
/* vert. and horiz. cases are down, now check if the closest
/* fprintf(stderr,"tmp A %f B %f C %f m %f\n",tmp->A,tmp->B,tmp->C, tmp->m); */
result = interpt_sl(lseg, tmp);
/* fprintf(stderr,"result.x %f result.y %f\n", result->x, result->y); */
- return (result);
+ return result;
} /* close_ps() */
memcpy(result, &point, sizeof(*result));
}
- return (result);
+ return result;
} /* close_lseg() */
/* close_pb()
*d;
if (on_pb(pt, box))
- return (pt);
+ return pt;
/* pairwise check lseg distances */
point.x = box->low.x;
}
pfree(d);
- return (close_ps(pt, &lseg));
+ return close_ps(pt, &lseg);
} /* close_pb() */
/* close_sl()
result = interpt_sl(lseg, line);
if (result)
- return (result);
+ return result;
d1 = dist_pl(&lseg->p[0], line);
d2 = dist_pl(&lseg->p[1], line);
pfree(d1);
pfree(d2);
- return (result);
+ return result;
}
/* close_ls()
result = interpt_sl(lseg, line);
if (result)
- return (result);
+ return result;
d1 = dist_pl(&lseg->p[0], line);
d2 = dist_pl(&lseg->p[1], line);
pfree(d1);
pfree(d2);
- return (result);
+ return result;
} /* close_ls() */
/* close_sb()
pt = box_center(box);
result = close_ps(pt, lseg);
pfree(pt);
- return (result);
+ return result;
}
/* pairwise check lseg distances */
}
/* OK, we now have the closest line segment on the box boundary */
- return (close_lseg(lseg, &bseg));
+ return close_lseg(lseg, &bseg);
} /* close_sb() */
Point *
/* think about this one for a while */
elog(ERROR, "close_lb not implemented", NULL);
- return (NULL);
+ return NULL;
}
/*---------------------------------------------------------------------
on_pl(Point *pt, LINE *line)
{
if (!PointerIsValid(pt) || !PointerIsValid(line))
- return (FALSE);
+ return FALSE;
- return (FPzero(line->A * pt->x + line->B * pt->y + line->C));
+ return FPzero(line->A * pt->x + line->B * pt->y + line->C);
}
on_ps(Point *pt, LSEG *lseg)
{
if (!PointerIsValid(pt) || !PointerIsValid(lseg))
- return (FALSE);
+ return FALSE;
return (FPeq(point_dt(pt, &lseg->p[0]) + point_dt(pt, &lseg->p[1]),
point_dt(&lseg->p[0], &lseg->p[1])));
on_pb(Point *pt, BOX *box)
{
if (!PointerIsValid(pt) || !PointerIsValid(box))
- return (FALSE);
+ return FALSE;
return (pt->x <= box->high.x && pt->x >= box->low.x &&
pt->y <= box->high.y && pt->y >= box->low.y);
b;
if (!PointerIsValid(pt) || !PointerIsValid(path))
- return (FALSE);
+ return FALSE;
if (!path->closed)
{ /*-- OPEN --*/
b = point_dt(pt, &path->p[i + 1]);
if (FPeq(a + b,
point_dt(&path->p[i], &path->p[i + 1])))
- return (TRUE);
+ return TRUE;
a = b;
}
- return (FALSE);
+ return FALSE;
}
- return (point_inside(pt, path->npts, path->p));
+ return point_inside(pt, path->npts, path->p);
#if FALSE
inter = 0; /*-- CLOSED --*/
above = FPgt(path->p[0].y, pt->y) ? ABOVE :
if (FPeq(yh, yl)) /* horizontal seg? */
if (FPge(pt->x, xl) && FPle(pt->x, xh) &&
FPeq(pt->y, yh))
- return (TRUE); /* pt lies on seg */
+ return TRUE; /* pt lies on seg */
else
continue; /* skip other hz segs */
if (FPlt(yh, pt->y) || /* pt is strictly below seg */
&path->p[NEXT(i)]) +
path->p[i].x;
if (FPeq(x, pt->x)) /* pt lies on this seg */
- return (TRUE);
+ return TRUE;
/* does the seg actually cross the ray? */
on_sl(LSEG *lseg, LINE *line)
{
if (!PointerIsValid(lseg) || !PointerIsValid(line))
- return (FALSE);
+ return FALSE;
- return (on_pl(&lseg->p[0], line) && on_pl(&lseg->p[1], line));
+ return on_pl(&lseg->p[0], line) && on_pl(&lseg->p[1], line);
} /* on_sl() */
bool
on_sb(LSEG *lseg, BOX *box)
{
if (!PointerIsValid(lseg) || !PointerIsValid(box))
- return (FALSE);
+ return FALSE;
- return (on_pb(&lseg->p[0], box) && on_pb(&lseg->p[1], box));
+ return on_pb(&lseg->p[0], box) && on_pb(&lseg->p[1], box);
} /* on_sb() */
/*---------------------------------------------------------------------
Point *tmp;
if (!PointerIsValid(lseg) || !PointerIsValid(line))
- return (FALSE);
+ return FALSE;
tmp = interpt_sl(lseg, line);
if (tmp)
{
pfree(tmp);
- return (TRUE);
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
/* inter_sb()
Point point;
if (!PointerIsValid(lseg) || !PointerIsValid(box))
- return (FALSE);
+ return FALSE;
lbox.low.x = Min(lseg->p[0].x, lseg->p[1].x);
lbox.low.y = Min(lseg->p[0].y, lseg->p[1].y);
/* nothing close to overlap? then not going to intersect */
if (!box_overlap(&lbox, box))
- return (FALSE);
+ return FALSE;
/* an endpoint of segment is inside box? then clearly intersects */
if (on_pb(&lseg->p[0], box) || on_pb(&lseg->p[1], box))
- return (TRUE);
+ return TRUE;
/* pairwise check lseg intersections */
point.x = box->low.x;
point.y = box->high.y;
statlseg_construct(&bseg, &box->low, &point);
if (lseg_intersect(&bseg, lseg))
- return (TRUE);
+ return TRUE;
statlseg_construct(&bseg, &box->high, &point);
if (lseg_intersect(&bseg, lseg))
- return (TRUE);
+ return TRUE;
point.x = box->high.x;
point.y = box->low.y;
statlseg_construct(&bseg, &box->low, &point);
if (lseg_intersect(&bseg, lseg))
- return (TRUE);
+ return TRUE;
statlseg_construct(&bseg, &box->high, &point);
if (lseg_intersect(&bseg, lseg))
- return (TRUE);
+ return TRUE;
/* if we dropped through, no two segs intersected */
- return (FALSE);
+ return FALSE;
} /* inter_sb() */
/* inter_lb()
p2;
if (!PointerIsValid(line) || !PointerIsValid(box))
- return (FALSE);
+ return FALSE;
/* pairwise check lseg intersections */
p1.x = box->low.x;
p2.y = box->high.y;
statlseg_construct(&bseg, &p1, &p2);
if (inter_sl(&bseg, line))
- return (TRUE);
+ return TRUE;
p1.x = box->high.x;
p1.y = box->high.y;
statlseg_construct(&bseg, &p1, &p2);
if (inter_sl(&bseg, line))
- return (TRUE);
+ return TRUE;
p2.x = box->high.x;
p2.y = box->low.y;
statlseg_construct(&bseg, &p1, &p2);
if (inter_sl(&bseg, line))
- return (TRUE);
+ return TRUE;
p1.x = box->low.x;
p1.y = box->low.y;
statlseg_construct(&bseg, &p1, &p2);
if (inter_sl(&bseg, line))
- return (TRUE);
+ return TRUE;
/* if we dropped through, no intersection */
- return (FALSE);
+ return FALSE;
}
/*------------------------------------------------------------------
make_bound_box(poly);
- return (poly);
+ return poly;
} /* poly_in() */
/*---------------------------------------------------------------
if (!PointerIsValid(poly))
return NULL;
- return (path_encode(TRUE, poly->npts, &(poly->p[0])));
+ return path_encode(TRUE, poly->npts, &(poly->p[0]));
} /* poly_out() */
bool
poly_left(POLYGON *polya, POLYGON *polyb)
{
- return (polya->boundbox.high.x < polyb->boundbox.low.x);
+ return polya->boundbox.high.x < polyb->boundbox.low.x;
}
/*-------------------------------------------------------
bool
poly_overleft(POLYGON *polya, POLYGON *polyb)
{
- return (polya->boundbox.low.x <= polyb->boundbox.high.x);
+ return polya->boundbox.low.x <= polyb->boundbox.high.x;
}
/*-------------------------------------------------------
bool
poly_right(POLYGON *polya, POLYGON *polyb)
{
- return (polya->boundbox.low.x > polyb->boundbox.high.x);
+ return polya->boundbox.low.x > polyb->boundbox.high.x;
}
/*-------------------------------------------------------
bool
poly_overright(POLYGON *polya, POLYGON *polyb)
{
- return (polya->boundbox.high.x > polyb->boundbox.low.x);
+ return polya->boundbox.high.x > polyb->boundbox.low.x;
}
/*-------------------------------------------------------
if (polya->npts != polyb->npts)
return FALSE;
- return (plist_same(polya->npts, polya->p, polyb->p));
+ return plist_same(polya->npts, polya->p, polyb->p);
#if FALSE
for (i = 0; i < polya->npts; i++)
int i;
if (!PointerIsValid(polya) || !PointerIsValid(polyb))
- return (FALSE);
+ return FALSE;
if (box_contain(&(polya->boundbox), &(polyb->boundbox)))
{
#if GEODEBUG
printf("poly_contain- point (%f,%f) not in polygon\n", polyb->p[i].x, polyb->p[i].y);
#endif
- return (FALSE);
+ return FALSE;
}
}
for (i = 0; i < polya->npts; i++)
#if GEODEBUG
printf("poly_contain- point (%f,%f) in polygon\n", polya->p[i].x, polya->p[i].y);
#endif
- return (FALSE);
+ return FALSE;
}
}
- return (TRUE);
+ return TRUE;
}
#if GEODEBUG
printf("poly_contain- bound box ((%f,%f),(%f,%f)) not inside ((%f,%f),(%f,%f))\n",
polyb->boundbox.low.x, polyb->boundbox.low.y, polyb->boundbox.high.x, polyb->boundbox.high.y,
polya->boundbox.low.x, polya->boundbox.low.y, polya->boundbox.high.x, polya->boundbox.high.y);
#endif
- return (FALSE);
+ return FALSE;
} /* poly_contain() */
bool
poly_contained(POLYGON *polya, POLYGON *polyb)
{
- return (box_contained(&(polya->boundbox), &(polyb->boundbox)));
+ return box_contained(&(polya->boundbox), &(polyb->boundbox));
}
#endif
bool
poly_contained(POLYGON *polya, POLYGON *polyb)
{
- return (poly_contain(polyb, polya));
+ return poly_contain(polyb, polya);
} /* poly_contained() */
poly_contain_pt(POLYGON *poly, Point *p)
{
if (!PointerIsValid(poly) || !PointerIsValid(p))
- return (FALSE);
+ return FALSE;
- return (point_inside(p, poly->npts, &(poly->p[0])) != 0);
+ return point_inside(p, poly->npts, &(poly->p[0])) != 0;
} /* poly_contain_pt() */
bool
pt_contained_poly(Point *p, POLYGON *poly)
{
if (!PointerIsValid(p) || !PointerIsValid(poly))
- return (FALSE);
+ return FALSE;
- return (poly_contain_pt(poly, p));
+ return poly_contain_pt(poly, p);
} /* pt_contained_poly() */
double *result;
if (!PointerIsValid(polya) || !PointerIsValid(polyb))
- return (NULL);
+ return NULL;
result = palloc(sizeof(double));
*result = 0;
- return (result);
+ return result;
} /* poly_distance() */
point(float8 *x, float8 *y)
{
if (!(PointerIsValid(x) && PointerIsValid(y)))
- return (NULL);
+ return NULL;
- return (point_construct(*x, *y));
+ return point_construct(*x, *y);
} /* point() */
Point *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
- return (NULL);
+ return NULL;
result = palloc(sizeof(Point));
result->x = (p1->x + p2->x);
result->y = (p1->y + p2->y);
- return (result);
+ return result;
} /* point_add() */
Point *
Point *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
- return (NULL);
+ return NULL;
result = palloc(sizeof(Point));
result->x = (p1->x - p2->x);
result->y = (p1->y - p2->y);
- return (result);
+ return result;
} /* point_sub() */
Point *
Point *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
- return (NULL);
+ return NULL;
result = palloc(sizeof(Point));
result->x = (p1->x * p2->x) - (p1->y * p2->y);
result->y = (p1->x * p2->y) + (p1->y * p2->x);
- return (result);
+ return result;
} /* point_mul() */
Point *
double div;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
- return (NULL);
+ return NULL;
result = palloc(sizeof(Point));
result->x = ((p1->x * p2->x) + (p1->y * p2->y)) / div;
result->y = ((p2->x * p1->y) - (p2->y * p1->x)) / div;
- return (result);
+ return result;
} /* point_div() */
BOX *result;
if (!(PointerIsValid(p1) && PointerIsValid(p2)))
- return (NULL);
+ return NULL;
result = box_construct(p1->x, p2->x, p1->y, p2->y);
- return (result);
+ return result;
} /* box() */
BOX *
BOX *result;
if (!(PointerIsValid(box) && PointerIsValid(p)))
- return (NULL);
+ return NULL;
result = box_construct((box->high.x + p->x), (box->low.x + p->x),
(box->high.y + p->y), (box->low.y + p->y));
- return (result);
+ return result;
} /* box_add() */
BOX *
BOX *result;
if (!(PointerIsValid(box) && PointerIsValid(p)))
- return (NULL);
+ return NULL;
result = box_construct((box->high.x - p->x), (box->low.x - p->x),
(box->high.y - p->y), (box->low.y - p->y));
- return (result);
+ return result;
} /* box_sub() */
BOX *
*low;
if (!(PointerIsValid(box) && PointerIsValid(p)))
- return (NULL);
+ return NULL;
high = point_mul(&box->high, p);
low = point_mul(&box->low, p);
pfree(high);
pfree(low);
- return (result);
+ return result;
} /* box_mul() */
BOX *
*low;
if (!(PointerIsValid(box) && PointerIsValid(p)))
- return (NULL);
+ return NULL;
high = point_div(&box->high, p);
low = point_div(&box->low, p);
pfree(high);
pfree(low);
- return (result);
+ return result;
} /* box_div() */
if (!(PointerIsValid(p1) && PointerIsValid(p2))
|| p1->closed || p2->closed)
- return (NULL);
+ return NULL;
size = offsetof(PATH, p[0]) +(sizeof(p1->p[0]) * (p1->npts + p2->npts));
result = palloc(size);
result->p[i + p1->npts].y = p2->p[i].y;
}
- return (result);
+ return result;
} /* path_add() */
/* path_add_pt()
int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
- return (NULL);
+ return NULL;
result = path_copy(path);
result->p[i].y += point->y;
}
- return (result);
+ return result;
} /* path_add_pt() */
PATH *
int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
- return (NULL);
+ return NULL;
result = path_copy(path);
result->p[i].y -= point->y;
}
- return (result);
+ return result;
} /* path_sub_pt() */
int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
- return (NULL);
+ return NULL;
result = path_copy(path);
pfree(p);
}
- return (result);
+ return result;
} /* path_mul_pt() */
PATH *
int i;
if ((!PointerIsValid(path)) || (!PointerIsValid(point)))
- return (NULL);
+ return NULL;
result = path_copy(path);
pfree(p);
}
- return (result);
+ return result;
} /* path_div_pt() */
path_contain_pt(PATH *path, Point *p)
{
if (!PointerIsValid(path) || !PointerIsValid(p))
- return (FALSE);
+ return FALSE;
- return ((path->closed ? (point_inside(p, path->npts, &(path->p[0])) != 0) : FALSE));
+ return (path->closed ? (point_inside(p, path->npts, &(path->p[0])) != 0) : FALSE);
} /* path_contain_pt() */
bool
pt_contained_path(Point *p, PATH *path)
{
if (!PointerIsValid(p) || !PointerIsValid(path))
- return (FALSE);
+ return FALSE;
- return (path_contain_pt(path, p));
+ return path_contain_pt(path, p);
} /* pt_contained_path() */
Point *result;
if (!PointerIsValid(path))
- return (NULL);
+ return NULL;
elog(ERROR, "path_center not implemented", NULL);
result = palloc(sizeof(Point));
result = NULL;
- return (result);
+ return result;
} /* path_center() */
POLYGON *
int i;
if (!PointerIsValid(path))
- return (NULL);
+ return NULL;
if (!path->closed)
elog(ERROR, "Open path cannot be converted to polygon", NULL);
make_bound_box(poly);
- return (poly);
+ return poly;
} /* path_polygon() */
int i;
if (!PointerIsValid(path) || (path->npts < 2))
- return (NULL);
+ return NULL;
if (!isoldpath(path))
elog(ERROR, "upgradepath: path already upgraded?", NULL);
result->p[i].y = path->p[i + 1].y;
}
- return (result);
+ return result;
} /* upgradepath() */
bool
isoldpath(PATH *path)
{
if (!PointerIsValid(path) || (path->npts < 2))
- return (FALSE);
+ return FALSE;
- return (path->npts == (path->p[0].y + 1));
+ return path->npts == (path->p[0].y + 1);
} /* isoldpath() */
poly_npoints(POLYGON *poly)
{
if (!PointerIsValid(poly))
- return (FALSE);
+ return FALSE;
- return (poly->npts);
+ return poly->npts;
} /* poly_npoints() */
CIRCLE *circle;
if (!PointerIsValid(poly))
- return (NULL);
+ return NULL;
if (PointerIsValid(circle = poly_circle(poly)))
{
else
result = NULL;
- return (result);
+ return result;
} /* poly_center() */
BOX *box;
if (!PointerIsValid(poly) || (poly->npts < 1))
- return (NULL);
+ return NULL;
box = box_copy(&poly->boundbox);
- return (box);
+ return box;
} /* poly_box() */
int size;
if (!PointerIsValid(box))
- return (NULL);
+ return NULL;
/* map four corners of the box to a polygon */
size = offsetof(POLYGON, p[0]) +(sizeof(poly->p[0]) * 4);
box_fill(&poly->boundbox, box->high.x, box->low.x, box->high.y, box->low.y);
- return (poly);
+ return poly;
} /* box_poly() */
int i;
if (!PointerIsValid(poly) || (poly->npts < 0))
- return (NULL);
+ return NULL;
size = offsetof(PATH, p[0]) +(sizeof(path->p[0]) * poly->npts);
path = palloc(size);
path->p[i].y = poly->p[i].y;
}
- return (path);
+ return path;
} /* poly_path() */
ii;
if (!PointerIsValid(poly) || (poly->npts < 1))
- return (NULL);
+ return NULL;
size = offsetof(POLYGON, p[0]) +(sizeof(poly->p[0]) * poly->npts);
result = palloc(size);
result->p[2 * i + ii + 1].y = poly->p[i + n2 + ii].y; /* odd (+offset) indices */
}
- return (result);
+ return result;
} /* upgradepoly() */
/* revertpoly()
ii;
if (!PointerIsValid(poly) || (poly->npts < 1))
- return (NULL);
+ return NULL;
size = offsetof(POLYGON, p[0]) +(sizeof(poly->p[0]) * poly->npts);
result = palloc(size);
result->p[i + n2 + ii].y = poly->p[2 * i + ii + 1].y; /* odd (+offset) indices */
}
- return (result);
+ return result;
} /* revertpoly() */
if (*s != '\0')
elog(ERROR, "Bad circle external representation '%s'", str);
- return (circle);
+ return circle;
} /* circle_in() */
/* circle_out - convert a circle to external form.
char *cp;
if (!PointerIsValid(circle))
- return (NULL);
+ return NULL;
result = palloc(3 * (P_MAXLEN + 1) + 3);
*cp++ = RDELIM_C;
*cp = '\0';
- return (result);
+ return result;
} /* circle_out() */
bool
circle_overlap(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle(point_dt(&circle1->center, &circle2->center), (circle1->radius + circle2->radius)));
+ return FPle(point_dt(&circle1->center, &circle2->center), (circle1->radius + circle2->radius));
}
/* circle_overleft - is the right edge of circle1 to the left of
bool
circle_overleft(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle((circle1->center.x + circle1->radius), (circle2->center.x + circle2->radius)));
+ return FPle((circle1->center.x + circle1->radius), (circle2->center.x + circle2->radius));
}
/* circle_left - is circle1 strictly left of circle2?
bool
circle_left(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle((circle1->center.x + circle1->radius), (circle2->center.x - circle2->radius)));
+ return FPle((circle1->center.x + circle1->radius), (circle2->center.x - circle2->radius));
}
/* circle_right - is circle1 strictly right of circle2?
bool
circle_right(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPge((circle1->center.x - circle1->radius), (circle2->center.x + circle2->radius)));
+ return FPge((circle1->center.x - circle1->radius), (circle2->center.x + circle2->radius));
}
/* circle_overright - is the left edge of circle1 to the right of
bool
circle_overright(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPge((circle1->center.x - circle1->radius), (circle2->center.x - circle2->radius)));
+ return FPge((circle1->center.x - circle1->radius), (circle2->center.x - circle2->radius));
}
/* circle_contained - is circle1 contained by circle2?
bool
circle_contained(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle((point_dt(&circle1->center, &circle2->center) + circle1->radius), circle2->radius));
+ return FPle((point_dt(&circle1->center, &circle2->center) + circle1->radius), circle2->radius);
}
/* circle_contain - does circle1 contain circle2?
bool
circle_contain(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle((point_dt(&circle1->center, &circle2->center) + circle2->radius), circle1->radius));
+ return FPle((point_dt(&circle1->center, &circle2->center) + circle2->radius), circle1->radius);
}
bool
circle_below(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle((circle1->center.y + circle1->radius), (circle2->center.y - circle2->radius)));
+ return FPle((circle1->center.y + circle1->radius), (circle2->center.y - circle2->radius));
}
bool
circle_above(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPge((circle1->center.y - circle1->radius), (circle2->center.y + circle2->radius)));
+ return FPge((circle1->center.y - circle1->radius), (circle2->center.y + circle2->radius));
}
bool
circle_eq(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPeq(circle_ar(circle1), circle_ar(circle2)));
+ return FPeq(circle_ar(circle1), circle_ar(circle2));
} /* circle_eq() */
bool
circle_ne(CIRCLE *circle1, CIRCLE *circle2)
{
- return (!circle_eq(circle1, circle2));
+ return !circle_eq(circle1, circle2);
} /* circle_ne() */
bool
circle_lt(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPlt(circle_ar(circle1), circle_ar(circle2)));
+ return FPlt(circle_ar(circle1), circle_ar(circle2));
} /* circle_lt() */
bool
circle_gt(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPgt(circle_ar(circle1), circle_ar(circle2)));
+ return FPgt(circle_ar(circle1), circle_ar(circle2));
} /* circle_gt() */
bool
circle_le(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPle(circle_ar(circle1), circle_ar(circle2)));
+ return FPle(circle_ar(circle1), circle_ar(circle2));
} /* circle_le() */
bool
circle_ge(CIRCLE *circle1, CIRCLE *circle2)
{
- return (FPge(circle_ar(circle1), circle_ar(circle2)));
+ return FPge(circle_ar(circle1), circle_ar(circle2));
} /* circle_ge() */
result = palloc(sizeof(CIRCLE));
memmove((char *) result, (char *) circle, sizeof(CIRCLE));
- return (result);
+ return result;
} /* circle_copy() */
CIRCLE *result;
if (!PointerIsValid(circle) || !PointerIsValid(point))
- return (NULL);
+ return NULL;
result = circle_copy(circle);
result->center.x += point->x;
result->center.y += point->y;
- return (result);
+ return result;
} /* circle_add_pt() */
CIRCLE *
CIRCLE *result;
if (!PointerIsValid(circle) || !PointerIsValid(point))
- return (NULL);
+ return NULL;
result = circle_copy(circle);
result->center.x -= point->x;
result->center.y -= point->y;
- return (result);
+ return result;
} /* circle_sub_pt() */
Point *p;
if (!PointerIsValid(circle) || !PointerIsValid(point))
- return (NULL);
+ return NULL;
result = circle_copy(circle);
pfree(p);
result->radius *= HYPOT(point->x, point->y);
- return (result);
+ return result;
} /* circle_mul_pt() */
CIRCLE *
Point *p;
if (!PointerIsValid(circle) || !PointerIsValid(point))
- return (NULL);
+ return NULL;
result = circle_copy(circle);
pfree(p);
result->radius /= HYPOT(point->x, point->y);
- return (result);
+ return result;
} /* circle_div_pt() */
result = palloc(sizeof(double));
*result = circle_ar(circle);
- return (result);
+ return result;
}
result = palloc(sizeof(double));
*result = (2 * circle->radius);
- return (result);
+ return result;
}
result = palloc(sizeof(double));
*result = circle->radius;
- return (result);
+ return result;
}
if (*result < 0)
*result = 0;
- return (result);
+ return result;
} /* circle_distance() */
double *d;
if (!PointerIsValid(circle) || !PointerIsValid(point))
- return (FALSE);
+ return FALSE;
d = point_distance(&(circle->center), point);
within = (*d <= circle->radius);
pfree(d);
- return (within);
+ return within;
} /* circle_contain_pt() */
bool
pt_contained_circle(Point *point, CIRCLE *circle)
{
- return (circle_contain_pt(circle, point));
+ return circle_contain_pt(circle, point);
} /* circle_contain_pt() */
if (*result < 0)
*result = 0;
- return (result);
+ return result;
} /* dist_pc() */
result->x = circle->center.x;
result->y = circle->center.y;
- return (result);
+ return result;
}
static double
circle_ar(CIRCLE *circle)
{
- return (PI * (circle->radius * circle->radius));
+ return PI * (circle->radius * circle->radius);
}
result = point_dt(&circle1->center, &circle2->center);
- return (result);
+ return result;
}
#endif
CIRCLE *result;
if (!(PointerIsValid(center) && PointerIsValid(radius)))
- return (NULL);
+ return NULL;
result = palloc(sizeof(CIRCLE));
result->center.y = center->y;
result->radius = *radius;
- return (result);
+ return result;
}
double delta;
if (!PointerIsValid(circle))
- return (NULL);
+ return NULL;
box = palloc(sizeof(BOX));
box->high.y = circle->center.y + delta;
box->low.y = circle->center.y - delta;
- return (box);
+ return box;
} /* circle_box() */
/* box_circle()
CIRCLE *circle;
if (!PointerIsValid(box))
- return (NULL);
+ return NULL;
circle = palloc(sizeof(CIRCLE));
circle->radius = point_dt(&circle->center, &box->high);
- return (circle);
+ return circle;
} /* box_circle() */
double angle;
if (!PointerIsValid(circle))
- return (NULL);
+ return NULL;
if (FPzero(circle->radius) || (npts < 2))
elog(ERROR, "Unable to convert circle to polygon", NULL);
make_bound_box(poly);
- return (poly);
+ return poly;
}
/* poly_circle - convert polygon to circle
int i;
if (!PointerIsValid(poly))
- return (NULL);
+ return NULL;
if (poly->npts < 2)
elog(ERROR, "Unable to convert polygon to circle", NULL);
if (FPzero(circle->radius))
elog(ERROR, "Unable to convert polygon to circle", NULL);
- return (circle);
+ return circle;
} /* poly_circle() */
#define HIT_IT INT_MAX
static int
-point_inside(Point *p, int npts, Point plist[])
+point_inside(Point *p, int npts, Point *plist)
{
double x0,
y0;
{
if (FPzero(x))
{
- return (HIT_IT);
+ return HIT_IT;
}
else if (FPgt(x, 0))
{
if (FPzero(py))
- return (FPgt(px, 0) ? 0 : HIT_IT);
- return (FPlt(py, 0) ? 1 : -1);
+ return FPgt(px, 0) ? 0 : HIT_IT;
+ return FPlt(py, 0) ? 1 : -1;
}
else
{ /* x < 0 */
if (FPzero(py))
- return (FPlt(px, 0) ? 0 : HIT_IT);
- return (0);
+ return FPlt(px, 0) ? 0 : HIT_IT;
+ return 0;
}
}
/* Now we know y != 0; set sgn to sign of y */
sgn = (FPgt(y, 0) ? 1 : -1);
if (FPzero(py))
- return (FPlt(px, 0) ? 0 : sgn);
+ return FPlt(px, 0) ? 0 : sgn;
if (FPgt((sgn * py), 0))
{ /* y and py have same sign */
- return (0);
+ return 0;
}
else
{ /* y and py have opposite signs */
if (FPge(x, 0) && FPgt(px, 0))
- return (2 * sgn);
+ return 2 * sgn;
if (FPlt(x, 0) && FPle(px, 0))
- return (0);
+ return 0;
z = (x - px) * y - (y - py) * x;
if (FPzero(z))
- return (HIT_IT);
- return (FPgt((sgn * z), 0) ? 0 : 2 * sgn);
+ return HIT_IT;
+ return FPgt((sgn * z), 0) ? 0 : 2 * sgn;
}
} /* lseg_crossing() */
static bool
-plist_same(int npts, Point p1[], Point p2[])
+plist_same(int npts, Point *p1, Point *p2)
{
int i,
ii,
printf("plist_same- ii = %d/%d after forward match\n", ii, npts);
#endif
if (ii == npts)
- return (TRUE);
+ return TRUE;
/* match not found forwards? then look backwards */
for (ii = 1, j = i - 1; ii < npts; ii++, j--)
printf("plist_same- ii = %d/%d after reverse match\n", ii, npts);
#endif
if (ii == npts)
- return (TRUE);
+ return TRUE;
}
}
- return (FALSE);
+ return FALSE;
} /* plist_same() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.5 1997/09/08 02:30:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.6 1998/09/01 03:26:02 momjian Exp $
*
* XXX These are totally bogus.
*
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 4.0;
- return (result);
+ return result;
}
float64
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 4.0;
- return (result);
+ return result;
}
/*
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 6.0;
- return (result);
+ return result;
}
#endif
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 6.0;
- return (result);
+ return result;
}
#endif
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 10.0;
- return (result);
+ return result;
}
#endif
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 10.0;
- return (result);
+ return result;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.15 1998/02/26 04:37:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.16 1998/09/01 03:26:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int32
int2in(char *num)
{
- return ((int32) pg_atoi(num, sizeof(int16), '\0'));
+ return (int32) pg_atoi(num, sizeof(int16), '\0');
}
/*
result = (char *) palloc(7);/* assumes sign, 5 digits, '\0' */
itoa((int) sh, result);
- return (result);
+ return result;
}
/*
int16 *
int28in(char *shs)
{
- int16 (*result)[];
+ int16 **result;
int nums;
if (shs == NULL)
- return (NULL);
- result = (int16 (*)[]) palloc(sizeof(int16[8]));
+ return NULL;
+ result = (int16 **) palloc(sizeof(int16[8]));
if ((nums = sscanf(shs, "%hd%hd%hd%hd%hd%hd%hd%hd",
*result,
*result + 1,
(*result)[nums++] = 0;
while (nums < 8);
}
- return ((int16 *) result);
+ return (int16 *) result;
}
/*
* int28out - converts internal form to "num num ..."
*/
char *
-int28out(int16 (*shs)[])
+int28out(int16 **shs)
{
int num;
int16 *sp;
result = (char *) palloc(2);
result[0] = '-';
result[1] = '\0';
- return (result);
+ return result;
}
rp = result = (char *) palloc(8 * 7); /* assumes sign, 5 digits,
* ' ' */
*rp++ = ' ';
}
*--rp = '\0';
- return (result);
+ return result;
}
/*
while (i < 4)
foo[i++] = 0;
- return (foo);
+ return foo;
}
/*
* int28out - converts internal form to "num num ..."
*/
char *
-int44out(int32 an_array[])
+int44out(int32 *an_array)
{
int temp = 4;
char *output_string = NULL;
}
*--walk = '\0';
}
- return (output_string);
+ return output_string;
}
int32
int4in(char *num)
{
- return (pg_atoi(num, sizeof(int32), '\0'));
+ return pg_atoi(num, sizeof(int32), '\0');
}
/*
result = (char *) palloc(12); /* assumes sign, 10 digits, '\0' */
ltoa(l, result);
- return (result);
+ return result;
}
int32
i2toi4(int16 arg1)
{
- return ((int32) arg1);
+ return (int32) arg1;
}
int16
if (arg1 > SHRT_MAX)
elog(ERROR, "i4toi2: '%d' causes int2 overflow", arg1);
- return ((int16) arg1);
+ return (int16) arg1;
}
text *
pfree(str);
- return (result);
+ return result;
} /* int2_text() */
int16
result = int2in(str);
pfree(str);
- return (result);
+ return result;
} /* text_int2() */
text *
pfree(str);
- return (result);
+ return result;
} /* int4_text() */
int32
result = int4in(str);
pfree(str);
- return (result);
+ return result;
} /* text_int4() */
bool
int4eq(int32 arg1, int32 arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
int4ne(int32 arg1, int32 arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
int4lt(int32 arg1, int32 arg2)
{
- return (arg1 < arg2);
+ return arg1 < arg2;
}
bool
int4le(int32 arg1, int32 arg2)
{
- return (arg1 <= arg2);
+ return arg1 <= arg2;
}
bool
int4gt(int32 arg1, int32 arg2)
{
- return (arg1 > arg2);
+ return arg1 > arg2;
}
bool
int4ge(int32 arg1, int32 arg2)
{
- return (arg1 >= arg2);
+ return arg1 >= arg2;
}
bool
int2eq(int16 arg1, int16 arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
int2ne(int16 arg1, int16 arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
int2lt(int16 arg1, int16 arg2)
{
- return (arg1 < arg2);
+ return arg1 < arg2;
}
bool
int2le(int16 arg1, int16 arg2)
{
- return (arg1 <= arg2);
+ return arg1 <= arg2;
}
bool
int2gt(int16 arg1, int16 arg2)
{
- return (arg1 > arg2);
+ return arg1 > arg2;
}
bool
int2ge(int16 arg1, int16 arg2)
{
- return (arg1 >= arg2);
+ return arg1 >= arg2;
}
bool
int24eq(int32 arg1, int32 arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
int24ne(int32 arg1, int32 arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
int24lt(int32 arg1, int32 arg2)
{
- return (arg1 < arg2);
+ return arg1 < arg2;
}
bool
int24le(int32 arg1, int32 arg2)
{
- return (arg1 <= arg2);
+ return arg1 <= arg2;
}
bool
int24gt(int32 arg1, int32 arg2)
{
- return (arg1 > arg2);
+ return arg1 > arg2;
}
bool
int24ge(int32 arg1, int32 arg2)
{
- return (arg1 >= arg2);
+ return arg1 >= arg2;
}
bool
int42eq(int32 arg1, int32 arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
int42ne(int32 arg1, int32 arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
int42lt(int32 arg1, int32 arg2)
{
- return (arg1 < arg2);
+ return arg1 < arg2;
}
bool
int42le(int32 arg1, int32 arg2)
{
- return (arg1 <= arg2);
+ return arg1 <= arg2;
}
bool
int42gt(int32 arg1, int32 arg2)
{
- return (arg1 > arg2);
+ return arg1 > arg2;
}
bool
int42ge(int32 arg1, int32 arg2)
{
- return (arg1 >= arg2);
+ return arg1 >= arg2;
}
bool
keyfirsteq(int16 *arg1, int16 arg2)
{
- return (*arg1 == arg2);
+ return *arg1 == arg2;
}
/*
int32
int4um(int32 arg)
{
- return (-arg);
+ return -arg;
}
int32
int4pl(int32 arg1, int32 arg2)
{
- return (arg1 + arg2);
+ return arg1 + arg2;
}
int32
int4mi(int32 arg1, int32 arg2)
{
- return (arg1 - arg2);
+ return arg1 - arg2;
}
int32
int4mul(int32 arg1, int32 arg2)
{
- return (arg1 * arg2);
+ return arg1 * arg2;
}
int32
int4div(int32 arg1, int32 arg2)
{
- return (arg1 / arg2);
+ return arg1 / arg2;
}
int32
int4inc(int32 arg)
{
- return (arg + (int32) 1);
+ return arg + (int32) 1;
}
int16
int2um(int16 arg)
{
- return (-arg);
+ return -arg;
}
int16
int2pl(int16 arg1, int16 arg2)
{
- return (arg1 + arg2);
+ return arg1 + arg2;
}
int16
int2mi(int16 arg1, int16 arg2)
{
- return (arg1 - arg2);
+ return arg1 - arg2;
}
int16
int2mul(int16 arg1, int16 arg2)
{
- return (arg1 * arg2);
+ return arg1 * arg2;
}
int16
int2div(int16 arg1, int16 arg2)
{
- return (arg1 / arg2);
+ return arg1 / arg2;
}
int16
int2inc(int16 arg)
{
- return (arg + (int16) 1);
+ return arg + (int16) 1;
}
int32
int24pl(int32 arg1, int32 arg2)
{
- return (arg1 + arg2);
+ return arg1 + arg2;
}
int32
int24mi(int32 arg1, int32 arg2)
{
- return (arg1 - arg2);
+ return arg1 - arg2;
}
int32
int24mul(int32 arg1, int32 arg2)
{
- return (arg1 * arg2);
+ return arg1 * arg2;
}
int32
int24div(int32 arg1, int32 arg2)
{
- return (arg1 / arg2);
+ return arg1 / arg2;
}
int32
int42pl(int32 arg1, int32 arg2)
{
- return (arg1 + arg2);
+ return arg1 + arg2;
}
int32
int42mi(int32 arg1, int32 arg2)
{
- return (arg1 - arg2);
+ return arg1 - arg2;
}
int32
int42mul(int32 arg1, int32 arg2)
{
- return (arg1 * arg2);
+ return arg1 * arg2;
}
int32
int42div(int32 arg1, int32 arg2)
{
- return (arg1 / arg2);
+ return arg1 / arg2;
}
/*
int32
int4mod(int32 arg1, int32 arg2)
{
- return (arg1 % arg2);
+ return arg1 % arg2;
}
int32
int2mod(int16 arg1, int16 arg2)
{
- return (arg1 % arg2);
+ return arg1 % arg2;
}
int32
int24mod(int32 arg1, int32 arg2)
{
- return (arg1 % arg2);
+ return arg1 % arg2;
}
int32
int42mod(int32 arg1, int32 arg2)
{
- return (arg1 % arg2);
+ return arg1 % arg2;
}
/*
else
for (result = 1; arg1 > 0; --arg1)
result *= arg1;
- return (result);
+ return result;
}
int32
else
for (result = 1; arg1 > 0; --arg1)
result *= arg1;
- return (result);
+ return result;
}
int16
int2larger(int16 arg1, int16 arg2)
{
- return ((arg1 > arg2) ? arg1 : arg2);
+ return (arg1 > arg2) ? arg1 : arg2;
}
int16
int2smaller(int16 arg1, int16 arg2)
{
- return ((arg1 < arg2) ? arg1 : arg2);
+ return (arg1 < arg2) ? arg1 : arg2;
}
int32
int4larger(int32 arg1, int32 arg2)
{
- return ((arg1 > arg2) ? arg1 : arg2);
+ return (arg1 > arg2) ? arg1 : arg2;
}
int32
int4smaller(int32 arg1, int32 arg2)
{
- return ((arg1 < arg2) ? arg1 : arg2);
+ return (arg1 < arg2) ? arg1 : arg2;
}
result = NULL;
#endif
- return (result);
+ return result;
} /* int8in() */
char buf[MAXINT8LEN + 1];
if (!PointerIsValid(val))
- return (NULL);
+ return NULL;
if ((len = snprintf(buf, MAXINT8LEN, INT64_FORMAT, *val)) < 0)
elog(ERROR, "Unable to format int8", NULL);
strcpy(result, buf);
- return (result);
+ return result;
} /* int8out() */
bool
int8eq(int64 * val1, int64 * val2)
{
- return (*val1 == *val2);
+ return *val1 == *val2;
} /* int8eq() */
bool
int8ne(int64 * val1, int64 * val2)
{
- return (*val1 != *val2);
+ return *val1 != *val2;
} /* int8ne() */
bool
int8lt(int64 * val1, int64 * val2)
{
- return (*val1 < *val2);
+ return *val1 < *val2;
} /* int8lt() */
bool
int8gt(int64 * val1, int64 * val2)
{
- return (*val1 > *val2);
+ return *val1 > *val2;
} /* int8gt() */
bool
int8le(int64 * val1, int64 * val2)
{
- return (*val1 <= *val2);
+ return *val1 <= *val2;
} /* int8le() */
bool
int8ge(int64 * val1, int64 * val2)
{
- return (*val1 >= *val2);
+ return *val1 >= *val2;
} /* int8ge() */
bool
int84eq(int64 * val1, int32 val2)
{
- return (*val1 == val2);
+ return *val1 == val2;
} /* int84eq() */
bool
int84ne(int64 * val1, int32 val2)
{
- return (*val1 != val2);
+ return *val1 != val2;
} /* int84ne() */
bool
int84lt(int64 * val1, int32 val2)
{
- return (*val1 < val2);
+ return *val1 < val2;
} /* int84lt() */
bool
int84gt(int64 * val1, int32 val2)
{
- return (*val1 > val2);
+ return *val1 > val2;
} /* int84gt() */
bool
int84le(int64 * val1, int32 val2)
{
- return (*val1 <= val2);
+ return *val1 <= val2;
} /* int84le() */
bool
int84ge(int64 * val1, int32 val2)
{
- return (*val1 >= val2);
+ return *val1 >= val2;
} /* int84ge() */
bool
int48eq(int32 val1, int64 * val2)
{
- return (val1 == *val2);
+ return val1 == *val2;
} /* int48eq() */
bool
int48ne(int32 val1, int64 * val2)
{
- return (val1 != *val2);
+ return val1 != *val2;
} /* int48ne() */
bool
int48lt(int32 val1, int64 * val2)
{
- return (val1 < *val2);
+ return val1 < *val2;
} /* int48lt() */
bool
int48gt(int32 val1, int64 * val2)
{
- return (val1 > *val2);
+ return val1 > *val2;
} /* int48gt() */
bool
int48le(int32 val1, int64 * val2)
{
- return (val1 <= *val2);
+ return val1 <= *val2;
} /* int48le() */
bool
int48ge(int32 val1, int64 * val2)
{
- return (val1 >= *val2);
+ return val1 >= *val2;
} /* int48ge() */
result = int8mi(&temp, val);
#endif
- return (result);
+ return result;
} /* int8um() */
*result = *val1 + *val2;
- return (result);
+ return result;
} /* int8pl() */
int64 *
*result = *val1 - *val2;
- return (result);
+ return result;
} /* int8mi() */
int64 *
*result = *val1 * *val2;
- return (result);
+ return result;
} /* int8mul() */
int64 *
*result = *val1 / *val2;
- return (result);
+ return result;
} /* int8div() */
int64 *
#if FALSE
*result = ((*val1 > *val2)? *val1: *val2);
- return (result);
+ return result;
#endif
- return ((*val1 > *val2)? val1: val2);
+ return (*val1 > *val2)? val1: val2;
} /* int8larger() */
int64 *
#if FALSE
*result = ((*val1 < *val2)? *val1: *val2);
- return (result);
+ return result;
#endif
- return ((*val1 < *val2)? val1: val2);
+ return (*val1 < *val2)? val1: val2;
} /* int8smaller() */
*result = *val1 + (int64) val2;
- return (result);
+ return result;
} /* int84pl() */
int64 *
*result = *val1 - (int64) val2;
- return (result);
+ return result;
} /* int84mi() */
int64 *
*result = *val1 * (int64) val2;
- return (result);
+ return result;
} /* int84mul() */
int64 *
*result = *val1 / (int64) val2;
- return (result);
+ return result;
} /* int84div() */
*result = (int64) val1 + *val2;
- return (result);
+ return result;
} /* int48pl() */
int64 *
*result = (int64) val1 - *val2;
- return (result);
+ return result;
} /* int48mi() */
int64 *
*result = (int64) val1 * *val2;
- return (result);
+ return result;
} /* int48mul() */
int64 *
*result = (int64) val1 / *val2;
- return (result);
+ return result;
} /* int48div() */
*result = val;
- return (result);
+ return result;
} /* int48() */
int32
result = *val;
- return (result);
+ return result;
} /* int84() */
#if FALSE
*result = val;
- return (result);
+ return result;
} /* int28() */
int16
result = *val;
- return (result);
+ return result;
} /* int82() */
#endif
*result = *val;
- return (result);
+ return result;
} /* i8tod() */
/* dtoi8()
*result = *val;
- return (result);
+ return result;
} /* dtoi8() */
pfree(sterm);
pfree(pterm);
- return ((bool) result);
+ return (bool) result;
}
bool
{
if (!n)
return FALSE;
- return (fixedlen_like(n->data, p, NAMEDATALEN));
+ return fixedlen_like(n->data, p, NAMEDATALEN);
}
bool
namenlike(NameData *s, struct varlena * p)
{
- return (!namelike(s, p));
+ return !namelike(s, p);
}
bool
{
if (!s)
return FALSE;
- return (fixedlen_like(VARDATA(s), p, VARSIZE(s) - VARHDRSZ));
+ return fixedlen_like(VARDATA(s), p, VARSIZE(s) - VARHDRSZ);
}
bool
textnlike(struct varlena * s, struct varlena * p)
{
- return (!textlike(s, p));
+ return !textlike(s, p);
}
-/* $Revision: 1.18 $
+/* $Revision: 1.19 $
** "like.c" A first attempt at a LIKE operator for Postgres95.
**
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
{
if (p[0] == '%' && p[1] == '\0')
return TRUE;
- return (DoMatch(text, p) == LIKE_TRUE);
+ return DoMatch(text, p) == LIKE_TRUE;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.13 1998/06/09 19:20:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.14 1998/09/01 03:26:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (*isNull)
{
*isNull = false;
- return (true);
+ return true;
}
- return (false);
+ return false;
}
if (*isNull)
{
*isNull = false;
- return (false);
+ return false;
}
- return (true);
+ return true;
}
int32
userfntest(int i)
{
- return (i);
+ return i;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.44 1998/07/19 10:08:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.45 1998/09/01 03:26:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
CTZName, CTimeZone);
#endif
- return ((AbsoluteTime) now);
+ return (AbsoluteTime) now;
} /* GetCurrentAbsoluteTime() */
|| tm->tm_hour < 0 || tm->tm_hour >= 24
|| tm->tm_min < 0 || tm->tm_min > 59
|| tm->tm_sec < 0 || tm->tm_sec > 59)
- return (INVALID_ABSTIME);
+ return INVALID_ABSTIME;
day = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(1970, 1, 1));
/* check for time out of range */
if ((day < MIN_DAYNUM) || (day > MAX_DAYNUM))
- return (INVALID_ABSTIME);
+ return INVALID_ABSTIME;
/* convert to seconds */
sec = tm->tm_sec + tz + (tm->tm_min + (day * 24 + tm->tm_hour) * 60) * 60;
/* check for overflow */
if ((day == MAX_DAYNUM && sec < 0) ||
(day == MIN_DAYNUM && sec > 0))
- return (INVALID_ABSTIME);
+ return INVALID_ABSTIME;
/* check for reserved values (e.g. "current" on edge of usual range */
if (!AbsoluteTimeIsReal(sec))
- return (INVALID_ABSTIME);
+ return INVALID_ABSTIME;
- return (sec);
+ return sec;
} /* tm2abstime() */
result = palloc(strlen(buf) + 1);
strcpy(result, buf);
- return (result);
+ return result;
} /* nabstimeout() */
if (time2 == CURRENT_ABSTIME)
time2 = GetCurrentTransactionStartTime();
- return (time1 < time2);
+ return time1 < time2;
}
bool
if (time2 == CURRENT_ABSTIME)
time2 = GetCurrentTransactionStartTime();
- return (time1 > time2);
+ return time1 > time2;
}
abstimeeq(AbsoluteTime t1, AbsoluteTime t2)
{
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
- return (FALSE);
+ return FALSE;
if (t1 == CURRENT_ABSTIME)
t1 = GetCurrentTransactionStartTime();
if (t2 == CURRENT_ABSTIME)
t2 = GetCurrentTransactionStartTime();
- return (t1 == t2);
+ return t1 == t2;
}
bool
abstimene(AbsoluteTime t1, AbsoluteTime t2)
{
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
- return (FALSE);
+ return FALSE;
if (t1 == CURRENT_ABSTIME)
t1 = GetCurrentTransactionStartTime();
if (t2 == CURRENT_ABSTIME)
t2 = GetCurrentTransactionStartTime();
- return (t1 != t2);
+ return t1 != t2;
}
bool
abstimelt(AbsoluteTime t1, AbsoluteTime t2)
{
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
- return (FALSE);
+ return FALSE;
if (t1 == CURRENT_ABSTIME)
t1 = GetCurrentTransactionStartTime();
if (t2 == CURRENT_ABSTIME)
t2 = GetCurrentTransactionStartTime();
- return (t1 < t2);
+ return t1 < t2;
}
bool
abstimegt(AbsoluteTime t1, AbsoluteTime t2)
{
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
- return (FALSE);
+ return FALSE;
if (t1 == CURRENT_ABSTIME)
t1 = GetCurrentTransactionStartTime();
if (t2 == CURRENT_ABSTIME)
t2 = GetCurrentTransactionStartTime();
- return (t1 > t2);
+ return t1 > t2;
}
bool
abstimele(AbsoluteTime t1, AbsoluteTime t2)
{
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
- return (FALSE);
+ return FALSE;
if (t1 == CURRENT_ABSTIME)
t1 = GetCurrentTransactionStartTime();
if (t2 == CURRENT_ABSTIME)
t2 = GetCurrentTransactionStartTime();
- return (t1 <= t2);
+ return t1 <= t2;
}
bool
abstimege(AbsoluteTime t1, AbsoluteTime t2)
{
if (t1 == INVALID_ABSTIME || t2 == INVALID_ABSTIME)
- return (FALSE);
+ return FALSE;
if (t1 == CURRENT_ABSTIME)
t1 = GetCurrentTransactionStartTime();
if (t2 == CURRENT_ABSTIME)
t2 = GetCurrentTransactionStartTime();
- return (t1 >= t2);
+ return t1 >= t2;
}
};
};
- return (result);
+ return result;
} /* datetime_abstime() */
/* abstime_datetime()
break;
};
- return (result);
+ return result;
} /* abstime_datetime() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.13 1998/06/15 19:29:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.14 1998/09/01 03:26:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int len;
if (s == NULL)
- return (NULL);
+ return NULL;
result = (NameData *) palloc(NAMEDATALEN);
/* always keep it null-padded */
StrNCpy(result->data, s, NAMEDATALEN);
*(result->data + len) = '\0';
len++;
}
- return (result);
+ return result;
}
/*
if (!arg1 || !arg2)
return 0;
else
- return ((bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0);
+ return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0;
}
bool
namene(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
- return ((bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) != 0));
+ return (bool) 0;
+ return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) != 0);
}
bool
namelt(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
- return ((bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) < 0));
+ return (bool) 0;
+ return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) < 0);
}
bool
namele(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
- return ((bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) <= 0));
+ return (bool) 0;
+ return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) <= 0);
}
bool
namegt(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
- return ((bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) > 0));
+ return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) > 0);
}
bool
namege(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
- return ((bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) >= 0));
+ return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) >= 0);
}
namecpy(Name n1, Name n2)
{
if (!n1 || !n2)
- return (-1);
+ return -1;
strncpy(n1->data, n2->data, NAMEDATALEN);
- return (0);
+ return 0;
}
#ifdef NOT_USED
int
namecat(Name n1, Name n2)
{
- return (namestrcat(n1, n2->data)); /* n2 can't be any longer than n1 */
+ return namestrcat(n1, n2->data); /* n2 can't be any longer than n1 */
}
#endif
int
namecmp(Name n1, Name n2)
{
- return (strncmp(n1->data, n2->data, NAMEDATALEN));
+ return strncmp(n1->data, n2->data, NAMEDATALEN);
}
int
namestrcpy(Name name, char *str)
{
if (!name || !str)
- return (-1);
+ return -1;
StrNCpy(name->data, str, NAMEDATALEN);
- return (0);
+ return 0;
}
#ifdef NOT_USED
*q;
if (!name || !str)
- return (-1);
+ return -1;
for (i = 0, p = name->data; i < NAMEDATALEN && *p; ++i, ++p)
;
for (q = str; i < NAMEDATALEN; ++i, ++p, ++q)
if (!*q)
break;
}
- return (0);
+ return 0;
}
#endif
namestrcmp(Name name, char *str)
{
if (!name && !str)
- return (0);
+ return 0;
if (!name)
- return (-1); /* NULL < anything */
+ return -1; /* NULL < anything */
if (!str)
- return (1); /* NULL < anything */
- return (strncmp(name->data, str, NAMEDATALEN));
+ return 1; /* NULL < anything */
+ return strncmp(name->data, str, NAMEDATALEN);
}
/*****************************************************************************
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.11 1998/08/19 02:02:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.12 1998/09/01 03:26:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
value = heap_getattr(current_tuple,
(AttrNumber) attrid,
- RelationGetTupleDescriptor(relation_to_scan),
+ RelationGetDescr(relation_to_scan),
&dummy);
integer_value = DatumGetInt16(value);
/* close the relation */
heap_close(relation_to_scan);
- return (retval);
+ return retval;
}
bool
{
if (the_oid == InvalidOid)
return false;
- return (int4notin(the_oid, compare));
+ return int4notin(the_oid, compare);
}
/*
for (i = 0; i < rd->rd_rel->relnatts; i++)
{
if (!namestrcmp(&rd->rd_att->attrs[i]->attname, a))
- return (i + 1);
+ return i + 1;
}
- return (-1);
+ return -1;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.24 1998/06/15 19:29:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.25 1998/09/01 03:26:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
default:
elog(ERROR, "pg_atoi: invalid result size: %d", size);
}
- return ((int32) l);
+ return (int32) l;
}
/*
{
MemSet(ascii, '*', width - 2);
ascii[width] = 0;
- return (0);
+ return 0;
}
strcpy(ascii, out);
- return (ret);
+ return ret;
#else
auto int expon;
auto int sign;
for (avail = width; avail > 0; avail--)
*a++ = '*';
*a = 0;
- return (0);
+ return 0;
}
/* it fits; output the number */
/* finally, we can return */
*a = 0;
avail = a - ascii;
- return (avail);
+ return avail;
#endif
}
{
/* if no exponent, then nothing */
if (c != 0)
- return (-1);
+ return -1;
}
/* store the result and exit */
if (minus)
v = -v;
*val = v;
- return (0);
+ return 0;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.16 1998/08/19 02:02:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.17 1998/09/01 03:26:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
Oid *
oid8in(char *oidString)
{
- Oid (*result)[];
+ Oid **result;
int nums;
if (oidString == NULL)
- return (NULL);
- result = (Oid (*)[]) palloc(sizeof(Oid[8]));
+ return NULL;
+ result = (Oid **) palloc(sizeof(Oid[8]));
if ((nums = sscanf(oidString, "%d%d%d%d%d%d%d%d",
&(*result)[0],
&(*result)[1],
(*result)[nums++] = 0;
while (nums < 8);
}
- return ((Oid *) result);
+ return (Oid *) result;
}
/*
* oid8out - converts internal form to "num num ..."
*/
char *
-oid8out(Oid (*oidArray)[])
+oid8out(Oid **oidArray)
{
int num;
Oid *sp;
result = (char *) palloc(2);
result[0] = '-';
result[1] = '\0';
- return (result);
+ return result;
}
/* assumes sign, 10 digits, ' ' */
*rp++ = ' ';
}
*--rp = '\0';
- return (result);
+ return result;
}
Oid
oidin(char *s)
{
- return (int4in(s));
+ return int4in(s);
}
char *
oidout(Oid o)
{
- return (int4out(o));
+ return int4out(o);
}
/*****************************************************************************
bool
oideq(Oid arg1, Oid arg2)
{
- return (arg1 == arg2);
+ return arg1 == arg2;
}
bool
oidne(Oid arg1, Oid arg2)
{
- return (arg1 != arg2);
+ return arg1 != arg2;
}
bool
-oid8eq(Oid arg1[], Oid arg2[])
+oid8eq(Oid *arg1, Oid *arg2)
{
return (bool) (memcmp(arg1, arg2, 8 * sizeof(Oid)) == 0);
}
bool
-oid8lt(Oid arg1[], Oid arg2[])
+oid8lt(Oid *arg1, Oid *arg2)
{
int i;
for (i=0; i < 8; i++)
}
bool
-oid8le(Oid arg1[], Oid arg2[])
+oid8le(Oid *arg1, Oid *arg2)
{
int i;
for (i=0; i < 8; i++)
}
bool
-oid8ge(Oid arg1[], Oid arg2[])
+oid8ge(Oid *arg1, Oid *arg2)
{
int i;
for (i=0; i < 8; i++)
}
bool
-oid8gt(Oid arg1[], Oid arg2[])
+oid8gt(Oid *arg1, Oid *arg2)
{
int i;
for (i=0; i < 8; i++)
oideqint4(Oid arg1, int32 arg2)
{
/* oid is unsigned, but int4 is signed */
- return (arg2 >= 0 && arg1 == arg2);
+ return arg2 >= 0 && arg1 == arg2;
}
bool
int4eqoid(int32 arg1, Oid arg2)
{
/* oid is unsigned, but int4 is signed */
- return (arg1 >= 0 && arg1 == arg2);
+ return arg1 >= 0 && arg1 == arg2;
}
text *
memmove(VARDATA(result), str, (len - VARHDRSZ));
pfree(str);
- return (result);
+ return result;
} /* oid_text() */
Oid
result = oidin(str);
pfree(str);
- return (result);
+ return result;
} /* oid_text() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.18 1998/06/15 19:29:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.19 1998/09/01 03:26:14 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
}
/* not reached */
- return (0);
+ return 0;
}
pfree(sterm);
- return ((bool) result);
+ return (bool) result;
}
{
if (!n)
return FALSE;
- return (fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED));
+ return fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED);
}
bool
nameregexne(NameData *s, struct varlena * p)
{
- return (!nameregexeq(s, p));
+ return !nameregexeq(s, p);
}
bool
textregexeq(struct varlena * s, struct varlena * p)
{
if (!s)
- return (FALSE);
- return (fixedlen_regexeq(VARDATA(s), p, VARSIZE(s) - VARHDRSZ, REG_EXTENDED));
+ return FALSE;
+ return fixedlen_regexeq(VARDATA(s), p, VARSIZE(s) - VARHDRSZ, REG_EXTENDED);
}
bool
textregexne(struct varlena * s, struct varlena * p)
{
- return (!textregexeq(s, p));
+ return !textregexeq(s, p);
}
bool
texticregexne(struct varlena * s, struct varlena * p)
{
- return (!texticregexeq(s, p));
+ return !texticregexeq(s, p);
}
bool
bool
nameicregexne(NameData *s, struct varlena * p)
{
- return (!nameicregexeq(s, p));
+ return !nameicregexeq(s, p);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.24 1998/08/31 07:55:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.25 1998/09/01 03:26:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
RegProcedure result = (Oid) 0;
if (pro_name_and_oid == NULL)
- return (0);
+ return 0;
if (!IsBootstrapProcessingMode())
{
elog(ERROR, "regprocin: could not open %s",
ProcedureRelationName);
- return (0);
+ return 0;
}
ScanKeyEntryInitialize(&key,
(bits16) 0,
heap_close(proc);
elog(ERROR, "regprocin: could not being scan of %s",
ProcedureRelationName);
- return (0);
+ return 0;
}
proctup = heap_getnext(procscan, 0);
if (HeapTupleIsValid(proctup))
{
result = (RegProcedure) heap_getattr(proctup,
ObjectIdAttributeNumber,
- RelationGetTupleDescriptor(proc),
+ RelationGetDescr(proc),
&isnull);
if (isnull)
elog(FATAL, "regprocin: null procedure %s", pro_name_and_oid);
{
elog(ERROR, "regprocout: could not open %s",
ProcedureRelationName);
- return (0);
+ return 0;
}
ScanKeyEntryInitialize(&key,
(bits16) 0,
heap_close(proc);
elog(ERROR, "regprocout: could not being scan of %s",
ProcedureRelationName);
- return (0);
+ return 0;
}
proctup = heap_getnext(procscan, 0);
if (HeapTupleIsValid(proctup))
bool isnull;
s = (char *) heap_getattr(proctup, 1,
- RelationGetTupleDescriptor(proc), &isnull);
+ RelationGetDescr(proc), &isnull);
if (!isnull)
StrNCpy(result, s, NAMEDATALEN);
else
}
heap_endscan(procscan);
heap_close(proc);
- return (result);
+ return result;
}
#ifdef EBUG
elog(DEBUG, "regprocout: no such procedure %d", proid);
#endif /* defined(EBUG) */
- return (result);
+ return result;
}
/*
* int8typeout - converts int8 type oids to "typname" list
*/
text *
-oid8types(Oid (*oidArray)[])
+oid8types(Oid **oidArray)
{
HeapTuple typetup;
text *result;
{
result = (text *) palloc(VARHDRSZ);
VARSIZE(result) = 0;
- return (result);
+ return result;
}
result = (text *) palloc(NAMEDATALEN * 8 + 8 + VARHDRSZ);
{
char *s;
- s = ((TypeTupleForm) GETSTRUCT(typetup))->typname.data;
+ s = ((Form_pg_type) GETSTRUCT(typetup))->typname.data;
StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s,
NAMEDATALEN);
strcat(VARDATA(result), " ");
}
}
VARSIZE(result) = strlen(VARDATA(result)) + VARHDRSZ;
- return (result);
+ return result;
}
* out of it's tuple
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.1 1998/08/24 01:38:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.2 1998/09/01 03:26:17 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
get_const_expr(Const *constval)
{
HeapTuple typetup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
FmgrInfo finfo_output;
char *extval;
bool isnull = FALSE;
if (!HeapTupleIsValid(typetup))
elog(ERROR, "cache lookup of type %d failed", constval->consttype);
- typeStruct = (TypeTupleForm) GETSTRUCT(typetup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
extval = (char *)(*fmgr_faddr(&finfo_output))(constval->constvalue,
get_attribute_name(Oid relid, int2 attnum)
{
HeapTuple atttup;
- AttributeTupleForm attStruct;
+ Form_pg_attribute attStruct;
atttup = SearchSysCacheTuple(ATTNUM,
ObjectIdGetDatum(relid), (Datum)attnum, 0, 0);
elog(ERROR, "cache lookup of attribute %d in relation %d failed",
attnum, relid);
- attStruct = (AttributeTupleForm) GETSTRUCT(atttup);
+ attStruct = (Form_pg_attribute) GETSTRUCT(atttup);
return nameout(&(attStruct->attname));
}
case T_Var:
{
Var *var = (Var *)node;
- return (var->varno == rt_index && var->varlevelsup == sup);
+ return var->varno == rt_index && var->varlevelsup == sup;
}
break;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.21 1998/08/19 02:03:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.22 1998/09/01 03:26:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*result = 0.1;
else
*result = (float64data) getattdisbursion(relid, (int) attno);
- return (result);
+ return result;
}
/*
result = eqsel(opid, relid, attno, value, flag);
*result = 1.0 - *result;
- return (result);
+ return result;
}
/*
if (*highchar == 'n' || *lowchar == 'n')
{
*result = 1.0 / 3.0;
- return (result);
+ return result;
}
high = atol(highchar);
low = atol(lowchar);
}
}
}
- return (result);
+ return result;
}
/*
else
notflag = flag | SEL_RIGHT;
result = intltsel(opid, relid, attno, value, (int32) notflag);
- return (result);
+ return result;
}
/*
else
*result = (float64data) max;
}
- return (result);
+ return result;
}
/*
result = eqjoinsel(opid, relid1, attno1, relid2, attno2);
*result = 1.0 - *result;
- return (result);
+ return result;
}
/*
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 3.0;
- return (result);
+ return result;
}
/*
result = (float64) palloc(sizeof(float64data));
*result = 1.0 / 3.0;
- return (result);
+ return result;
}
/*
{
elog(ERROR, "getattdisbursion: no attribute tuple %d %d",
relid, attnum);
- return (0);
+ return 0;
}
- nvals = ((AttributeTupleForm) GETSTRUCT(atp))->attdisbursion;
+ nvals = ((Form_pg_attribute) GETSTRUCT(atp))->attdisbursion;
if (nvals > 0)
- return (nvals);
+ return nvals;
atp = SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(relid),
if (!HeapTupleIsValid(atp))
{
elog(ERROR, "getattdisbursion: no relation tuple %d", relid);
- return (0);
+ return 0;
}
ntuples = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
/* Look above how nvals is used. - vadim 04/09/97 */
if (ntuples > 0)
nvals = 1.0 / ntuples;
- return (nvals);
+ return nvals;
}
/*
*high = textout((struct varlena *)
heap_getattr(tuple,
Anum_pg_statistic_stahikey,
- RelationGetTupleDescriptor(rel),
+ RelationGetDescr(rel),
&isnull));
if (isnull)
elog(DEBUG, "gethilokey: high key is null");
*low = textout((struct varlena *)
heap_getattr(tuple,
Anum_pg_statistic_stalokey,
- RelationGetTupleDescriptor(rel),
+ RelationGetDescr(rel),
&isnull));
if (isnull)
elog(DEBUG, "gethilokey: low key is null");
if (*result < 0.0 || *result > 1.0)
elog(ERROR, "Btree Selectivity: bad value %lf", *result);
- return (result);
+ return result;
}
float64
if (!HeapTupleIsValid(atp))
{
elog(ERROR, "btreenpage: no index tuple %d", indexrelid);
- return (0);
+ return 0;
}
npage = ((Form_pg_class) GETSTRUCT(atp))->relpages;
result = (float64) palloc(sizeof(float64data));
*result = *temp * npage;
- return (result);
+ return result;
}
float64
if (!HeapTupleIsValid(atp))
{
elog(ERROR, "hashsel: no index tuple %d", indexrelid);
- return (0);
+ return 0;
}
ntuples = ((Form_pg_class) GETSTRUCT(atp))->reltuples;
if (ntuples > 0)
if (*result < 0.0 || *result > 1.0)
elog(ERROR, "Hash Table Selectivity: bad value %lf", *result);
- return (result);
+ return result;
}
if (!HeapTupleIsValid(atp))
{
elog(ERROR, "hashsel: no index tuple %d", indexrelid);
- return (0);
+ return 0;
}
npage = ((Form_pg_class) GETSTRUCT(atp))->relpages;
result = (float64) palloc(sizeof(float64data));
*result = *temp * npage;
- return (result);
+ return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.16 1998/08/19 02:03:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.17 1998/09/01 03:26:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
else
elog(ERROR, "setin: could not find new set oid tuple");
- if (RelationGetRelationTupleForm(procrel)->relhasindex)
+ if (RelationGetForm(procrel)->relhasindex)
{
Relation idescs[Num_pg_proc_indices];
time_t sec;
sec = GetCurrentTransactionStartTime();
- return (sec);
+ return sec;
}
bool
timestampeq(time_t t1, time_t t2)
{
- return (abstimeeq(t1, t2));
+ return abstimeeq(t1, t2);
}
bool
timestampne(time_t t1, time_t t2)
{
- return (abstimene(t1, t2));
+ return abstimene(t1, t2);
}
bool
timestamplt(time_t t1, time_t t2)
{
- return (abstimelt(t1, t2));
+ return abstimelt(t1, t2);
}
bool
timestampgt(time_t t1, time_t t2)
{
- return (abstimegt(t1, t2));
+ return abstimegt(t1, t2);
}
bool
timestample(time_t t1, time_t t2)
{
- return (abstimele(t1, t2));
+ return abstimele(t1, t2);
}
bool
timestampge(time_t t1, time_t t2)
{
- return (abstimege(t1, t2));
+ return abstimege(t1, t2);
}
DateTime *
timestamp_datetime(time_t timestamp)
{
- return (abstime_datetime((AbsoluteTime) timestamp));
+ return abstime_datetime((AbsoluteTime) timestamp);
} /* timestamp_datetime() */
time_t
datetime_timestamp(DateTime *datetime)
{
- return ((AbsoluteTime) datetime_abstime(datetime));
+ return (AbsoluteTime) datetime_abstime(datetime);
} /* datetime_timestamp() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.37 1998/07/24 03:31:42 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.38 1998/09/01 03:26:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
int i;
if (s == NULL)
- return ((char *) NULL);
+ return (char *) NULL;
if (atttypmod == -1)
{
/* blank pad the string if necessary */
for (; i < len; i++)
*r++ = ' ';
- return (result);
+ return result;
}
char *
convertstr(result, len, 1);
#endif
- return (result);
+ return result;
}
/* bpchar()
int i;
if (s == NULL)
- return ((char *) NULL);
+ return (char *) NULL;
if ((len == -1) || (len == VARSIZE(s)))
- return (s);
+ return s;
rlen = len - VARHDRSZ;
for (; i < rlen; i++)
*r++ = ' ';
- return (result);
+ return result;
} /* bpchar() */
int32
bpchar_char(char *s)
{
- return ((int32) *VARDATA(s));
+ return (int32) *VARDATA(s);
} /* bpchar_char() */
/* char_bpchar()
int len;
if (s == NULL)
- return (NULL);
+ return NULL;
len = VARSIZE(s) - VARHDRSZ;
if (len > NAMEDATALEN) len = NAMEDATALEN;
len++;
}
- return (result);
+ return result;
} /* bpchar_name() */
/* name_bpchar()
int len;
if (s == NULL)
- return (NULL);
+ return NULL;
len = strlen(s->data);
strncpy(VARDATA(result), s->data, len);
VARSIZE(result) = len + VARHDRSZ;
- return (result);
+ return result;
} /* name_bpchar() */
int len;
if (s == NULL)
- return ((char *) NULL);
+ return (char *) NULL;
len = strlen(s) + VARHDRSZ;
if (atttypmod != -1 && len > atttypmod)
convertstr(result + VARHDRSZ, len, 0);
#endif
- return (result);
+ return result;
}
char *
convertstr(result, len, 1);
#endif
- return (result);
+ return result;
}
/* varchar()
int len;
if (s == NULL)
- return ((char *) NULL);
+ return (char *) NULL;
len = VARSIZE(s);
if ((slen == -1) || (len <= slen))
- return ((char *) s);
+ return (char *) s;
/* only reach here if we need to truncate string... */
VARSIZE(result) = slen;
strncpy(VARDATA(result), VARDATA(s), len);
- return (result);
+ return result;
} /* varchar() */
if (s[i] != ' ')
break;
}
- return (i + 1);
+ return i + 1;
}
int32
}
return(len);
#else
- return (bcTruelen(arg));
+ return bcTruelen(arg);
#endif
}
if (!PointerIsValid(arg))
elog(ERROR, "Bad (null) char() external representation", NULL);
- return (bcTruelen(arg));
+ return bcTruelen(arg);
}
bool
len2;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
if (len1 != len2)
return 0;
- return (strncmp(VARDATA(arg1), VARDATA(arg2), len1) == 0);
+ return strncmp(VARDATA(arg1), VARDATA(arg2), len1) == 0;
}
bool
len2;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
if (len1 != len2)
return 1;
- return (strncmp(VARDATA(arg1), VARDATA(arg2), len1) != 0);
+ return strncmp(VARDATA(arg1), VARDATA(arg2), len1) != 0;
}
bool
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
cmp = varstr_cmp(VARDATA(arg1), len1, VARDATA(arg2), len2);
if (cmp == 0)
- return (len1 < len2);
+ return len1 < len2;
else
- return (cmp < 0);
+ return cmp < 0;
}
bool
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
cmp = varstr_cmp(VARDATA(arg1), len1, VARDATA(arg2), len2);
if (cmp == 0)
- return (len1 > len2);
+ return len1 > len2;
else
- return (cmp > 0);
+ return cmp > 0;
}
bool
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = bcTruelen(arg1);
len2 = bcTruelen(arg2);
}
return(len);
#else
- return (VARSIZE(arg) - VARHDRSZ);
+ return VARSIZE(arg) - VARHDRSZ;
#endif
}
{
if (!PointerIsValid(arg))
elog(ERROR, "Bad (null) varchar() external representation", NULL);
- return (VARSIZE(arg) - VARHDRSZ);
+ return VARSIZE(arg) - VARHDRSZ;
}
bool
len2;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = VARSIZE(arg1) - VARHDRSZ;
len2 = VARSIZE(arg2) - VARHDRSZ;
if (len1 != len2)
return 0;
- return (strncmp(VARDATA(arg1), VARDATA(arg2), len1) == 0);
+ return strncmp(VARDATA(arg1), VARDATA(arg2), len1) == 0;
}
bool
len2;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = VARSIZE(arg1) - VARHDRSZ;
len2 = VARSIZE(arg2) - VARHDRSZ;
if (len1 != len2)
return 1;
- return (strncmp(VARDATA(arg1), VARDATA(arg2), len1) != 0);
+ return strncmp(VARDATA(arg1), VARDATA(arg2), len1) != 0;
}
bool
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = VARSIZE(arg1) - VARHDRSZ;
len2 = VARSIZE(arg2) - VARHDRSZ;
cmp = varstr_cmp(VARDATA(arg1), len1, VARDATA(arg2), len2);
if (cmp == 0)
- return (len1 < len2);
+ return len1 < len2;
else
- return (cmp < 0);
+ return cmp < 0;
}
bool
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = VARSIZE(arg1) - VARHDRSZ;
len2 = VARSIZE(arg2) - VARHDRSZ;
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = VARSIZE(arg1) - VARHDRSZ;
len2 = VARSIZE(arg2) - VARHDRSZ;
cmp = varstr_cmp(VARDATA(arg1), len1, VARDATA(arg2), len2);
if (cmp == 0)
- return (len1 > len2);
+ return len1 > len2;
else
- return (cmp > 0);
+ return cmp > 0;
}
bool
int cmp;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) 0);
+ return (bool) 0;
len1 = VARSIZE(arg1) - VARHDRSZ;
len2 = VARSIZE(arg2) - VARHDRSZ;
} while (--loop);
}
}
- return (n);
+ return n;
}
uint32
} while (--loop);
}
}
- return (n);
+ return n;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.40 1998/08/29 04:09:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.41 1998/09/01 03:26:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
byte <<= 3;
*rp++ = byte + VAL(*tp++);
}
- return (result);
+ return result;
}
/*
result = (char *) palloc(2);
result[0] = '-';
result[1] = '\0';
- return (result);
+ return result;
}
vp = vlena->vl_dat;
len = 1; /* empty string has 1 char */
rp += 3;
}
*rp = '\0';
- return (result);
+ return result;
}
int len;
if (inputText == NULL)
- return (NULL);
+ return NULL;
len = strlen(inputText) + VARHDRSZ;
result = (text *) palloc(len);
convertstr(VARDATA(result), len - VARHDRSZ, 0);
#endif
- return (result);
+ return result;
}
/*
result = (char *) palloc(2);
result[0] = '-';
result[1] = '\0';
- return (result);
+ return result;
}
len = VARSIZE(vlena) - VARHDRSZ;
result = (char *) palloc(len + 1);
convertstr(result, len, 1);
#endif
- return (result);
+ return result;
}
}
return(len);
#else
- return (VARSIZE(t) - VARHDRSZ);
+ return VARSIZE(t) - VARHDRSZ;
#endif
} /* textlen() */
if (!PointerIsValid(t))
elog(ERROR, "Null input to textoctetlen");
- return (VARSIZE(t) - VARHDRSZ);
+ return VARSIZE(t) - VARHDRSZ;
} /* textoctetlen() */
text *result;
if (!PointerIsValid(t1) || !PointerIsValid(t2))
- return (NULL);
+ return NULL;
len1 = (VARSIZE(t1) - VARHDRSZ);
if (len1 < 0)
if (len2 > 0)
memcpy(ptr + len1, VARDATA(t2), len2);
- return (result);
+ return result;
} /* textcat() */
/*
#endif
if (!PointerIsValid(t1) || !PointerIsValid(t2))
- return (0);
+ return 0;
if (VARSIZE(t2) <= 0)
- return (1);
+ return 1;
len1 = (VARSIZE(t1) - VARHDRSZ);
len2 = (VARSIZE(t2) - VARHDRSZ);
pfree(ps1);
pfree(ps2);
#endif
- return (pos);
+ return pos;
} /* textpos() */
/*
*a2p;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) NULL);
+ return (bool) NULL;
if ((len = arg1->vl_len) != arg2->vl_len)
- return ((bool) 0);
+ return (bool) 0;
a1p = arg1->vl_dat;
a2p = arg2->vl_dat;
len -= VARHDRSZ;
while (len-- != 0)
if (*a1p++ != *a2p++)
- return ((bool) 0);
- return ((bool) 1);
+ return (bool) 0;
+ return (bool) 1;
} /* texteq() */
bool
textne(text *arg1, text *arg2)
{
- return ((bool) !texteq(arg1, arg2));
+ return (bool) !texteq(arg1, arg2);
}
/* varstr_cmp()
result = (len1 < len2) ? -1 : 1;
#endif
- return (result);
+ return result;
} /* varstr_cmp() */
/* text_cmp()
int len1, len2;
if (arg1 == NULL || arg2 == NULL)
- return ((bool) FALSE);
+ return (bool) FALSE;
a1p = VARDATA(arg1);
a2p = VARDATA(arg2);
bool
text_gt(text *arg1, text *arg2)
{
- return ((bool) !text_le(arg1, arg2));
+ return (bool) !text_le(arg1, arg2);
}
bool
text_ge(text *arg1, text *arg2)
{
- return ((bool) !text_lt(arg1, arg2));
+ return (bool) !text_lt(arg1, arg2);
}
/*-------------------------------------------------------------
len = v->vl_len - sizeof(v->vl_len);
- return (len);
+ return len;
}
/*-------------------------------------------------------------
byte = (unsigned char) (v->vl_dat[n]);
- return ((int32) byte);
+ return (int32) byte;
}
/*-------------------------------------------------------------
byte = byteaGetByte(v, byteNo);
if (byte & (1 << bitNo))
- return ((int32) 1);
+ return (int32) 1;
else
- return ((int32) 0);
+ return (int32) 0;
}
/*-------------------------------------------------------------
*/
res->vl_dat[n] = newByte;
- return (res);
+ return res;
}
/*-------------------------------------------------------------
*/
res = byteaSetByte(v, byteNo, newByte);
- return (res);
+ return res;
}
int len;
if (s == NULL)
- return (NULL);
+ return NULL;
len = VARSIZE(s) - VARHDRSZ;
if (len > NAMEDATALEN) len = NAMEDATALEN;
len++;
}
- return (result);
+ return result;
} /* text_name() */
/* name_text()
int len;
if (s == NULL)
- return (NULL);
+ return NULL;
len = strlen(s->data);
strncpy(VARDATA(result), s->data, len);
VARSIZE(result) = len + VARHDRSZ;
- return (result);
+ return result;
} /* name_text() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.32 1998/08/19 02:03:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.33 1998/09/01 03:26:25 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
*/
Assert(RelationIsValid(relation));
cache->relationId = RelationGetRelid(relation);
- tupdesc = cache->cc_tupdesc = RelationGetTupleDescriptor(relation);
+ tupdesc = cache->cc_tupdesc = RelationGetDescr(relation);
CACHE3_elog(DEBUG, "CatalogCacheInitializeCache: relid %d, %d keys",
cache->relationId, cache->cc_nkeys);
*/
if (cache->cc_indname != NULL && cache->indexId == InvalidOid)
{
- if (RelationGetRelationTupleForm(relation)->relhasindex)
+ if (RelationGetForm(relation)->relhasindex)
{
/*
case 1:
case 2:
case 4:
- return ((long) v);
+ return (long) v;
}
if (l == NAMEDATALEN)
i = 0;
while (l--)
i += *v++;
- return (i);
+ return i;
}
/* --------------------------------
break;
}
hashIndex %= cacheInP->cc_size;
- return (hashIndex);
+ return hashIndex;
}
/* --------------------------------
? (Datum) tuple->t_oid
: fastgetattr(tuple,
cacheInOutP->cc_key[3],
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
&isNull);
Assert(!isNull);
/* FALLTHROUGH */
? (Datum) tuple->t_oid
: fastgetattr(tuple,
cacheInOutP->cc_key[2],
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
&isNull);
Assert(!isNull);
/* FALLTHROUGH */
? (Datum) tuple->t_oid
: fastgetattr(tuple,
cacheInOutP->cc_key[1],
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
&isNull);
Assert(!isNull);
/* FALLTHROUGH */
? (Datum) tuple->t_oid
: fastgetattr(tuple,
cacheInOutP->cc_key[0],
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
&isNull);
Assert(!isNull);
break;
char *iname,
int id,
int nkeys,
- int key[],
+ int *key,
HeapTuple (*iScanfuncP) ())
{
CatCache *cp;
* ----------------
*/
MemoryContextSwitchTo(oldcxt);
- return (cp);
+ return cp;
}
heap_close(relation);
#endif /* CACHEDEBUG */
- return (ct->ct_tup);
+ return ct->ct_tup;
}
/* ----------------
if (DisableCache)
{
elog(ERROR, "SearchSysCache: Called while cache disabled");
- return ((HeapTuple) NULL);
+ return (HeapTuple) NULL;
}
/* ----------------
CACHE2_elog(DEBUG, "SearchSysCache: performing scan (override==%d)",
heapisoverride());
- if ((RelationGetRelationTupleForm(relation))->relhasindex
+ if ((RelationGetForm(relation))->relhasindex
&& !IsBootstrapProcessingMode())
{
/* ----------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.16 1998/08/24 01:13:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.17 1998/09/01 03:26:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
HeapTuple procedureTuple;
HeapTuple typeTuple;
Form_pg_proc procedureStruct;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
FunctionCachePtr retval;
text *tmp;
int nargs;
* save the information in our one element cache.
* ----------------
*/
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTuple);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTuple);
retval->typlen = (typeStruct)->typlen;
if ((typeStruct)->typrelid == InvalidOid)
retval->func.fn_addr = (func_ptr) NULL;
- return (retval);
+ return retval;
}
void
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.14 1998/08/20 22:07:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.15 1998/09/01 03:26:29 momjian Exp $
*
* Note - this code is real crufty...
*
entryDataP = (InvalidationEntryData *)
malloc(sizeof(char *) + size); /* XXX alignment */
entryDataP->nextP = NULL;
- return ((Pointer) &entryDataP->userData);
+ return (Pointer) &entryDataP->userData;
}
/* --------------------------------
((InvalidationUserData *) entry)->dataP[-1] =
(InvalidationUserData *) invalid;
- return (entry);
+ return entry;
}
/* --------------------------------
if (relationId == MyRelationRelationId)
objectId = tuple->t_oid;
else if (relationId == MyAttributeRelationId)
- objectId = ((AttributeTupleForm) GETSTRUCT(tuple))->attrelid;
+ objectId = ((Form_pg_attribute) GETSTRUCT(tuple))->attrelid;
else if (relationId == MyAMRelationId)
objectId = tuple->t_oid;
else if (relationId == MyAMOPRelationId)
* this only works for system relations now
* ----------------
*/
- if (!IsSystemRelationName(RelationGetRelationTupleForm(relation)->relname.data))
+ if (!IsSystemRelationName(RelationGetForm(relation)->relname.data))
return;
/* ----------------
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.20 1998/08/19 02:03:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.21 1998/09/01 03:26:30 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
Oid
get_atttype(Oid relid, AttrNumber attnum)
{
- AttributeTupleForm att_tup = (AttributeTupleForm) palloc(sizeof(*att_tup));
+ Form_pg_attribute att_tup = (Form_pg_attribute) palloc(sizeof(*att_tup));
if (SearchSysCacheStruct(ATTNUM, (char *) att_tup,
ObjectIdGetDatum(relid),
{
HeapTuple tuple;
AttrNumber attno;
- AttributeTupleForm att_tup;
+ Form_pg_attribute att_tup;
attno = get_attnum(relid, attname);
return false;
else
{
- att_tup = (AttributeTupleForm) GETSTRUCT(tuple);
+ att_tup = (Form_pg_attribute) GETSTRUCT(tuple);
return att_tup->attisset;
}
}
int16
get_typlen(Oid typid)
{
- TypeTupleFormData typtup;
+ FormData_pg_type typtup;
if (SearchSysCacheStruct(TYPOID, (char *) &typtup,
ObjectIdGetDatum(typid),
bool
get_typbyval(Oid typid)
{
- TypeTupleFormData typtup;
+ FormData_pg_type typtup;
if (SearchSysCacheStruct(TYPOID, (char *) &typtup,
ObjectIdGetDatum(typid),
char
get_typalign(Oid typid)
{
- TypeTupleFormData typtup;
+ FormData_pg_type typtup;
if (SearchSysCacheStruct(TYPOID, (char *) &typtup,
ObjectIdGetDatum(typid),
char
get_typtype(Oid typid)
{
- TypeTupleFormData typtup;
+ FormData_pg_type typtup;
if (SearchSysCacheStruct(TYPOID, (char *) &typtup,
ObjectIdGetDatum(typid),
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.48 1998/08/28 03:36:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.49 1998/09/01 03:26:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* non-export function prototypes */
static void
formrdesc(char *relationName, u_int natts,
- FormData_pg_attribute att[]);
+ FormData_pg_attribute *att);
#if 0 /* See comments at line 1304 */
static void RelationFlushIndexes(Relation *r, Oid accessMethodId);
*/
if (IsBootstrapProcessingMode())
- return (scan_pg_rel_seq(buildinfo));
+ return scan_pg_rel_seq(buildinfo);
else
- return (scan_pg_rel_ind(buildinfo));
+ return scan_pg_rel_ind(buildinfo);
}
static HeapTuple
{
Relation relation;
Size len;
- Form_pg_class relationTupleForm;
+ Form_pg_class relationForm;
/* ----------------
* allocate space for the relation tuple form
* ----------------
*/
- relationTupleForm = (Form_pg_class)
+ relationForm = (Form_pg_class)
palloc((Size) (sizeof(FormData_pg_class)));
- memmove((char *) relationTupleForm, (char *) relp, CLASS_TUPLE_SIZE);
+ memmove((char *) relationForm, (char *) relp, CLASS_TUPLE_SIZE);
/* ----------------
* allocate space for new relation descriptor
relation->rd_att = CreateTemplateTupleDesc(natts);
/* and initialize relation tuple form */
- relation->rd_rel = relationTupleForm;
+ relation->rd_rel = relationForm;
return relation;
}
HeapTuple pg_attribute_tuple;
Relation pg_attribute_desc;
HeapScanDesc pg_attribute_scan;
- AttributeTupleForm attp;
+ Form_pg_attribute attp;
ScanKeyData key;
int need;
pg_attribute_tuple = heap_getnext(pg_attribute_scan, 0);
while (HeapTupleIsValid(pg_attribute_tuple) && need > 0)
{
- attp = (AttributeTupleForm) GETSTRUCT(pg_attribute_tuple);
+ attp = (Form_pg_attribute) GETSTRUCT(pg_attribute_tuple);
if (attp->attnum > 0)
{
relation->rd_att->attrs[attp->attnum - 1] =
- (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove((char *) (relation->rd_att->attrs[attp->attnum - 1]),
(char *) attp,
{
Relation attrel;
HeapTuple atttup;
- AttributeTupleForm attp;
+ Form_pg_attribute attp;
TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
AttrDefault *attrdef = NULL;
int ndef = 0;
if (!HeapTupleIsValid(atttup))
elog(ERROR, "cannot find attribute %d of relation %s", i,
relation->rd_rel->relname.data);
- attp = (AttributeTupleForm) GETSTRUCT(atttup);
+ attp = (Form_pg_attribute) GETSTRUCT(atttup);
relation->rd_att->attrs[i - 1] =
- (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
memmove((char *) (relation->rd_att->attrs[i - 1]),
(char *) attp,
*/
pg_rewrite_desc = heap_openr(RewriteRelationName);
pg_rewrite_scan = heap_beginscan(pg_rewrite_desc, 0, SnapshotNow, 1, &key);
- pg_rewrite_tupdesc = RelationGetTupleDescriptor(pg_rewrite_desc);
+ pg_rewrite_tupdesc = RelationGetDescr(pg_rewrite_desc);
/* ----------------
* add attribute data to relation->rd_att
if (OidIsValid(relam))
{
relation->rd_am = (Form_pg_am)
- AccessMethodObjectIdGetAccessMethodTupleForm(relam);
+ AccessMethodObjectIdGetForm(relam);
}
/* ----------------
static void
formrdesc(char *relationName,
u_int natts,
- FormData_pg_attribute att[])
+ FormData_pg_attribute *att)
{
Relation relation;
Size len;
for (i = 0; i < natts; i++)
{
relation->rd_att->attrs[i] =
- (AttributeTupleForm) palloc(ATTRIBUTE_TUPLE_SIZE);
+ (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
MemSet((char *) relation->rd_att->attrs[i], 0,
ATTRIBUTE_TUPLE_SIZE);
}
- return (rd);
+ return rd;
}
/* --------------------------------
}
- return (rd);
+ return rd;
}
/* --------------------------------
#endif
pfree(RelationGetLockInfo(relation));
- pfree(RelationGetRelationTupleForm(relation));
+ pfree(RelationGetForm(relation));
pfree(relation);
MemoryContextSwitchTo(oldcxt);
return;
}
- ird->rd_att->attrs[i] = (AttributeTupleForm) palloc(len);
+ ird->rd_att->attrs[i] = (Form_pg_attribute) palloc(len);
if ((nread = FileRead(fd, (char *) ird->rd_att->attrs[i], len)) != len)
{
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.20 1998/08/19 02:03:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.21 1998/09/01 03:26:33 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
0,
0
},
- offsetof(TypeTupleFormData, typalign) +sizeof(char),
+ offsetof(FormData_pg_type, typalign) +sizeof(char),
TypeNameIndex,
TypeNameIndexScan},
{TypeRelationName, /* TYPOID */
0,
0
},
- offsetof(TypeTupleFormData, typalign) +sizeof(char),
+ offsetof(FormData_pg_type, typalign) +sizeof(char),
TypeOidIndex,
TypeOidIndexScan},
{AccessMethodRelationName, /* AMNAME */
if (cacheId < 0 || cacheId >= SysCacheSize)
{
elog(ERROR, "SearchSysCacheTuple: Bad cache id %d", cacheId);
- return ((HeapTuple) NULL);
+ return (HeapTuple) NULL;
}
Assert(AMI_OVERRIDE || PointerIsValid(SysCache[cacheId]));
cacheinfo[cacheId].name,
cacheId, key1, key2, key3, key4);
#endif
- return ((HeapTuple) NULL);
+ return (HeapTuple) NULL;
}
- return (tp);
+ return tp;
}
/*
if (!PointerIsValid(returnStruct))
{
elog(ERROR, "SearchSysCacheStruct: No receiving struct");
- return (0);
+ return 0;
}
tp = SearchSysCacheTuple(cacheId, key1, key2, key3, key4);
if (!HeapTupleIsValid(tp))
- return (0);
+ return 0;
memmove(returnStruct, (char *) GETSTRUCT(tp), cacheinfo[cacheId].size);
- return (1);
+ return 1;
}
"SearchSysCacheGetAttribute: Lookup in %s(%d) failed",
cacheName, cacheId);
#endif /* defined(CACHEDEBUG) */
- return (NULL);
+ return NULL;
}
relation = heap_openr(cacheName);
elog(ERROR,
"SearchSysCacheGetAttribute: Bad attr # %d in %s(%d)",
attributeNumber, cacheName, cacheId);
- return (NULL);
+ return NULL;
}
attributeValue = heap_getattr(tp,
attributeNumber,
- RelationGetTupleDescriptor(relation),
+ RelationGetDescr(relation),
&isNull);
if (isNull)
* Used to be an elog(DEBUG, ...) here and a claim that it should
* be a FATAL error, I don't think either is warranted -mer 6/9/92
*/
- return (NULL);
+ return NULL;
}
if (attributeByValue)
}
heap_close(relation);
- return (returnValue);
+ return returnValue;
}
/*
TypeDefaultRetrieve(Oid typId)
{
HeapTuple typeTuple;
- TypeTupleForm type;
+ Form_pg_type type;
int32 typByVal,
typLen;
struct varlena *typDefault;
elog(DEBUG, "TypeDefaultRetrieve: Lookup in %s(%d) failed",
cacheinfo[TYPOID].name, TYPOID);
#endif /* defined(CACHEDEBUG) */
- return (NULL);
+ return NULL;
}
- type = (TypeTupleForm) GETSTRUCT(typeTuple);
+ type = (Form_pg_type) GETSTRUCT(typeTuple);
typByVal = type->typbyval;
typLen = type->typlen;
elog(DEBUG, "TypeDefaultRetrieve: No extractable typdefault in %s(%d)",
cacheinfo[TYPOID].name, TYPOID);
#endif /* defined(CACHEDEBUG) */
- return (NULL);
+ return NULL;
}
dataSize = VARSIZE(typDefault) - VARHDRSZ;
}
}
- return (returnValue);
+ return returnValue;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.10 1998/08/25 21:34:06 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.11 1998/09/01 03:26:35 momjian Exp $
*
* NOTE
* This should eventually work with elog(), dlog(), etc.
/* XXX FIXME: detail is lost */
ExcRaise(exceptionP, (ExcDetail) 0, (ExcData) NULL, conditionName);
- return (0);
+ return 0;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.33 1998/08/31 04:48:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.34 1998/09/01 03:26:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static int Err_file = -1;
static int ElogDebugIndentLevel = 0;
-extern char OutputFileName[];
-
/*
* elog --
* Old error logging function.
elog(FATAL, "DebugFileOpen: %s reopen as stderr: %m",
OutputFileName);
Err_file = Debugfile = fileno(stderr);
- return (Debugfile);
+ return Debugfile;
}
/*
elog(FATAL, "DebugFileOpen: could not open debugging file");
Err_file = Debugfile = fd;
- return (Debugfile);
+ return Debugfile;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.21 1998/06/27 04:53:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.22 1998/09/01 03:26:38 momjian Exp $
*
* NOTE
* XXX this code needs improvement--check for state violations and
ExcProc *
ExcGetUnCaught(void)
{
- return (ExcUnCaughtP);
+ return ExcUnCaughtP;
}
#endif
ExcUnCaughtP = newP;
- return (oldP);
+ return oldP;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/format.c,v 1.6 1998/02/26 04:37:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/format.c,v 1.7 1998/09/01 03:26:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
va_end(args);
- return (FormBuf);
+ return FormBuf;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.19 1998/08/19 02:03:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.20 1998/09/01 03:26:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (procedureId == procedureId_save)
{
*pronargs = pronargs_save;
- return (user_fn_save);
+ return user_fn_save;
}
/*
{
elog(ERROR, "fmgr: Cache lookup failed for procedure %d\n",
procedureId);
- return ((func_ptr) NULL);
+ return (func_ptr) NULL;
}
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
{
elog(ERROR, "fmgr: Could not open relation %s",
ProcedureRelationName);
- return ((func_ptr) NULL);
+ return (func_ptr) NULL;
}
probinattr = heap_getattr(procedureTuple,
Anum_pg_proc_probin,
- RelationGetTupleDescriptor(rel), &isnull);
+ RelationGetDescr(rel), &isnull);
if (!PointerIsValid(probinattr) /* || isnull */ )
{
heap_close(rel);
elog(ERROR, "fmgr: Could not extract probin for %d from %s",
procedureId, ProcedureRelationName);
- return ((func_ptr) NULL);
+ return (func_ptr) NULL;
}
probinstring = textout((struct varlena *) probinattr);
procedureId_save = procedureId;
user_fn_save = user_fn;
- return (user_fn);
+ return user_fn;
}
static func_ptr
file_tail = file_scanner;
if (funcname == (char *) NULL)
- return ((func_ptr) NULL);
+ return (func_ptr) NULL;
}
retval = (func_ptr) pg_dlsym(file_scanner->handle, funcname);
if (retval == (func_ptr) NULL)
elog(ERROR, "Can't find function %s in file %s", funcname, filename);
- return (retval);
+ return retval;
}
/*
trigger_fn = handle_load(filename, funcname);
- return (trigger_fn);
+ return trigger_fn;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.18 1998/08/19 02:03:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.19 1998/09/01 03:26:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
finfo->fn_oid, n_arguments, MAXFMGRARGS);
break;
}
- return (returnValue);
+ return returnValue;
}
void
va_end(pvar);
/* XXX see WAY_COOL_ORTHOGONAL_FUNCTIONS */
- return (fmgr_c(&finfo, &values, &isNull));
+ return fmgr_c(&finfo, &values, &isNull);
}
/*
va_end(pvar);
/* XXX see WAY_COOL_ORTHOGONAL_FUNCTIONS */
- return (fmgr_c(&local_finfo, &values, &isNull));
+ return fmgr_c(&local_finfo, &values, &isNull);
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.14 1998/06/15 19:29:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.15 1998/09/01 03:26:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* hash table already exists, we're just attaching to it */
if (flags & HASH_ATTACH)
- return (hashp);
+ return hashp;
}
else
{
hashp->hctl = (HHDR *) hashp->alloc((unsigned long) sizeof(HHDR));
if (!hashp->hctl)
- return (0);
+ return 0;
}
if (!hdefault(hashp))
- return (0);
+ return 0;
hctl = hashp->hctl;
#ifdef HASH_STATISTICS
hctl->accesses = hctl->collisions = 0;
if (init_htab(hashp, nelem))
{
hash_destroy(hashp);
- return (0);
+ return 0;
}
- return (hashp);
+ return hashp;
}
/*
/* garbage collection for HASH_REMOVE */
hctl->freeBucketIndex = INVALID_INDEX;
- return (1);
+ return 1;
}
hashp->dir =
(SEG_OFFSET *) hashp->alloc(hctl->dsize * sizeof(SEG_OFFSET));
if (!hashp->dir)
- return (-1);
+ return -1;
}
/* Allocate initial segments */
if (*segp == (SEG_OFFSET) 0)
{
hash_destroy(hashp);
- return (0);
+ return 0;
}
}
"NSEGS ", hctl->nsegs,
"NKEYS ", hctl->nkeys);
#endif
- return (0);
+ return 0;
}
/********************** DESTROY ROUTINES ************************/
if (bucket > hctl->max_bucket)
bucket = bucket & hctl->low_mask;
- return (bucket);
+ return bucket;
}
/*
{
case HASH_ENTER:
if (currIndex != INVALID_INDEX)
- return (&(curr->key));
+ return &(curr->key);
break;
case HASH_REMOVE:
case HASH_REMOVE_SAVED:
* element, because someone else is going to reuse it the
* next time something is added to the table
*/
- return (&(curr->key));
+ return &(curr->key);
}
- return ((long *) TRUE);
+ return (long *) TRUE;
case HASH_FIND:
if (currIndex != INVALID_INDEX)
- return (&(curr->key));
- return ((long *) TRUE);
+ return &(curr->key);
+ return (long *) TRUE;
case HASH_FIND_SAVE:
if (currIndex != INVALID_INDEX)
{
saveState.currElem = curr;
saveState.prevIndex = prevIndexPtr;
saveState.currIndex = currIndex;
- return (&(curr->key));
+ return &(curr->key);
}
- return ((long *) TRUE);
+ return (long *) TRUE;
default:
/* can't get here */
- return (NULL);
+ return NULL;
}
/*
/* no free elements. allocate another chunk of buckets */
if (!bucket_alloc(hashp))
- return (NULL);
+ return NULL;
currIndex = hctl->freeBucketIndex;
}
Assert(currIndex != INVALID_INDEX);
* hash_stats("expanded table",hashp);
*/
if (!expand_table(hashp))
- return (NULL);
+ return NULL;
}
- return (&(curr->key));
+ return &(curr->key);
}
/*
*/
curBucket = 0;
curIndex = INVALID_INDEX;
- return ((long *) NULL);
+ return (long *) NULL;
}
hctl = hashp->hctl;
curIndex = curElem->next;
if (curIndex == INVALID_INDEX) /* end of this bucket */
++curBucket;
- return (&(curElem->key));
+ return &(curElem->key);
}
/*
segp = GET_SEG(hashp, segment_num);
if (segp == NULL)
/* this is probably an error */
- return ((long *) NULL);
+ return (long *) NULL;
/*
* now find the right index into the segment for the first item in
++curBucket;
}
- return ((long *) TRUE); /* out of buckets */
+ return (long *) TRUE; /* out of buckets */
}
if (new_segnum >= hctl->dsize)
dir_realloc(hashp);
if (!(hashp->dir[new_segnum] = seg_alloc(hashp)))
- return (0);
+ return 0;
hctl->nsegs++;
}
}
chain->next = INVALID_INDEX;
}
- return (1);
+ return 1;
}
if (hashp->hctl->max_dsize != NO_MAX_DSIZE)
- return (0);
+ return 0;
/* Reallocate directory */
old_dirsize = hashp->hctl->dsize * sizeof(SEGMENT *);
free((char *) *p_ptr);
*p_ptr = p;
hashp->hctl->dsize = new_dirsize;
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
sizeof(SEGMENT) * hashp->hctl->ssize);
if (!segp)
- return (0);
+ return 0;
MemSet((char *) segp, 0,
(long) sizeof(SEGMENT) * hashp->hctl->ssize);
segOffset = MAKE_HASHOFFSET(hashp, segp);
- return (segOffset);
+ return segOffset;
}
/*
hashp->alloc((unsigned long) BUCKET_ALLOC_INCR * bucketSize);
if (!tmpBucket)
- return (0);
+ return 0;
tmpIndex = MAKE_HASHOFFSET(hashp, tmpBucket);
*/
tmpBucket->next = lastIndex;
- return (1);
+ return 1;
}
/* calculate the log base 2 of num */
int limit;
for (i = 0, limit = 1; limit < num; limit = 2 * limit, i++);
- return (i);
+ return i;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.7 1998/02/26 04:37:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.8 1998/09/01 03:26:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
h = h * PRIME1 ^ (*k++ - ' ');
h %= PRIME2;
- return (h);
+ return h;
}
}
h %= PRIME2;
- return (h);
+ return h;
}
/*
}
}
- return (n);
+ return n;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/enbl.c,v 1.3 1998/08/25 21:04:40 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/enbl.c,v 1.4 1998/09/01 03:26:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (on)
{
*enableCountInOutP += 1;
- return ((bool) (*enableCountInOutP >= 2));
+ return (bool) (*enableCountInOutP >= 2);
}
AssertState(*enableCountInOutP >= 1);
*enableCountInOutP -= 1;
- return ((bool) (*enableCountInOutP >= 1));
+ return (bool) (*enableCountInOutP >= 1);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.10 1998/06/15 19:29:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.11 1998/09/01 03:26:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (DebugLvl > 1)
fprintf(stderr, "ValidateBinary: pathname \"%s\" is too long\n",
path);
- return (-1);
+ return -1;
}
if (stat(path, &buf) < 0)
if (DebugLvl > 1)
fprintf(stderr, "ValidateBinary: can't stat \"%s\"\n",
path);
- return (-1);
+ return -1;
}
if (!(buf.st_mode & S_IFREG))
{
if (DebugLvl > 1)
fprintf(stderr, "ValidateBinary: \"%s\" is not a regular file\n",
path);
- return (-1);
+ return -1;
}
/*
if (DebugLvl > 1 && !(is_r && is_x))
fprintf(stderr, "ValidateBinary: \"%s\" is not user read/execute\n",
path);
- return (is_x ? (is_r ? 0 : -2) : -1);
+ return is_x ? (is_r ? 0 : -2) : -1;
}
pwp = getpwuid(euid);
if (pwp)
if (DebugLvl > 1 && !(is_r && is_x))
fprintf(stderr, "ValidateBinary: \"%s\" is not group read/execute\n",
path);
- return (is_x ? (is_r ? 0 : -2) : -1);
+ return is_x ? (is_r ? 0 : -2) : -1;
}
}
is_r = buf.st_mode & S_IROTH;
if (DebugLvl > 1 && !(is_r && is_x))
fprintf(stderr, "ValidateBinary: \"%s\" is not other read/execute\n",
path);
- return (is_x ? (is_r ? 0 : -2) : -1);
+ return is_x ? (is_r ? 0 : -2) : -1;
}
/*
if (DebugLvl)
fprintf(stderr, "FindExec: found \"%s\" using argv[0]\n",
full_path);
- return (0);
+ return 0;
}
fprintf(stderr, "FindExec: invalid binary \"%s\"\n",
buf);
- return (-1);
+ return -1;
}
/*
fprintf(stderr, "FindExec: found \"%s\" using PATH\n",
full_path);
free(path);
- return (0);
+ return 0;
case -1: /* wasn't even a candidate, keep looking */
break;
case -2: /* found but disqualified */
fprintf(stderr, "FindExec: could not read binary \"%s\"\n",
buf);
free(path);
- return (-1);
+ return -1;
}
if (!endp) /* last one */
break;
}
fprintf(stderr, "FindExec: could not find a %s to execute...\n", binary_name);
- return (-1);
+ return -1;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.20 1998/08/19 02:03:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.21 1998/09/01 03:26:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
bool
IsNoProcessingMode()
{
- return ((bool) (Mode == NoProcessing));
+ return (bool) (Mode == NoProcessing);
}
/*
bool
IsBootstrapProcessingMode()
{
- return ((bool) (Mode == BootstrapProcessing));
+ return (bool) (Mode == BootstrapProcessing);
}
/*
bool
IsInitProcessingMode()
{
- return ((bool) (Mode == InitProcessing));
+ return (bool) (Mode == InitProcessing);
}
/*
bool
IsNormalProcessingMode()
{
- return ((bool) (Mode == NormalProcessing));
+ return (bool) (Mode == NormalProcessing);
}
/*
ProcessingMode
GetProcessingMode()
{
- return (Mode);
+ return Mode;
}
/* ----------------------------------------------------------------
static bool
isblank(const char c)
{
- return (c == ' ' || c == 9 /* tab */ );
+ return c == ' ' || c == 9 /* tab */ ;
}
static void
GetUserId()
{
Assert(OidIsValid(UserId));
- return (UserId);
+ return UserId;
}
void
{
while ((pg_wchar)*s1 == *s2++)
if (*s1++ == 0)
- return (0);
- return (*(const unsigned char *)s1 - *(const pg_wchar *)(s2 - 1));
+ return 0;
+ return *(const unsigned char *)s1 - *(const pg_wchar *)(s2 - 1);
}
{
if (n == 0)
- return (0);
+ return 0;
do {
if (*s1 != *s2++)
return (*(const pg_wchar *)s1 -
if (*s1++ == 0)
break;
} while (--n != 0);
- return (0);
+ return 0;
}
int
{
if (n == 0)
- return (0);
+ return 0;
do {
if ((pg_wchar )*s1 != *s2++)
return (*(const pg_wchar *)s1 -
if (*s1++ == 0)
break;
} while (--n != 0);
- return (0);
+ return 0;
}
size_t
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.17 1998/08/24 01:14:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.18 1998/09/01 03:26:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
dbowner = (Oid) heap_getattr(dbtup,
Anum_pg_database_datdba,
- RelationGetTupleDescriptor(dbrel),
+ RelationGetDescr(dbrel),
(char *) NULL);
dbid = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup,
Anum_pg_database_datpath,
- RelationGetTupleDescriptor(dbrel),
+ RelationGetDescr(dbrel),
(char *) NULL);
memcpy(dbpath, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ));
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.9 1998/06/15 19:29:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.10 1998/09/01 03:27:02 momjian Exp $
*
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
/* set size */
alloc->size = size;
- return (AllocElemGetAllocPointer(alloc));
+ return AllocElemGetAllocPointer(alloc);
}
/*
/* free old pointer */
AllocSetFree(set, pointer);
- return (newPointer);
+ return newPointer;
}
/*
count += 1;
}
- return (count);
+ return count;
}
#ifdef NOT_USED
alloc = (AllocElem) OrderedSetGetHead(&set->setData);
if (!AllocElemIsValid(alloc))
- return (NULL);
+ return NULL;
- return (AllocElemGetAllocPointer(alloc));
+ return AllocElemGetAllocPointer(alloc);
}
/*
OrderedElemGetSuccessor(&AllocPointerGetAllocElem(pointer)->elemData);
if (!AllocElemIsValid(alloc))
- return (NULL);
+ return NULL;
- return (AllocElemGetAllocPointer(alloc));
+ return AllocElemGetAllocPointer(alloc);
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.8 1998/06/15 19:29:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.9 1998/09/01 03:27:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
LogTrap(!AllocSizeIsValid(size), BadAllocSize,
("size=%d [0x%x]", size, size));
- return (context->method->alloc(context, size));
+ return context->method->alloc(context, size);
}
/*
LogTrap(!AllocSizeIsValid(size), BadAllocSize,
("size=%d [0x%x]", size, size));
- return (context->method->realloc(context, pointer, size));
+ return context->method->realloc(context, pointer, size);
}
/*
AssertState(MemoryContextEnabled);
AssertArg(MemoryContextIsValid(context));
- return (context->method->getName(context));
+ return context->method->getName(context);
}
#endif
AssertState(MemoryContextEnabled);
AssertArg(PointerIsValid(pointer));
- return (PSIZE(pointer));
+ return PSIZE(pointer);
}
#endif
old = CurrentMemoryContext;
CurrentMemoryContext = context;
- return (old);
+ return old;
}
/*
OrderedElemPushInto(&context->elemData, ActiveGlobalMemorySet);
MemoryContextSwitchTo(savecxt);
- return (context);
+ return context;
}
/*
static Pointer
GlobalMemoryAlloc(GlobalMemory this, Size size)
{
- return (AllocSetAlloc(&this->setData, size));
+ return AllocSetAlloc(&this->setData, size);
}
/*
Pointer pointer,
Size size)
{
- return (AllocSetRealloc(&this->setData, pointer, size));
+ return AllocSetRealloc(&this->setData, pointer, size);
}
/*
static char *
GlobalMemoryGetName(GlobalMemory this)
{
- return (this->name);
+ return this->name;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.8 1998/06/15 19:29:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/oset.c,v 1.9 1998/09/01 03:27:05 momjian Exp $
*
* NOTE
* XXX This is a preliminary implementation which lacks fail-fast
if (elem == (OrderedElem) NULL)
return (Pointer) NULL;
- return ((Pointer) ((char *) (elem) - (elem)->set->offset));
+ return (Pointer) ((char *) (elem) - (elem)->set->offset);
}
/*
bool
OrderedSetContains(OrderedSet set, OrderedElem elem)
{
- return ((bool) (elem->set == set && (elem->next || elem->prev)));
+ return (bool) (elem->set == set && (elem->next || elem->prev));
}
/*
elem = set->head;
if (elem->next)
- return (OrderedElemGetBase(elem));
- return (NULL);
+ return OrderedElemGetBase(elem);
+ return NULL;
}
/*
elem = set->tail;
if (elem->prev)
- return (OrderedElemGetBase(elem));
- return (NULL);
+ return OrderedElemGetBase(elem);
+ return NULL;
}
#endif
{
elem = elem->prev;
if (elem->prev)
- return (OrderedElemGetBase(elem));
- return (NULL);
+ return OrderedElemGetBase(elem);
+ return NULL;
}
/*
{
elem = elem->next;
if (elem->next)
- return (OrderedElemGetBase(elem));
- return (NULL);
+ return OrderedElemGetBase(elem);
+ return NULL;
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.6 1998/02/26 04:38:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.7 1998/09/01 03:27:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef PALLOC_IS_MALLOC
return malloc(size);
#else
- return (MemoryContextAlloc(CurrentMemoryContext, size));
+ return MemoryContextAlloc(CurrentMemoryContext, size);
#endif /* PALLOC_IS_MALLOC */
}
#ifdef PALLOC_IS_MALLOC
return realloc(pointer, size);
#else
- return (MemoryContextRealloc(CurrentMemoryContext, pointer, size));
+ return MemoryContextRealloc(CurrentMemoryContext, pointer, size);
#endif
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.12 1998/06/15 19:29:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.13 1998/09/01 03:27:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
PortalVariableMemoryAlloc(PortalVariableMemory this,
Size size)
{
- return (AllocSetAlloc(&this->setData, size));
+ return AllocSetAlloc(&this->setData, size);
}
/* ----------------
Pointer pointer,
Size size)
{
- return (AllocSetRealloc(&this->setData, pointer, size));
+ return AllocSetRealloc(&this->setData, pointer, size);
}
/* ----------------
static char *
PortalVariableMemoryGetName(PortalVariableMemory this)
{
- return (form("%s-var", PortalVariableMemoryGetPortal(this)->name));
+ return form("%s-var", PortalVariableMemoryGetPortal(this)->name);
}
/* ----------------
AssertState(PointerIsValid(block));
- return (AllocSetAlloc(&block->setData, size));
+ return AllocSetAlloc(&block->setData, size);
}
/* ----------------
AssertState(PointerIsValid(block));
- return (AllocSetRealloc(&block->setData, pointer, size));
+ return AllocSetRealloc(&block->setData, pointer, size);
}
/* ----------------
static char *
PortalHeapMemoryGetName(PortalHeapMemory this)
{
- return (form("%s-heap", PortalHeapMemoryGetPortal(this)->name));
+ return form("%s-heap", PortalHeapMemoryGetPortal(this)->name);
}
/* ----------------
portal = BlankPortal;
}
- return (portal);
+ return portal;
}
/*
if (PortalIsValid(portal))
{
elog(NOTICE, "BlankPortalAssignName: portal %s already exists", name);
- return (portal);
+ return portal;
}
/*
*/
PortalHashTableInsert(portal);
- return (portal);
+ return portal;
}
/*
AssertState(PortalManagerEnabled);
AssertArg(PortalIsValid(portal));
- return (portal->queryDesc);
+ return portal->queryDesc;
}
/*
AssertState(PortalManagerEnabled);
AssertArg(PortalIsValid(portal));
- return (portal->state);
+ return portal->state;
}
/*
if (PortalIsValid(portal))
{
elog(NOTICE, "CreatePortal: portal %s already exists", name);
- return (portal);
+ return portal;
}
/* make new portal structure */
PortalHashTableInsert(portal);
/* Trap(PointerIsValid(name), Unimplemented); */
- return (portal);
+ return portal;
}
/*
PortalVariableMemory
PortalGetVariableMemory(Portal portal)
{
- return (&portal->variable);
+ return &portal->variable;
}
/*
PortalHeapMemory
PortalGetHeapMemory(Portal portal)
{
- return (&portal->heap);
+ return &portal->heap;
}
/*
static Portal
PortalVariableMemoryGetPortal(PortalVariableMemory context)
{
- return ((Portal) ((char *) context - offsetof(PortalD, variable)));
+ return (Portal) ((char *) context - offsetof(PortalD, variable));
}
/*
static Portal
PortalHeapMemoryGetPortal(PortalHeapMemory context)
{
- return ((Portal) ((char *) context - offsetof(PortalD, heap)));
+ return (Portal) ((char *) context - offsetof(PortalD, heap));
}
/*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.13 1998/02/26 04:38:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.14 1998/09/01 03:27:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
root->lt_right = majorLeftist;
}
}
- return (root);
+ return root;
}
static struct leftist *
if (!tuplecmp(root->lt_tuple, new1->lt_tuple, context))
{
new1->lt_left = root;
- return (new1);
+ return new1;
}
left = root->lt_left;
right = root->lt_right;
root->lt_right = new1;
root->lt_dist = 2;
}
- return (root);
+ return root;
}
right = linsert(right, new1, context);
if (right->lt_dist < left->lt_dist)
root->lt_dist = 1 + right->lt_dist;
root->lt_right = right;
}
- return (root);
+ return root;
}
/*
*treep = lmerge(tp->lt_left, tp->lt_right, context);
pfree(tp);
- return (tup);
+ return tup;
}
/*
bool isnull;
if (ltup == (HeapTuple) NULL)
- return (0);
+ return 0;
if (rtup == (HeapTuple) NULL)
- return (1);
+ return 1;
while (nkey < context->nKeys && !result)
{
lattr = heap_getattr(ltup,
context->scanKeys[nkey].sk_attno,
context->tupDesc, &isnull);
if (isnull)
- return (0);
+ return 0;
rattr = heap_getattr(rtup,
context->scanKeys[nkey].sk_attno,
context->tupDesc,
&isnull);
if (isnull)
- return (1);
+ return 1;
if (context->scanKeys[nkey].sk_flags & SK_COMMUTE)
{
if (!(result =
-(long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (rattr, lattr);
nkey++;
}
- return (result == 1);
+ return result == 1;
}
#ifdef EBUG
int error = 0;
if (tree == NULL)
- return (0);
+ return 0;
lnodes = checktreer(tree->lt_left, level + 1, context);
rnodes = checktreer(tree->lt_right, level + 1, context);
if (lnodes < 0)
printf("%d:\tRight child < parent.\n");
}
if (error)
- return (-1 + -lnodes + -rnodes);
- return (1 + lnodes + rnodes);
+ return -1 + -lnodes + -rnodes;
+ return 1 + lnodes + rnodes;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.41 1998/06/15 19:29:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.42 1998/09/01 03:27:13 momjian Exp $
*
* NOTES
* Sorts the first relation into the second relation.
{
Assert(foundeor);
pfree(memtuples);
- return (false);
+ return false;
}
t_last++;
PS(node)->tupcount = t_last;
PS(node)->memtuples = memtuples;
}
- return (!foundeor);
+ return !foundeor;
}
/*
pfree(memtuples);
- return (!foundeor);
+ return !foundeor;
}
/*
if (!HeapTupleIsValid(tup))
{
- return (NULL); /* just in case */
+ return NULL; /* just in case */
}
rettup = (HeapTuple) palloc(tup->t_len);
memmove((char *) rettup, (char *) tup, tup->t_len); /* XXX */
- return (rettup);
+ return rettup;
}
/*
merge(node, tp);
rewind(tp->tp_file);
}
- return (tp->tp_file);
+ return tp->tp_file;
}
/*
if (ScanDirectionIsForward(node->plan.state->es_direction))
{
if (PS(node)->psort_current < PS(node)->tupcount)
- return (PS(node)->memtuples[PS(node)->psort_current++]);
+ return PS(node)->memtuples[PS(node)->psort_current++];
else
{
PS(node)->all_fetched = true;
if (PS(node)->psort_current <= 0)
return NULL;
}
- return (PS(node)->memtuples[PS(node)->psort_current - 1]);
+ return PS(node)->memtuples[PS(node)->psort_current - 1];
}
}
tp->tl_fd = fileno(file);
tp->tl_next = Tapes;
Tapes = tp;
- return (file);
+ return file;
}
/*
else if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr)))
result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr);
}
- return (result);
+ return result;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.17 1998/08/19 02:03:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.18 1998/09/01 03:27:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or
* aborted */
- return (false);
+ return false;
if (TransactionIdIsCurrentTransactionId(tuple->t_xmin))
{
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
- return (true);
+ return true;
else
- return (false);
+ return false;
}
if (!TransactionIdDidCommit(tuple->t_xmin))
{
if (TransactionIdDidAbort(tuple->t_xmin))
tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
- return (false);
+ return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
/* the tuple was inserted validly */
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid or aborted */
- return (true);
+ return true;
if (tuple->t_infomask & HEAP_XMAX_COMMITTED)
- return (false);
+ return false;
if (TransactionIdIsCurrentTransactionId(tuple->t_xmax))
- return (false);
+ return false;
if (!TransactionIdDidCommit(tuple->t_xmax))
{
if (TransactionIdDidAbort(tuple->t_xmax))
tuple->t_infomask |= HEAP_XMAX_INVALID; /* aborted */
- return (true);
+ return true;
}
/* by here, deleting transaction has committed */
tuple->t_infomask |= HEAP_XMAX_COMMITTED;
- return (false);
+ return false;
}
/*
{
if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or
* aborted */
- return (false);
+ return false;
if (TransactionIdIsCurrentTransactionId(tuple->t_xmin))
{
if (CommandIdGEScanCommandId(tuple->t_cmin))
- return (false); /* inserted after scan started */
+ return false; /* inserted after scan started */
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
- return (true);
+ return true;
Assert(TransactionIdIsCurrentTransactionId(tuple->t_xmax));
if (CommandIdGEScanCommandId(tuple->t_cmax))
- return (true); /* deleted after scan started */
+ return true; /* deleted after scan started */
else
- return (false); /* deleted before scan started */
+ return false; /* deleted before scan started */
}
/*
{
if (TransactionIdDidAbort(tuple->t_xmin))
tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
- return (false);
+ return false;
}
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
/* by here, the inserting transaction has committed */
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid or aborted */
- return (true);
+ return true;
if (tuple->t_infomask & HEAP_XMAX_COMMITTED)
- return (false);
+ return false;
if (TransactionIdIsCurrentTransactionId(tuple->t_xmax))
{
if (CommandIdGEScanCommandId(tuple->t_cmax))
- return (true); /* deleted after scan started */
+ return true; /* deleted after scan started */
else
- return (false); /* deleted before scan started */
+ return false; /* deleted before scan started */
}
if (!TransactionIdDidCommit(tuple->t_xmax))
{
if (TransactionIdDidAbort(tuple->t_xmax))
tuple->t_infomask |= HEAP_XMAX_INVALID; /* aborted */
- return (true);
+ return true;
}
/* xmax transaction committed */
tuple->t_infomask |= HEAP_XMAX_COMMITTED;
- return (false);
+ return false;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.22 1998/06/19 02:55:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.23 1998/09/01 03:27:19 momjian Exp $
*
*
}
else
cp = rawid;
- return (cp);
+ return cp;
} /* fmtId() */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.81 1998/08/29 18:06:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.82 1998/09/01 03:27:21 momjian Exp $
*
*
* dump the contents of all the classes.
*/
static void
-dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
+dumpClasses(const TableInfo *tblinfo, const int numTables, FILE *fout,
const char *onlytable, const bool oids)
{
char *t;
if (s == (char *) NULL)
- return (strdup(add));
+ return strdup(add);
t = (char *) calloc((strlen(s) + strlen(add) + 1), sizeof(char));
sprintf(t, "%s,%s", s, add);
- return (t);
+ return t;
}
/*
/* RULE == R */
if (strstr(s, "arwR"))
- return (strdup("ALL"));
+ return strdup("ALL");
if (strchr(s, 'a'))
acls = AddAcl(acls, "INSERT");
if (strchr(s, 'R'))
acls = AddAcl(acls, "RULES");
- return (acls);
+ return acls;
}
/* This will parse the acl string of TableInfo
}
*count = NumAcls;
- return (ParsedAcl);
+ return ParsedAcl;
}
/*
* dumpACL:
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.9 1998/03/30 16:47:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.10 1998/09/01 03:27:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
else
retcode = 0;
- return (retcode);
+ return retcode;
}
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: genam.h,v 1.14 1998/08/19 02:03:35 momjian Exp $
+ * $Id: genam.h,v 1.15 1998/09/01 03:27:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
uint16 procnum);
extern Datum
GetIndexValue(HeapTuple tuple, TupleDesc hTupDesc,
- int attOff, AttrNumber attrNums[], FuncIndexInfo *fInfo,
+ int attOff, AttrNumber *attrNums, FuncIndexInfo *fInfo,
bool *attNull);
/* in genam.c */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: hash.h,v 1.17 1998/08/19 02:03:37 momjian Exp $
+ * $Id: hash.h,v 1.18 1998/09/01 03:27:31 momjian Exp $
*
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
extern uint32 hashfloat4(float32 keyp);
extern uint32 hashfloat8(float64 keyp);
extern uint32 hashoid(Oid key);
-extern uint32 hashoid8(Oid key[]);
+extern uint32 hashoid8(Oid *key);
extern uint32 hashchar(char key);
extern uint32 hashtext(struct varlena * key);
extern uint32 hashname(NameData *n);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.35 1998/08/19 02:03:39 momjian Exp $
+ * $Id: heapam.h,v 1.36 1998/09/01 03:27:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void heap_restrpos(HeapScanDesc scan);
/* in common/heaptuple.c */
-extern Size ComputeDataSize(TupleDesc tupleDesc, Datum value[], char nulls[]);
+extern Size ComputeDataSize(TupleDesc tupleDesc, Datum *value, char *nulls);
extern void
DataFill(char *data, TupleDesc tupleDesc,
- Datum value[], char nulls[], uint16 *infomask,
+ Datum *value, char *nulls, uint16 *infomask,
bits8 *bit);
extern int heap_attisnull(HeapTuple tup, int attnum);
extern int heap_sysattrlen(AttrNumber attno);
extern HeapTuple heap_copytuple(HeapTuple tuple);
extern HeapTuple
heap_formtuple(TupleDesc tupleDescriptor,
- Datum value[], char nulls[]);
+ Datum *value, char *nulls);
extern HeapTuple
heap_modifytuple(HeapTuple tuple,
- Relation relation, Datum replValue[], char replNull[], char repl[]);
+ Relation relation, Datum *replValue, char *replNull, char *repl);
HeapTuple heap_addheader(uint32 natts, int structlen, char *structure);
/* in common/heap/stats.c */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: itup.h,v 1.14 1998/06/15 18:39:54 momjian Exp $
+ * $Id: itup.h,v 1.15 1998/09/01 03:27:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* indextuple.h */
extern IndexTuple
index_formtuple(TupleDesc tupleDescriptor,
- Datum value[], char null[]);
+ Datum *value, char *null);
extern Datum
nocache_index_getattr(IndexTuple tup, int attnum,
TupleDesc tupleDesc, bool *isnull);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tupdesc.h,v 1.18 1998/08/19 02:03:40 momjian Exp $
+ * $Id: tupdesc.h,v 1.19 1998/09/01 03:27:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
int natts;
/* Number of attributes in the tuple */
- AttributeTupleForm *attrs;
+ Form_pg_attribute *attrs;
/* attrs[N] is a pointer to the description of Attribute Number N+1. */
TupleConstr *constr;
} *TupleDesc;
extern TupleDesc CreateTemplateTupleDesc(int natts);
-extern TupleDesc CreateTupleDesc(int natts, AttributeTupleForm *attrs);
+extern TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs);
extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tupmacs.h,v 1.4 1998/02/26 04:40:31 momjian Exp $
+ * $Id: tupmacs.h,v 1.5 1998/09/01 03:27:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define att_isnull(ATT, BITS) (!((BITS)[(ATT) >> 3] & (1 << ((ATT) & 0x07))))
/*
- * given a AttributeTupleForm and a pointer into a tuple's data
+ * given a Form_pg_attribute and a pointer into a tuple's data
* area, return the correct value or pointer.
*
* We return a 4 byte (char *) value in all cases. If the attribute has
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: valid.h,v 1.13 1998/01/31 04:39:24 momjian Exp $
+ * $Id: valid.h,v 1.14 1998/09/01 03:27:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
_tuple = (HeapTuple) PageGetItem((Page) (disk_page), (itemId)); \
\
if ((key) != NULL) \
- HeapKeyTest(_tuple, RelationGetTupleDescriptor(relation), \
+ HeapKeyTest(_tuple, RelationGetDescr(relation), \
(nKeys), (key), _res); \
else \
_res = TRUE; \
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bootstrap.h,v 1.11 1998/02/26 04:40:35 momjian Exp $
+ * $Id: bootstrap.h,v 1.12 1998/09/01 03:27:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define EMITPROMPT printf("> ")
extern Relation reldesc;
-extern AttributeTupleForm attrtypes[MAXATTR];
+extern Form_pg_attribute attrtypes[MAXATTR];
extern int numattr;
extern int DebugMode;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: catalog.h,v 1.4 1997/09/08 02:34:39 momjian Exp $
+ * $Id: catalog.h,v 1.5 1998/09/01 03:27:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-extern char *relpath(char relname[]);
+extern char *relpath(char *relname);
extern bool IsSystemRelationName(char *relname);
extern bool IsSharedSystemRelationName(char *relname);
extern Oid newoid(void);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heap.h,v 1.14 1998/08/19 02:03:44 momjian Exp $
+ * $Id: heap.h,v 1.15 1998/09/01 03:27:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern Oid heap_create_with_catalog(char *relname,
TupleDesc tupdesc, char relkind);
-extern void heap_destroy_with_catalog(char relname[]);
+extern void heap_destroy_with_catalog(char *relname);
extern void heap_destroy(Relation rel);
extern void InitTempRelList(void);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: index.h,v 1.11 1998/08/19 02:03:45 momjian Exp $
+ * $Id: index.h,v 1.12 1998/09/01 03:27:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
-extern Form_pg_am AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId);
+extern Form_pg_am AccessMethodObjectIdGetForm(Oid accessMethodObjectId);
extern void UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate);
List *attributeList,
Oid accessMethodObjectId,
int numatts,
- AttrNumber attNums[],
- Oid classObjectId[],
+ AttrNumber *attNums,
+ Oid *classObjectId,
uint16 parameterCount,
Datum *parameter,
Node *predicate,
extern void
FormIndexDatum(int numberOfAttributes,
- AttrNumber attributeNumber[], HeapTuple heapTuple,
+ AttrNumber *attributeNumber, HeapTuple heapTuple,
TupleDesc heapDescriptor, Datum *datum,
char *nullv, FuncIndexInfoPtr fInfo);
extern void
index_build(Relation heapRelation, Relation indexRelation,
- int numberOfAttributes, AttrNumber attributeNumber[],
+ int numberOfAttributes, AttrNumber *attributeNumber,
uint16 parameterCount, Datum *parameter, FuncIndexInfo *funcInfo,
PredInfo *predInfo);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: indexing.h,v 1.16 1998/08/19 02:03:46 momjian Exp $
+ * $Id: indexing.h,v 1.17 1998/09/01 03:27:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*
* Functions for each index to perform the necessary scan on a cache miss.
*/
-extern void CatalogOpenIndices(int nIndices, char *names[], Relation idescs[]);
+extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
extern void CatalogCloseIndices(int nIndices, Relation *idescs);
extern void
CatalogIndexInsert(Relation *idescs,
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_attribute.h,v 1.41 1998/08/27 05:06:56 momjian Exp $
+ * $Id: pg_attribute.h,v 1.42 1998/09/01 03:27:49 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
/*
* attlen is a copy of the typlen field from pg_type for this
- * attribute. See atttypid above. See struct TypeTupleFormData for
+ * attribute. See atttypid above. See struct Form_pg_type for
* definition.
*/
int2 attnum;
/*
* attbyval is a copy of the typbyval field from pg_type for this
- * attribute. See atttypid above. See struct TypeTupleFormData for
+ * attribute. See atttypid above. See struct Form_pg_type for
* definition.
*/
bool attisset;
/*
* attalign is a copy of the typalign field from pg_type for this
- * attribute. See atttypid above. See struct TypeTupleFormData for
+ * attribute. See atttypid above. See struct Form_pg_type for
* definition.
*/
bool attnotnull;
* the format of pg_attribute relation.
* ----------------
*/
-typedef FormData_pg_attribute *AttributeTupleForm;
+typedef FormData_pg_attribute *Form_pg_attribute;
/* ----------------
* compiler constants for pg_attribute
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_index.h,v 1.6 1997/11/21 18:12:09 momjian Exp $
+ * $Id: pg_index.h,v 1.7 1998/09/01 03:27:51 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* the format of pg_index relation.
* ----------------
*/
-typedef FormData_pg_index *IndexTupleForm;
+typedef FormData_pg_index *Form_pg_index;
/* ----------------
* compiler constants for pg_index
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_inherits.h,v 1.4 1997/09/08 02:35:14 momjian Exp $
+ * $Id: pg_inherits.h,v 1.5 1998/09/01 03:27:53 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* the format of pg_inherits relation.
* ----------------
*/
-typedef FormData_pg_inherits *InheritsTupleForm;
+typedef FormData_pg_inherits *Form_pg_inherits;
/* ----------------
* compiler constants for pg_inherits
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_operator.h,v 1.34 1998/08/19 02:03:53 momjian Exp $
+ * $Id: pg_operator.h,v 1.35 1998/09/01 03:27:55 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* the format of pg_operator relation.
* ----------------
*/
-typedef FormData_pg_operator *OperatorTupleForm;
+typedef FormData_pg_operator *Form_pg_operator;
/* ----------------
* compiler constants for pg_operator
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_type.h,v 1.45 1998/08/27 05:06:57 momjian Exp $
+ * $Id: pg_type.h,v 1.46 1998/09/01 03:27:58 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* but I doubt it - BRYANH 96.08).
*/
text typdefault; /* VARIABLE LENGTH FIELD */
-} TypeTupleFormData;
+} FormData_pg_type;
/* ----------------
* Form_pg_type corresponds to a pointer to a row with
* the format of pg_type relation.
* ----------------
*/
-typedef TypeTupleFormData *TypeTupleForm;
+typedef FormData_pg_type *Form_pg_type;
/* ----------------
* compiler constants for pg_type
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_version.h,v 1.5 1997/09/08 02:35:35 momjian Exp $
+ * $Id: pg_version.h,v 1.6 1998/09/01 03:28:00 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* the format of pg_version relation.
* ----------------
*/
-typedef FormData_pg_version *VersionTupleForm;
+typedef FormData_pg_version *Form_pg_version;
/* ----------------
* compiler constants for pg_version
*
* Copyright (c) 1994-5, Regents of the University of California
*
- * $Id: cluster.h,v 1.4 1997/09/08 02:35:39 momjian Exp $
+ * $Id: cluster.h,v 1.5 1998/09/01 03:28:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* functions
*/
-extern void cluster(char oldrelname[], char oldindexname[]);
+extern void cluster(char *oldrelname, char *oldindexname);
#endif /* CLUSTER_H */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: vacuum.h,v 1.14 1998/08/19 19:59:49 momjian Exp $
+ * $Id: vacuum.h,v 1.15 1998/09/01 03:28:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
FuncIndexInfo finfo;
FuncIndexInfo *finfoP;
- IndexTupleForm tform;
+ Form_pg_index tform;
int natts;
} IndDesc;
typedef struct
{
- AttributeTupleForm attr;
+ Form_pg_attribute attr;
Datum best,
guess1,
guess2,
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.23 1998/07/27 19:38:32 vadim Exp $
+ * $Id: executor.h,v 1.24 1998/09/01 03:28:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void
ExecAssignScanTypeFromOuterPlan(Plan *node,
CommonScanState *csstate);
-extern AttributeTupleForm ExecGetTypeInfo(Relation relDesc);
+extern Form_pg_attribute ExecGetTypeInfo(Relation relDesc);
extern void
ExecOpenIndices(Oid resultRelationOid,
* Interface to hba.c
*
*
- * $Id: hba.h,v 1.9 1998/06/13 04:27:18 momjian Exp $
+ * $Id: hba.h,v 1.10 1998/09/01 03:28:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char *auth_arg, UserAuth *auth_method);
int
authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
- const char postgres_username[], const char auth_arg[]);
+ const char *postgres_username, const char *auth_arg);
#endif
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodes.h,v 1.28 1998/08/25 21:37:02 scrappy Exp $
+ * $Id: nodes.h,v 1.29 1998/09/01 03:28:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
T_OrderKey,
T_JoinKey,
T_MergeOrder,
- T_CInfo,
+ T_ClauseInfo,
T_JoinMethod,
T_HInfo,
T_MInfo,
- T_JInfo,
+ T_JoinInfo,
T_Iter,
T_Stream,
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: relation.h,v 1.9 1998/08/04 16:44:26 momjian Exp $
+ * $Id: relation.h,v 1.10 1998/09/01 03:28:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* clause info
*******/
-typedef struct CInfo
+typedef struct ClauseInfo
{
NodeTag type;
Expr *clause; /* should be an OP clause */
/* hashjoin only */
Oid hashjoinoperator;
Relid cinfojoinid;
-} CInfo;
+} ClauseInfo;
typedef struct JoinMethod
{
MergeOrder *m_ordering;
} MInfo;
-typedef struct JInfo
+typedef struct JoinInfo
{
NodeTag type;
List *otherrels;
bool mergejoinable;
bool hashjoinable;
bool inactive;
-} JInfo;
+} JoinInfo;
typedef struct Iter
{
{
NodeTag type;
Path *pathptr;
- CInfo *cinfo;
+ ClauseInfo *cinfo;
int *clausetype;
struct Stream *upstream;
struct Stream *downstream;
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: clauseinfo.h,v 1.7 1998/02/26 04:42:08 momjian Exp $
+ * $Id: clauseinfo.h,v 1.8 1998/09/01 03:28:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "nodes/pg_list.h"
#include "nodes/relation.h"
-extern bool valid_or_clause(CInfo *clauseinfo);
+extern bool valid_or_clause(ClauseInfo *clauseinfo);
extern List *get_actual_clauses(List *clauseinfo_list);
extern void
get_relattvals(List *clauseinfo_list, List **attnos,
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: joininfo.h,v 1.6 1998/07/18 04:22:51 momjian Exp $
+ * $Id: joininfo.h,v 1.7 1998/09/01 03:28:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "nodes/relation.h"
#include "nodes/primnodes.h"
-extern JInfo *joininfo_member(List *join_relids, List *joininfo_list);
-extern JInfo *find_joininfo_node(RelOptInfo *this_rel, List *join_relids);
+extern JoinInfo *joininfo_member(List *join_relids, List *joininfo_list);
+extern JoinInfo *find_joininfo_node(RelOptInfo *this_rel, List *join_relids);
extern Var *other_join_clause_var(Var *var, Expr *clause);
#endif /* JOININFO_H */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: xfunc.h,v 1.8 1998/07/18 04:22:52 momjian Exp $
+ * $Id: xfunc.h,v 1.9 1998/09/01 03:28:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void xfunc_trypullup(RelOptInfo *rel);
extern int
xfunc_shouldpull(Path *childpath, JoinPath *parentpath,
- int whichchild, CInfo *maxcinfopt);
-extern CInfo *
-xfunc_pullup(Path *childpath, JoinPath *parentpath, CInfo *cinfo,
+ int whichchild, ClauseInfo *maxcinfopt);
+extern ClauseInfo *
+xfunc_pullup(Path *childpath, JoinPath *parentpath, ClauseInfo *cinfo,
int whichchild, int clausetype);
extern Cost xfunc_rank(Expr *clause);
extern Cost xfunc_expense(Query *queryInfo, Expr *clause);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dest.h,v 1.14 1998/05/06 23:50:49 momjian Exp $
+ * $Id: dest.h,v 1.15 1998/09/01 03:28:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
typedef struct AttrInfo {
int numAttr;
- AttributeTupleForm *attrs;
+ Form_pg_attribute *attrs;
} AttrInfo;
*/
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: array.h,v 1.12 1998/07/12 21:29:38 momjian Exp $
+ * $Id: array.h,v 1.13 1998/09/01 03:28:26 momjian Exp $
*
* NOTES
* XXX the data array should be LONGALIGN'd -- notice that the array
extern char *array_out(ArrayType *v, Oid element_type);
extern char *array_dims(ArrayType *v, bool *isNull);
extern Datum
-array_ref(ArrayType *array, int n, int indx[], int reftype,
+array_ref(ArrayType *array, int n, int *indx, int reftype,
int elmlen, int arraylen, bool *isNull);
extern Datum
-array_clip(ArrayType *array, int n, int upperIndx[],
- int lowerIndx[], int reftype, int len, bool *isNull);
+array_clip(ArrayType *array, int n, int *upperIndx,
+ int *lowerIndx, int reftype, int len, bool *isNull);
extern char *
-array_set(ArrayType *array, int n, int indx[], char *dataPtr,
+array_set(ArrayType *array, int n, int *indx, char *dataPtr,
int reftype, int elmlen, int arraylen, bool *isNull);
extern char *
-array_assgn(ArrayType *array, int n, int upperIndx[],
- int lowerIndx[], ArrayType *newArr, int reftype,
+array_assgn(ArrayType *array, int n, int *upperIndx,
+ int *lowerIndx, ArrayType *newArr, int reftype,
int len, bool *isNull);
extern int array_eq(ArrayType *array1, ArrayType *array2);
extern int
* [these names seem to be too generic. Add prefix for arrays? -- AY]
*/
-extern int GetOffset(int n, int dim[], int lb[], int indx[]);
-extern int getNitems(int n, int a[]);
-extern int compute_size(int st[], int endp[], int n, int base);
-extern void mda_get_offset_values(int n, int dist[], int PC[], int span[]);
-extern void mda_get_range(int n, int span[], int st[], int endp[]);
-extern void mda_get_prod(int n, int range[], int P[]);
-extern int tuple2linear(int n, int tup[], int scale[]);
-extern void array2chunk_coord(int n, int C[], int a_coord[], int c_coord[]);
-extern int next_tuple(int n, int curr[], int span[]);
+extern int GetOffset(int n, int *dim, int *lb, int *indx);
+extern int getNitems(int n, int *a);
+extern int compute_size(int *st, int *endp, int n, int base);
+extern void mda_get_offset_values(int n, int *dist, int *PC, int *span);
+extern void mda_get_range(int n, int *span, int *st, int *endp);
+extern void mda_get_prod(int n, int *range, int *P);
+extern int tuple2linear(int n, int *tup, int *scale);
+extern void array2chunk_coord(int n, int *C, int *a_coord, int *c_coord);
+extern int next_tuple(int n, int *curr, int *span);
/*
* prototypes for functions defined in chunk.c
*/
extern char *
-_ChunkArray(int fd, FILE *afd, int ndim, int dim[], int baseSize,
+_ChunkArray(int fd, FILE *afd, int ndim, int *dim, int baseSize,
int *nbytes, char *chunkfile);
extern int
-_ReadChunkArray(int st[], int endp[], int bsize, int fp,
+_ReadChunkArray(int *st, int *endp, int bsize, int fp,
char *destfp, ArrayType *array, int isDestLO, bool *isNull);
extern struct varlena *
-_ReadChunkArray1El(int st[], int bsize, int fp,
+_ReadChunkArray1El(int *st, int bsize, int fp,
ArrayType *array, bool *isNull);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.49 1998/08/31 07:55:50 momjian Exp $
+ * $Id: builtins.h,v 1.50 1998/09/01 03:28:28 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
extern int32 int2in(char *num);
extern char *int2out(int16 sh);
extern int16 *int28in(char *shs);
-extern char *int28out(int16 (*shs)[]);
+extern char *int28out(int16 **shs);
extern int32 *int44in(char *input_string);
-extern char *int44out(int32 an_array[]);
+extern char *int44out(int32 *an_array);
extern int32 int4in(char *num);
extern char *int4out(int32 l);
extern int32 i2toi4(int16 arg1);
extern int32 btfloat4cmp(float32 a, float32 b);
extern int32 btfloat8cmp(float64 a, float64 b);
extern int32 btoidcmp(Oid a, Oid b);
-extern int32 btoid8cmp(Oid a[], Oid b[]);
+extern int32 btoid8cmp(Oid *a, Oid *b);
extern int32 btabstimecmp(AbsoluteTime a, AbsoluteTime b);
extern int32 btcharcmp(char a, char b);
extern int32 btnamecmp(NameData *a, NameData *b);
/* oid.c */
extern Oid *oid8in(char *oidString);
-extern char *oid8out(Oid (*oidArray)[]);
+extern char *oid8out(Oid **oidArray);
extern Oid oidin(char *s);
extern char *oidout(Oid o);
extern bool oideq(Oid arg1, Oid arg2);
extern bool oidne(Oid arg1, Oid arg2);
-extern bool oid8eq(Oid arg1[], Oid arg2[]);
-extern bool oid8lt(Oid arg1[], Oid arg2[]);
-extern bool oid8le(Oid arg1[], Oid arg2[]);
-extern bool oid8ge(Oid arg1[], Oid arg2[]);
-extern bool oid8gt(Oid arg1[], Oid arg2[]);
+extern bool oid8eq(Oid *arg1, Oid *arg2);
+extern bool oid8lt(Oid *arg1, Oid *arg2);
+extern bool oid8le(Oid *arg1, Oid *arg2);
+extern bool oid8ge(Oid *arg1, Oid *arg2);
+extern bool oid8gt(Oid *arg1, Oid *arg2);
extern bool oideqint4(Oid arg1, int32 arg2);
extern bool int4eqoid(int32 arg1, Oid arg2);
extern text *oid_text(Oid arg1);
/* regproc.c */
extern int32 regprocin(char *pro_name_and_oid);
extern char *regprocout(RegProcedure proid);
-extern text *oid8types(Oid (*oidArray)[]);
+extern text *oid8types(Oid **oidArray);
extern Oid regproctooid(RegProcedure rp);
/* define macro to replace mixed-case function call - tgl 97/04/27 */
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: catcache.h,v 1.11 1998/02/26 04:43:53 momjian Exp $
+ * $Id: catcache.h,v 1.12 1998/09/01 03:28:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void SystemCacheRelationFlushed(Oid relId);
extern CatCache *
InitSysCache(char *relname, char *indname, int id, int nkeys,
- int key[], HeapTuple (*iScanfuncP) ());
+ int *key, HeapTuple (*iScanfuncP) ());
extern HeapTuple
SearchSysCache(struct catcache * cache, Datum v1, Datum v2,
Datum v3, Datum v4);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dt.h,v 1.30 1998/05/31 17:08:35 thomas Exp $
+ * $Id: dt.h,v 1.31 1998/09/01 03:28:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern int
ParseDateTime(char *timestr, char *lowstr,
- char *field[], int ftype[], int maxfields, int *numfields);
+ char **field, int *ftype, int maxfields, int *numfields);
extern int
-DecodeDateTime(char *field[], int ftype[],
+DecodeDateTime(char **field, int *ftype,
int nf, int *dtype, struct tm * tm, double *fsec, int *tzp);
extern int
-DecodeTimeOnly(char *field[], int ftype[], int nf,
+DecodeTimeOnly(char **field, int *ftype, int nf,
int *dtype, struct tm * tm, double *fsec);
extern int
-DecodeDateDelta(char *field[], int ftype[],
+DecodeDateDelta(char **field, int *ftype,
int nf, int *dtype, struct tm * tm, double *fsec);
extern int EncodeDateOnly(struct tm * tm, int style, char *str);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.18 1998/08/19 02:04:07 momjian Exp $
+ * $Id: rel.h,v 1.19 1998/09/01 03:28:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#define RelationDecrementReferenceCount(relation) ((relation)->rd_refcnt -= 1)
/*
- * RelationGetAccessMethodTupleForm --
- * Returns access method attribute values for a relation.
- *
- * Note:
- * Assumes relation descriptor is valid.
- */
-#define RelationGetAccessMethodTupleForm(relation) ((relation)->rd_am)
-
-/*
- * RelationGetRelationTupleForm --
+ * RelationGetForm --
* Returns relation attribute values for a relation.
*
* Note:
* Assumes relation descriptor is valid.
*/
-#define RelationGetRelationTupleForm(relation) ((relation)->rd_rel)
+#define RelationGetForm(relation) ((relation)->rd_rel)
/*
#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts)
/*
- * RelationGetTupleDescriptor --
+ * RelationGetDescr --
* Returns tuple descriptor for a relation.
*
* Note:
* Assumes relation descriptor is valid.
*/
-#define RelationGetTupleDescriptor(relation) ((relation)->rd_att)
+#define RelationGetDescr(relation) ((relation)->rd_att)
extern IndexStrategy RelationGetIndexStrategy(Relation relation);
if ((res = PQexec(actual_connection->connection, transaction)) == NULL)
{
register_error(ECPG_TRANS, "Error in transaction processing line %d.", lineno);
- return (FALSE);
+ return FALSE;
}
PQclear(res);
if (strcmp(transaction, "commit") == 0 || strcmp(transaction, "rollback") == 0)
committed = 1;
- return (TRUE);
+ return TRUE;
}
bool
middle = low + (high - low) / 2;
difference = strcmp(middle->name, text);
if (difference == 0)
- return (middle);
+ return middle;
else if (difference < 0)
low = middle + 1;
else
high = middle - 1;
}
- return (NULL);
+ return NULL;
}
for (ip = include_paths; ip != NULL; ip = ip->next)
fprintf(stderr, " %s\n", ip->path);
fprintf(stderr, "End of search list.\n");
- return (OK);
+ return OK;
default:
usage(argv[0]);
- return (ILLEGAL_OPTION);
+ return ILLEGAL_OPTION;
}
}
free(input_filename);
}
}
- return (OK);
+ return OK;
}
middle = low + (high - low) / 2;
difference = strcmp(middle->name, text);
if (difference == 0)
- return (middle);
+ return middle;
else if (difference < 0)
low = middle + 1;
else
high = middle - 1;
}
- return (NULL);
+ return NULL;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.3 1998/08/25 21:37:06 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.4 1998/09/01 03:28:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
middle = low + (high - low) / 2;
difference = strcmp(middle->name, text);
if (difference == 0)
- return (middle);
+ return middle;
else if (difference < 0)
low = middle + 1;
else
high = middle - 1;
}
- return (NULL);
+ return NULL;
}
yylval.ival = strtol((char *)literal,&endptr,2);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad binary integer input!");
- return (ICONST);
+ return ICONST;
}
{xhinside} |
{xbinside} {
yylval.ival = strtol((char *)literal,&endptr,16);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad hexadecimal integer input");
- return (ICONST);
+ return ICONST;
}
{xqstart} {
{xqstop} {
BEGIN(SQL);
yylval.str = strdup(scanstr(literal));
- return (SCONST);
+ return SCONST;
}
{xqdouble} |
{xqinside} {
{xdstop} {
BEGIN(SQL);
yylval.str = strdup(literal);
- return (CSTRING);
+ return CSTRING;
}
{xdinside} {
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
{xdstop} {
BEGIN(C);
yylval.str = strdup(literal);
- return (CSTRING);
+ return CSTRING;
}
{xdinside} {
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
{space}* { /* ignore */ }
{xmstop} {
BEGIN(SQL);
- return (yytext[0]);
+ return yytext[0];
}
{typecast} { return TYPECAST; }
{self}/{space}*-[\.0-9] {
BEGIN(xm);
- return (yytext[0]);
+ return yytext[0];
}
-{self} { return (yytext[0]); }
+{self} { return yytext[0]; }
{operator}/-[\.0-9] {
yylval.str = strdup((char*)yytext);
- return (Op);
+ return Op;
}
{operator} {
if (strcmp((char*)yytext,"!=") == 0)
yylval.str = strdup("<>"); /* compatability */
else
yylval.str = strdup((char*)yytext);
- return (Op);
+ return Op;
}
{param} {
yylval.ival = atoi((char*)&yytext[1]);
- return (PARAM);
+ return PARAM;
}
{identifier}/{space}*-{number} {
int i;
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
keyword = ScanECPGKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
if (ptr == NULL)
{
yylval.str = strdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
}
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
{real}/{space}*-{number} {
char* endptr;
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad float8 input");
- return (FCONST);
+ return FCONST;
}
{integer} {
char* endptr;
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
{real} {
char* endptr;
yylval.dval = strtod((char *)yytext,&endptr);
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad float input");
- return (FCONST);
+ return FCONST;
}
{integer}/{space}*-{number} {
char* endptr;
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
{integer} {
char* endptr;
if (*endptr != '\0' || errno == ERANGE)
yyerror("ERROR: Bad integer input");
yyerror("WARNING: Integer input is out of range; promoted to float");
- return (FCONST);
+ return FCONST;
}
- return (ICONST);
+ return ICONST;
}
:{identifier}(("->"|\.){identifier})* {
yylval.str = strdup((char*)yytext+1);
keyword = ScanKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
keyword = ScanECPGKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
if (ptr == NULL)
{
yylval.str = strdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
}
}
{space} { /* ignore */ }
";" { BEGIN C; return SQL_SEMI; }
-{other} { return (yytext[0]); }
+{other} { return yytext[0]; }
{exec}{space}{sql} { BEGIN SQL; return SQL_START; }
{ccomment} { /* ignore */ }
{cppline} {
keyword = ScanCKeywordLookup((char*)yytext);
if (keyword != NULL) {
- return (keyword->value);
+ return keyword->value;
}
else
{
if (ptr == NULL)
{
yylval.str = strdup((char*)yytext);
- return (IDENT);
+ return IDENT;
}
}
}
\[ { return('['); }
\] { return(']'); }
\= { return('='); }
-{other} { return (S_ANYTHING); }
+{other} { return S_ANYTHING; }
{exec}{space}{sql}{space}{define} {BEGIN(def_ident);}
{space} {}
{identifier} {
if (c == '-')
{
next++;
- return (find_struct_member(name, next, p->type->u.element->u.members));
+ return find_struct_member(name, next, p->type->u.element->u.members);
}
- else return (find_struct_member(name, next, p->type->u.members));
+ else return find_struct_member(name, next, p->type->u.members);
}
static struct variable *
char * res_str = (char *)mm_alloc(strlen(str) + 1);
strcpy(res_str, str);
- return (res_str);
+ return res_str;
}
static char *
exit(OUT_OF_MEMORY);
}
- return (ptr);
+ return ptr;
}
/* duplicate memberlist */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.29 1998/08/17 03:50:22 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.30 1998/09/01 03:28:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char *p;
if (!value)
- return ((char *) NULL);
+ return (char *) NULL;
#ifdef TCL_ARRAYS_DEBUG
printf("pq_value = '%s'\n", value);
#ifdef TCL_ARRAYS_DEBUG
printf("tcl_value = '%s'\n\n", value);
#endif
- return (value);
+ return value;
}
#endif
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.22 1998/08/17 03:50:31 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.23 1998/09/01 03:28:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static char name[SNAME_SZ + 1] = "";
if (name[0])
- return (name);
+ return name;
pg_krb4_init();
(void) sprintf(PQerrormsg,
"pg_krb4_authname: krb_get_tf_fullname: %s\n",
krb_err_txt[status]);
- return ((char *) NULL);
+ return (char *) NULL;
}
- return (name);
+ return name;
}
/*
(void) sprintf(PQerrormsg,
"pg_krb4_sendauth: kerberos error: %s\n",
krb_err_txt[status]);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
- return (STATUS_OK);
+ return STATUS_OK;
}
#endif /* KRB4 */
if ((p = strchr(aname, '/')) || (p = strchr(aname, '@')))
*p = '\0';
- return (aname);
+ return aname;
}
static krb5_ccache ccache = (krb5_ccache) NULL;
if (ccache)
- return (ccache);
+ return ccache;
/*
* If the user set PGREALM, then we use a ticket file with a special
{
(void) sprintf(PQerrormsg,
"pg_krb5_init: krb5_cc_default_name failed\n");
- return ((krb5_ccache) NULL);
+ return (krb5_ccache) NULL;
}
strcpy(tktbuf, defname);
if (realm = getenv("PGREALM"))
"pg_krb5_init: Kerberos error %d in krb5_cc_resolve\n",
code);
com_err("pg_krb5_init", code, "in krb5_cc_resolve");
- return ((krb5_ccache) NULL);
+ return (krb5_ccache) NULL;
}
- return (ccache);
+ return ccache;
}
/*
static char *authname = (char *) NULL;
if (authname)
- return (authname);
+ return authname;
ccache = pg_krb5_init(); /* don't free this */
"pg_krb5_authname: Kerberos error %d in krb5_cc_get_principal\n",
code);
com_err("pg_krb5_authname", code, "in krb5_cc_get_principal");
- return ((char *) NULL);
+ return (char *) NULL;
}
if (code = krb5_unparse_name(principal, &authname))
{
code);
com_err("pg_krb5_authname", code, "in krb5_unparse_name");
krb5_free_principal(principal);
- return ((char *) NULL);
+ return (char *) NULL;
}
krb5_free_principal(principal);
- return (pg_an_to_ln(authname));
+ return pg_an_to_ln(authname);
}
/*
"pg_krb5_sendauth: Kerberos error %d in krb5_cc_get_principal\n",
code);
com_err("pg_krb5_sendauth", code, "in krb5_cc_get_principal");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/*
code);
com_err("pg_krb5_sendauth", code, "in krb5_parse_name");
krb5_free_principal(client);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
/*
}
krb5_free_principal(client);
krb5_free_principal(server);
- return (code ? STATUS_ERROR : STATUS_OK);
+ return code ? STATUS_ERROR : STATUS_OK;
}
#endif /* KRB5 */
{
(void) sprintf(PQerrormsg,
"fe_sendauth: krb4 authentication failed\n");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
break;
#else
(void) sprintf(PQerrormsg,
"fe_sendauth: krb4 authentication not supported\n");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
#endif
case AUTH_REQ_KRB5:
{
(void) sprintf(PQerrormsg,
"fe_sendauth: krb5 authentication failed\n");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
break;
#else
(void) sprintf(PQerrormsg,
"fe_sendauth: krb5 authentication not supported\n");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
#endif
case AUTH_REQ_PASSWORD:
{
(void) sprintf(PQerrormsg,
"fe_sendauth: no password supplied\n");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
if (pg_password_sendauth(conn, password, areq) != STATUS_OK)
{
(void) sprintf(PQerrormsg,
"fe_sendauth: error sending password authentication\n");
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
break;
default:
(void) sprintf(PQerrormsg,
"fe_sendauth: authentication type %u not supported\n", areq);
- return (STATUS_ERROR);
+ return STATUS_ERROR;
}
- return (STATUS_OK);
+ return STATUS_OK;
}
/*
{
if (pg_authsvc < 0 || pg_authsvc >= n_authsvcs)
fe_setauthsvc(DEFAULT_CLIENT_AUTHSVC, PQerrormsg);
- return (authsvcs[pg_authsvc].msgtype);
+ return authsvcs[pg_authsvc].msgtype;
}
/*
if (name && (authn = (char *) malloc(strlen(name) + 1)))
strcpy(authn, name);
- return (authn);
+ return authn;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.63 1998/08/29 02:09:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.64 1998/09/01 03:28:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
parseInput(conn);
/* PQgetResult will return immediately in all states except BUSY. */
- return (conn->asyncStatus == PGASYNC_BUSY);
+ return conn->asyncStatus == PGASYNC_BUSY;
}
}
p++;
if (*(res->cmdStatus) != 'I') /* UPDATE/DELETE */
- return (p);
+ return p;
while (*p != ' ' && *p)
p++; /* INSERT: skip oid */
if (*p == 0)
return "";
}
p++;
- return (p);
+ return p;
}
return "";
}
* didn't really belong there.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.10 1998/08/17 03:50:39 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.11 1998/09/01 03:28:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
static void
do_field(PQprintOpt *po, PGresult *res,
const int i, const int j, char *buf, const int fs_len,
- char *fields[],
- const int nFields, char *fieldNames[],
- unsigned char fieldNotNum[], int fieldMax[],
+ char **fields,
+ const int nFields, char **fieldNames,
+ unsigned char *fieldNotNum, int *fieldMax,
const int fieldMaxLen, FILE *fout);
static char *
do_header(FILE *fout, PQprintOpt *po, const int nFields,
- int fieldMax[], char *fieldNames[], unsigned char fieldNotNum[],
+ int *fieldMax, char **fieldNames, unsigned char *fieldNotNum,
const int fs_len, PGresult *res);
static void
-output_row(FILE *fout, PQprintOpt *po, const int nFields, char *fields[],
- unsigned char fieldNotNum[], int fieldMax[], char *border,
+output_row(FILE *fout, PQprintOpt *po, const int nFields, char **fields,
+ unsigned char *fieldNotNum, int *fieldMax, char *border,
const int row_index);
static void fill(int length, int max, char filler, FILE *fp);
static void
do_field(PQprintOpt *po, PGresult *res,
const int i, const int j, char *buf, const int fs_len,
- char *fields[],
- const int nFields, char *fieldNames[],
- unsigned char fieldNotNum[], int fieldMax[],
+ char **fields,
+ const int nFields, char **fieldNames,
+ unsigned char *fieldNotNum, int *fieldMax,
const int fieldMaxLen, FILE *fout)
{
static char *
-do_header(FILE *fout, PQprintOpt *po, const int nFields, int fieldMax[],
- char *fieldNames[], unsigned char fieldNotNum[],
+do_header(FILE *fout, PQprintOpt *po, const int nFields, int *fieldMax,
+ char **fieldNames, unsigned char *fieldNotNum,
const int fs_len, PGresult *res)
{
static void
-output_row(FILE *fout, PQprintOpt *po, const int nFields, char *fields[],
- unsigned char fieldNotNum[], int fieldMax[], char *border,
+output_row(FILE *fout, PQprintOpt *po, const int nFields, char **fields,
+ unsigned char *fieldNotNum, int *fieldMax, char *border,
const int row_index)
{
#include
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpReserved ){
- return (TRUE);
+ return TRUE;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.7 1998/08/17 03:50:43 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/pqsignal.c,v 1.8 1998/09/01 03:28:56 momjian Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
if (signo != SIGALRM)
act.sa_flags |= SA_RESTART;
if (sigaction(signo, &act, &oact) < 0)
- return (SIG_ERR);
- return (oact.sa_handler);
+ return SIG_ERR;
+ return oact.sa_handler;
#endif /* !USE_POSIX_SIGNALS */
}
CI_set_field_info(self, lf, new_field_name, new_adtid, new_adtsize);
}
- return (SOCK_get_errcode(sock) == 0);
+ return SOCK_get_errcode(sock) == 0;
}
UWORD fType)
{
char *func = "SQLTransact";
-extern ConnectionClass *conns[];
+extern ConnectionClass **conns;
ConnectionClass *conn;
QResultClass *res;
char ok, *stmt_string;
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.1 1998/08/24 19:14:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.2 1998/09/01 03:29:03 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
HeapTuple procTup;
Form_pg_proc procStruct;
HeapTuple typeTup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
char *proc_source;
PLpgSQL_function *function;
PLpgSQL_var *var;
elog(ERROR, "cache lookup for return type %d failed",
procStruct->prorettype);
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid) {
function->fn_retistuple = true;
} else {
elog(ERROR, "cache lookup for argument type %d failed",
procStruct->proargtypes[i]);
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid) {
/* ----------
PLpgSQL_nsitem *nse;
char *cp;
HeapTuple typeTup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
char *typeXlated;
/* ----------
if (HeapTupleIsValid(typeTup)) {
PLpgSQL_type *typ;
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid) {
pfree(cp);
PLpgSQL_nsitem *nse;
char *cp;
HeapTuple typeTup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
char *typeXlated;
bool old_nsstate;
if (HeapTupleIsValid(typeTup)) {
PLpgSQL_type *typ;
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid) {
pfree(cp);
HeapTuple classtup;
Form_pg_class classStruct;
HeapTuple attrtup;
- AttributeTupleForm attrStruct;
+ Form_pg_attribute attrStruct;
HeapTuple typetup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
PLpgSQL_type *typ;
pfree(word1);
return T_ERROR;
}
- attrStruct = (AttributeTupleForm)GETSTRUCT(attrtup);
+ attrStruct = (Form_pg_attribute)GETSTRUCT(attrtup);
typetup = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(attrStruct->atttypid), 0, 0, 0);
* Found that - build a compiler type struct and return it
* ----------
*/
- typeStruct = (TypeTupleForm)GETSTRUCT(typetup);
+ typeStruct = (Form_pg_type)GETSTRUCT(typetup);
typ = (PLpgSQL_type *)malloc(sizeof(PLpgSQL_type));
HeapTuple classtup;
Form_pg_class classStruct;
HeapTuple typetup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
HeapTuple attrtup;
- AttributeTupleForm attrStruct;
+ Form_pg_attribute attrStruct;
char *word1;
char *cp;
int i;
elog(ERROR, "cache lookup for attribute %d of class %s failed",
i + 1, word1);
}
- attrStruct = (AttributeTupleForm)GETSTRUCT(attrtup);
+ attrStruct = (Form_pg_attribute)GETSTRUCT(attrtup);
typetup = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(attrStruct->atttypid), 0, 0, 0);
attrStruct->atttypid, word1,
nameout(&(attrStruct->attname)));
}
- typeStruct = (TypeTupleForm)GETSTRUCT(typetup);
+ typeStruct = (Form_pg_type)GETSTRUCT(typetup);
cp = strdup(nameout(&(attrStruct->attname)));
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.1 1998/08/24 19:14:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.2 1998/09/01 03:29:05 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
static int exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt)
{
HeapTuple typetup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
FmgrInfo finfo_output;
char *extval;
int pidx = 0;
if (!HeapTupleIsValid(typetup)) {
elog(ERROR, "cache lookup for type %d failed (1)", var->datatype->typoid);
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typetup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
extval = (char *)(*fmgr_faddr(&finfo_output))(var->value, &(var->isnull), var->datatype->atttypmod);
Oid atttype;
int4 atttypmod;
HeapTuple typetup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
FmgrInfo finfo_input;
switch (target->dtype) {
if (!HeapTupleIsValid(typetup)) {
elog(ERROR, "cache lookup for type %d failed", atttype);
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typetup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typinput, &finfo_input);
attisnull = *isNull;
*/
if (valtype != reqtype || reqtypmod > 0) {
HeapTuple typetup;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
FmgrInfo finfo_output;
char *extval;
if (!HeapTupleIsValid(typetup)) {
elog(ERROR, "cache lookup for type %d failed", valtype);
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typetup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
extval = (char *)(*fmgr_faddr(&finfo_output))(value, &isnull, -1);
* procedural language (PL)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.4 1998/08/19 02:04:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.5 1998/09/01 03:29:08 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
HeapTuple procTup;
HeapTuple typeTup;
Form_pg_proc procStruct;
- TypeTupleForm typeStruct;
+ Form_pg_type typeStruct;
Tcl_DString proc_internal_def;
Tcl_DString proc_internal_body;
char proc_internal_args[4096];
free(prodesc);
elog(ERROR, "pltcl: cache lookup for return type failed");
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid)
{
free(prodesc);
elog(ERROR, "pltcl: cache lookup for argument type failed");
}
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+ typeStruct = (Form_pg_type) GETSTRUCT(typeTup);
if (typeStruct->typrelid != InvalidOid)
{
ret_values[--i],
ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid));
}
- typinput = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typinput);
- typelem = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typelem);
+ typinput = (Oid) (((Form_pg_type) GETSTRUCT(typeTup))->typinput);
+ typelem = (Oid) (((Form_pg_type) GETSTRUCT(typeTup))->typelem);
/************************************************************
* Set the attribute to NOT NULL and convert the contents
if (!HeapTupleIsValid(typeTup))
elog(ERROR, "pltcl: Cache lookup of type %s failed", args[i]);
qdesc->argtypes[i] = typeTup->t_oid;
- fmgr_info(((TypeTupleForm) GETSTRUCT(typeTup))->typinput,
+ fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
&(qdesc->arginfuncs[i]));
- qdesc->argtypelems[i] = ((TypeTupleForm) GETSTRUCT(typeTup))->typelem;
+ qdesc->argtypelems[i] = ((Form_pg_type) GETSTRUCT(typeTup))->typelem;
qdesc->argvalues[i] = (Datum) NULL;
- qdesc->arglen[i] = (int) (((TypeTupleForm) GETSTRUCT(typeTup))->typlen);
+ qdesc->arglen[i] = (int) (((Form_pg_type) GETSTRUCT(typeTup))->typlen);
}
/************************************************************
attname, ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
}
- typoutput = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typoutput);
- typelem = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typelem);
+ typoutput = (Oid) (((Form_pg_type) GETSTRUCT(typeTup))->typoutput);
+ typelem = (Oid) (((Form_pg_type) GETSTRUCT(typeTup))->typelem);
/************************************************************
* If there is a value, set the variable
attname, ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
}
- typoutput = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typoutput);
- typelem = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typelem);
+ typoutput = (Oid) (((Form_pg_type) GETSTRUCT(typeTup))->typoutput);
+ typelem = (Oid) (((Form_pg_type) GETSTRUCT(typeTup))->typelem);
/************************************************************
* If there is a value, append the attribute name and the
/*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.27 1998/07/20 16:57:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.28 1998/09/01 03:29:11 momjian Exp $
*/
#include /* faked on sunos */
}
break;
}
- return (result);
+ return result;
}
/* this essentially does a cartesian product of the lsegs in the
pfree(tmp);
}
- return (min);
+ return min;
}
PATH *
sprintf(buf, "%c", RDELIM);
strcat(output, buf);
- return (path_in(output));
+ return path_in(output);
}
/* return the point where two paths intersect. Assumes that they do. */
#endif
retval = lseg_interpt(&seg1, &seg2);
- return (retval);
+ return retval;
}
long salary;
salary = (long) GetAttributeByName(tuple, "salary", &isnull);
- return (salary > 699);
+ return salary > 699;
}
/* New type "widget"
WIDGET *result;
if (str == NULL)
- return (NULL);
+ return NULL;
for (i = 0, p = str; *p && i < NARGS && *p != RDELIM; p++)
if (*p == ',' || (*p == LDELIM && !i))
coord[i++] = p + 1;
if (i < NARGS - 1)
- return (NULL);
+ return NULL;
result = (WIDGET *) palloc(sizeof(WIDGET));
result->center.x = atof(coord[0]);
result->center.y = atof(coord[1]);
sprintf(buf2, "widget_in: read (%f, %f, %f)\n", result->center.x,
result->center.y, result->radius);
- return (result);
+ return result;
}
char *
char *result;
if (widget == NULL)
- return (NULL);
+ return NULL;
result = (char *) palloc(60);
sprintf(result, "(%g,%g,%g)",
widget->center.x, widget->center.y, widget->radius);
- return (result);
+ return result;
}
int
{
extern double point_dt();
- return (point_dt(point, &widget->center) < widget->radius);
+ return point_dt(point, &widget->center) < widget->radius;
}
#define ABS(X) ((X) > 0 ? (X) : -(X))
width = ABS(box->high.x - box->low.x);
height = ABS(box->high.y - box->low.y);
- return (width * height);
+ return width * height;
}
char *
if (!(new_string = palloc(NAMEDATALEN)))
{
fprintf(stderr, "reverse_name: palloc failed\n");
- return (NULL);
+ return NULL;
}
MemSet(new_string, 0, NAMEDATALEN);
for (i = 0; i < NAMEDATALEN && string[i]; ++i)
len = i;
for (; i >= 0; --i)
new_string[len - i] = string[i];
- return (new_string);
+ return new_string;
}
#include "executor/spi.h" /* this is what you need to work with SPI */
if (*level == 17)
{
*recursion = false;
- return (tuple);
+ return tuple;
}
if (!(*recursion))
- return (tuple);
+ return tuple;
(*level)++;
if (*level == 0)
*xid = InvalidTransactionId;
- return (tuple);
+ return tuple;
}
HeapTuple ttdummy(void);
if (ttoff) /* OFF - nothing to do */
{
pfree(relname);
- return ((newtuple != NULL) ? newtuple : trigtuple);
+ return (newtuple != NULL) ? newtuple : trigtuple;
}
trigger = CurrentTriggerData->tg_trigger;
if (newoff != TTDUMMY_INFINITY)
{
pfree(relname); /* allocated in upper executor context */
- return (NULL);
+ return NULL;
}
}
else if (oldoff != TTDUMMY_INFINITY) /* DELETE */
{
pfree(relname);
- return (NULL);
+ return NULL;
}
{
pfree(relname);
- return (rettuple);
+ return rettuple;
}
int32
if (ttoff) /* OFF currently */
{
if (on == 0)
- return (0);
+ return 0;
/* turn ON */
ttoff = false;
- return (0);
+ return 0;
}
/* ON currently */
if (on != 0)
- return (1);
+ return 1;
/* turn OFF */
ttoff = true;
- return (1);
+ return 1;
}
result = (Complex *) palloc(sizeof(Complex));
result->x = x;
result->y = y;
- return (result);
+ return result;
}
/*
char *result;
if (complex == NULL)
- return (NULL);
+ return NULL;
result = (char *) palloc(60);
sprintf(result, "(%g,%g)", complex->x, complex->y);
- return (result);
+ return result;
}
/*****************************************************************************
result = (Complex *) palloc(sizeof(Complex));
result->x = a->x + b->x;
result->y = a->y + b->y;
- return (result);
+ return result;
}
double amag = Mag(a),
bmag = Mag(b);
- return (amag < bmag);
+ return amag < bmag;
}
bool
double amag = Mag(a),
bmag = Mag(b);
- return (amag <= bmag);
+ return amag <= bmag;
}
bool
double amag = Mag(a),
bmag = Mag(b);
- return (amag == bmag);
+ return amag == bmag;
}
bool
double amag = Mag(a),
bmag = Mag(b);
- return (amag >= bmag);
+ return amag >= bmag;
}
bool
double amag = Mag(a),
bmag = Mag(b);
- return (amag > bmag);
+ return amag > bmag;
}
int4
int
add_one(int arg)
{
- return (arg + 1);
+ return arg + 1;
}
char16 *
(void *) VARDATA(t), /* source */
VARSIZE(t) - VARHDRSZ); /* how many bytes */
- return (new_t);
+ return new_t;
}
bool
salary = (int4) GetAttributeByName(t, "salary", &isnull);
if (isnull)
- return (false);
- return (salary > limit);
+ return false;
+ return salary > limit;
}
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
- return (-1);
+ return -1;
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
- return (-1);
+ return -1;
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
* assume it means -1.
*/
if (optopt == (int)'-')
- return (-1);
+ return -1;
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
"%s: illegal option -- %c\n", __progname, optopt);
- return (BADCH);
+ return BADCH;
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (*ostr == ':')
- return (BADARG);
+ return BADARG;
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
__progname, optopt);
- return (BADCH);
+ return BADCH;
}
else /* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
- return (optopt); /* dump back option letter */
+ return optopt; /* dump back option letter */
}