mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
This commit is contained in:
@ -16,22 +16,22 @@ exit_nicely(PGconn * conn)
|
||||
|
||||
main()
|
||||
{
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
|
||||
#ifdef DEBUG
|
||||
FILE *debug;
|
||||
FILE *debug;
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
|
||||
/*
|
||||
* begin, by setting the parameters for a backend connection if the
|
||||
|
@ -30,18 +30,18 @@ exit_nicely(PGconn * conn)
|
||||
|
||||
main()
|
||||
{
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
PGnotify *notify;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
PGnotify *notify;
|
||||
|
||||
/*
|
||||
* begin, by setting the parameters for a backend connection if the
|
||||
|
@ -39,20 +39,20 @@ exit_nicely(PGconn * conn)
|
||||
|
||||
main()
|
||||
{
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
int i_fnum,
|
||||
d_fnum,
|
||||
p_fnum;
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
int i_fnum,
|
||||
d_fnum,
|
||||
p_fnum;
|
||||
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
|
||||
/*
|
||||
* begin, by setting the parameters for a backend connection if the
|
||||
@ -132,10 +132,10 @@ main()
|
||||
}
|
||||
for (i = 0; i < PQntuples(res); i++)
|
||||
{
|
||||
int *ival;
|
||||
float *dval;
|
||||
int plen;
|
||||
POLYGON *pval;
|
||||
int *ival;
|
||||
float *dval;
|
||||
int plen;
|
||||
POLYGON *pval;
|
||||
|
||||
/* we hard-wire this to the 3 fields we know about */
|
||||
ival = (int *) PQgetvalue(res, i, i_fnum);
|
||||
|
@ -32,21 +32,21 @@ check_conn(PGconn * conn)
|
||||
|
||||
main()
|
||||
{
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName1,
|
||||
dbName2;
|
||||
char *tblName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
char *pghost,
|
||||
*pgport,
|
||||
*pgoptions,
|
||||
*pgtty;
|
||||
char *dbName1,
|
||||
dbName2;
|
||||
char *tblName;
|
||||
int nFields;
|
||||
int i,
|
||||
j;
|
||||
|
||||
PGconn *conn1,
|
||||
conn2;
|
||||
PGresult *res1,
|
||||
res2;
|
||||
PGconn *conn1,
|
||||
conn2;
|
||||
PGresult *res1,
|
||||
res2;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.4 1997/09/07 05:04:04 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/test/examples/testlo.c,v 1.5 1997/09/08 02:40:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -31,12 +31,12 @@
|
||||
Oid
|
||||
importFile(PGconn * conn, char *filename)
|
||||
{
|
||||
Oid lobjId;
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
Oid lobjId;
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* open the file to be read in
|
||||
@ -79,10 +79,10 @@ importFile(PGconn * conn, char *filename)
|
||||
void
|
||||
pickout(PGconn * conn, Oid lobjId, int start, int len)
|
||||
{
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nread;
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nread;
|
||||
|
||||
lobj_fd = lo_open(conn, lobjId, INV_READ);
|
||||
if (lobj_fd < 0)
|
||||
@ -109,11 +109,11 @@ pickout(PGconn * conn, Oid lobjId, int start, int len)
|
||||
void
|
||||
overwrite(PGconn * conn, Oid lobjId, int start, int len)
|
||||
{
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nwritten;
|
||||
int i;
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nwritten;
|
||||
int i;
|
||||
|
||||
lobj_fd = lo_open(conn, lobjId, INV_READ);
|
||||
if (lobj_fd < 0)
|
||||
@ -148,11 +148,11 @@ overwrite(PGconn * conn, Oid lobjId, int start, int len)
|
||||
void
|
||||
exportFile(PGconn * conn, Oid lobjId, char *filename)
|
||||
{
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* create an inversion "object"
|
||||
@ -203,12 +203,12 @@ exit_nicely(PGconn * conn)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *in_filename,
|
||||
*out_filename;
|
||||
char *database;
|
||||
Oid lobjOid;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
char *in_filename,
|
||||
*out_filename;
|
||||
char *database;
|
||||
Oid lobjOid;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/test/examples/Attic/testlo2.c,v 1.3 1997/09/07 05:04:08 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/test/examples/Attic/testlo2.c,v 1.4 1997/09/08 02:40:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -25,12 +25,12 @@
|
||||
Oid
|
||||
importFile(PGconn * conn, char *filename)
|
||||
{
|
||||
Oid lobjId;
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
Oid lobjId;
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* open the file to be read in
|
||||
@ -73,10 +73,10 @@ importFile(PGconn * conn, char *filename)
|
||||
void
|
||||
pickout(PGconn * conn, Oid lobjId, int start, int len)
|
||||
{
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nread;
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nread;
|
||||
|
||||
lobj_fd = lo_open(conn, lobjId, INV_READ);
|
||||
if (lobj_fd < 0)
|
||||
@ -103,11 +103,11 @@ pickout(PGconn * conn, Oid lobjId, int start, int len)
|
||||
void
|
||||
overwrite(PGconn * conn, Oid lobjId, int start, int len)
|
||||
{
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nwritten;
|
||||
int i;
|
||||
int lobj_fd;
|
||||
char *buf;
|
||||
int nbytes;
|
||||
int nwritten;
|
||||
int i;
|
||||
|
||||
lobj_fd = lo_open(conn, lobjId, INV_READ);
|
||||
if (lobj_fd < 0)
|
||||
@ -142,11 +142,11 @@ overwrite(PGconn * conn, Oid lobjId, int start, int len)
|
||||
void
|
||||
exportFile(PGconn * conn, Oid lobjId, char *filename)
|
||||
{
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
int lobj_fd;
|
||||
char buf[BUFSIZE];
|
||||
int nbytes,
|
||||
tmp;
|
||||
int fd;
|
||||
|
||||
/*
|
||||
* create an inversion "object"
|
||||
@ -197,12 +197,12 @@ exit_nicely(PGconn * conn)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *in_filename,
|
||||
*out_filename;
|
||||
char *database;
|
||||
Oid lobjOid;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
char *in_filename,
|
||||
*out_filename;
|
||||
char *database;
|
||||
Oid lobjOid;
|
||||
PGconn *conn;
|
||||
PGresult *res;
|
||||
|
||||
if (argc != 4)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.10 1997/09/07 05:04:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.11 1997/09/08 02:40:56 momjian Exp $
|
||||
*/
|
||||
|
||||
#include <float.h> /* faked on sunos */
|
||||
@ -16,74 +16,74 @@
|
||||
#define RDELIM ')'
|
||||
#define DELIM ','
|
||||
|
||||
typedef void *TUPLE;
|
||||
typedef void *TUPLE;
|
||||
|
||||
extern double *regress_dist_ptpath(Point * pt, PATH * path);
|
||||
extern double *regress_path_dist(PATH * p1, PATH * p2);
|
||||
extern PATH *poly2path(POLYGON * poly);
|
||||
extern Point *interpt_pp(PATH * p1, PATH * p2);
|
||||
extern void regress_lseg_construct(LSEG * lseg, Point * pt1, Point * pt2);
|
||||
extern char overpaid(TUPLE tuple);
|
||||
extern int boxarea(BOX * box);
|
||||
extern char *reverse_c16(char *string);
|
||||
extern double *regress_dist_ptpath(Point * pt, PATH * path);
|
||||
extern double *regress_path_dist(PATH * p1, PATH * p2);
|
||||
extern PATH *poly2path(POLYGON * poly);
|
||||
extern Point *interpt_pp(PATH * p1, PATH * p2);
|
||||
extern void regress_lseg_construct(LSEG * lseg, Point * pt1, Point * pt2);
|
||||
extern char overpaid(TUPLE tuple);
|
||||
extern int boxarea(BOX * box);
|
||||
extern char *reverse_c16(char *string);
|
||||
|
||||
/*
|
||||
** Distance from a point to a path
|
||||
*/
|
||||
double *
|
||||
double *
|
||||
regress_dist_ptpath(pt, path)
|
||||
Point *pt;
|
||||
PATH *path;
|
||||
Point *pt;
|
||||
PATH *path;
|
||||
{
|
||||
double *result;
|
||||
double *tmp;
|
||||
int i;
|
||||
LSEG lseg;
|
||||
double *result;
|
||||
double *tmp;
|
||||
int i;
|
||||
LSEG lseg;
|
||||
|
||||
switch (path->npts)
|
||||
{
|
||||
case 0:
|
||||
result = PALLOCTYPE(double);
|
||||
*result = Abs((double) DBL_MAX); /* +infinity */
|
||||
break;
|
||||
case 1:
|
||||
result = point_distance(pt, &path->p[0]);
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
result = PALLOCTYPE(double);
|
||||
*result = Abs((double) DBL_MAX); /* +infinity */
|
||||
break;
|
||||
case 1:
|
||||
result = point_distance(pt, &path->p[0]);
|
||||
break;
|
||||
default:
|
||||
|
||||
/*
|
||||
* the distance from a point to a path is the smallest distance
|
||||
* from the point to any of its constituent segments.
|
||||
*/
|
||||
Assert(path->npts > 1);
|
||||
result = PALLOCTYPE(double);
|
||||
for (i = 0; i < path->npts - 1; ++i)
|
||||
{
|
||||
regress_lseg_construct(&lseg, &path->p[i], &path->p[i + 1]);
|
||||
tmp = dist_ps(pt, &lseg);
|
||||
if (i == 0 || *tmp < *result)
|
||||
*result = *tmp;
|
||||
PFREE(tmp);
|
||||
/*
|
||||
* the distance from a point to a path is the smallest
|
||||
* distance from the point to any of its constituent segments.
|
||||
*/
|
||||
Assert(path->npts > 1);
|
||||
result = PALLOCTYPE(double);
|
||||
for (i = 0; i < path->npts - 1; ++i)
|
||||
{
|
||||
regress_lseg_construct(&lseg, &path->p[i], &path->p[i + 1]);
|
||||
tmp = dist_ps(pt, &lseg);
|
||||
if (i == 0 || *tmp < *result)
|
||||
*result = *tmp;
|
||||
PFREE(tmp);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* this essentially does a cartesian product of the lsegs in the
|
||||
two paths, and finds the min distance between any two lsegs */
|
||||
double *
|
||||
double *
|
||||
regress_path_dist(p1, p2)
|
||||
PATH *p1;
|
||||
PATH *p2;
|
||||
PATH *p1;
|
||||
PATH *p2;
|
||||
{
|
||||
double *min,
|
||||
*tmp;
|
||||
int i,
|
||||
j;
|
||||
LSEG seg1,
|
||||
seg2;
|
||||
double *min,
|
||||
*tmp;
|
||||
int i,
|
||||
j;
|
||||
LSEG seg1,
|
||||
seg2;
|
||||
|
||||
regress_lseg_construct(&seg1, &p1->p[0], &p1->p[1]);
|
||||
regress_lseg_construct(&seg2, &p2->p[0], &p2->p[1]);
|
||||
@ -103,13 +103,13 @@ PATH *p2;
|
||||
return (min);
|
||||
}
|
||||
|
||||
PATH *
|
||||
PATH *
|
||||
poly2path(poly)
|
||||
POLYGON *poly;
|
||||
POLYGON *poly;
|
||||
{
|
||||
int i;
|
||||
char *output = (char *) PALLOC(2 * (P_MAXDIG + 1) * poly->npts + 64);
|
||||
char buf[2 * (P_MAXDIG) + 20];
|
||||
int i;
|
||||
char *output = (char *) PALLOC(2 * (P_MAXDIG + 1) * poly->npts + 64);
|
||||
char buf[2 * (P_MAXDIG) + 20];
|
||||
|
||||
sprintf(output, "(1, %*d", P_MAXDIG, poly->npts);
|
||||
|
||||
@ -125,23 +125,23 @@ POLYGON *poly;
|
||||
}
|
||||
|
||||
/* return the point where two paths intersect. Assumes that they do. */
|
||||
Point *
|
||||
Point *
|
||||
interpt_pp(p1, p2)
|
||||
PATH *p1;
|
||||
PATH *p2;
|
||||
PATH *p1;
|
||||
PATH *p2;
|
||||
{
|
||||
|
||||
Point *retval;
|
||||
int i,
|
||||
j;
|
||||
LSEG seg1,
|
||||
seg2;
|
||||
Point *retval;
|
||||
int i,
|
||||
j;
|
||||
LSEG seg1,
|
||||
seg2;
|
||||
|
||||
#if FALSE
|
||||
LINE *ln;
|
||||
LINE *ln;
|
||||
|
||||
#endif
|
||||
bool found; /* We've found the intersection */
|
||||
bool found; /* We've found the intersection */
|
||||
|
||||
found = false; /* Haven't found it yet */
|
||||
|
||||
@ -167,9 +167,9 @@ PATH *p2;
|
||||
/* like lseg_construct, but assume space already allocated */
|
||||
void
|
||||
regress_lseg_construct(lseg, pt1, pt2)
|
||||
LSEG *lseg;
|
||||
Point *pt1;
|
||||
Point *pt2;
|
||||
LSEG *lseg;
|
||||
Point *pt1;
|
||||
Point *pt2;
|
||||
{
|
||||
lseg->p[0].x = pt1->x;
|
||||
lseg->p[0].y = pt1->y;
|
||||
@ -181,10 +181,10 @@ Point *pt2;
|
||||
|
||||
char
|
||||
overpaid(tuple)
|
||||
TUPLE tuple;
|
||||
TUPLE tuple;
|
||||
{
|
||||
bool isnull;
|
||||
long salary;
|
||||
bool isnull;
|
||||
long salary;
|
||||
|
||||
salary = (long) GetAttributeByName(tuple, "salary", &isnull);
|
||||
return (salary > 699);
|
||||
@ -197,25 +197,25 @@ TUPLE tuple;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Point center;
|
||||
double radius;
|
||||
} WIDGET;
|
||||
Point center;
|
||||
double radius;
|
||||
} WIDGET;
|
||||
|
||||
WIDGET *widget_in(char *str);
|
||||
char *widget_out(WIDGET * widget);
|
||||
int pt_in_widget(Point * point, WIDGET * widget);
|
||||
WIDGET *widget_in(char *str);
|
||||
char *widget_out(WIDGET * widget);
|
||||
int pt_in_widget(Point * point, WIDGET * widget);
|
||||
|
||||
#define NARGS 3
|
||||
|
||||
WIDGET *
|
||||
WIDGET *
|
||||
widget_in(str)
|
||||
char *str;
|
||||
char *str;
|
||||
{
|
||||
char *p,
|
||||
*coord[NARGS],
|
||||
buf2[1000];
|
||||
int i;
|
||||
WIDGET *result;
|
||||
char *p,
|
||||
*coord[NARGS],
|
||||
buf2[1000];
|
||||
int i;
|
||||
WIDGET *result;
|
||||
|
||||
if (str == NULL)
|
||||
return (NULL);
|
||||
@ -234,11 +234,11 @@ char *str;
|
||||
return (result);
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
widget_out(widget)
|
||||
WIDGET *widget;
|
||||
WIDGET *widget;
|
||||
{
|
||||
char *result;
|
||||
char *result;
|
||||
|
||||
if (widget == NULL)
|
||||
return (NULL);
|
||||
@ -251,10 +251,10 @@ WIDGET *widget;
|
||||
|
||||
int
|
||||
pt_in_widget(point, widget)
|
||||
Point *point;
|
||||
WIDGET *widget;
|
||||
Point *point;
|
||||
WIDGET *widget;
|
||||
{
|
||||
extern double point_dt();
|
||||
extern double point_dt();
|
||||
|
||||
return (point_dt(point, &widget->center) < widget->radius);
|
||||
}
|
||||
@ -264,24 +264,24 @@ WIDGET *widget;
|
||||
int
|
||||
boxarea(box)
|
||||
|
||||
BOX *box;
|
||||
BOX *box;
|
||||
|
||||
{
|
||||
int width,
|
||||
height;
|
||||
int width,
|
||||
height;
|
||||
|
||||
width = ABS(box->high.x - box->low.x);
|
||||
height = ABS(box->high.y - box->low.y);
|
||||
return (width * height);
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
reverse_c16(string)
|
||||
char *string;
|
||||
char *string;
|
||||
{
|
||||
register i;
|
||||
int len;
|
||||
char *new_string;
|
||||
register i;
|
||||
int len;
|
||||
char *new_string;
|
||||
|
||||
if (!(new_string = palloc(16)))
|
||||
{
|
||||
|
Reference in New Issue
Block a user