mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
This commit is contained in:
@ -7,15 +7,15 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/tutorial/C-code/Attic/beard.c,v 1.2 1997/09/07 05:04:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/tutorial/C-code/Attic/beard.c,v 1.3 1997/09/08 02:41:09 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef struct ImageHdr
|
||||
{
|
||||
int size;
|
||||
} ImageHdr;
|
||||
int size;
|
||||
} ImageHdr;
|
||||
|
||||
#define BUFSIZE 10
|
||||
|
||||
@ -26,12 +26,12 @@ typedef struct ImageHdr
|
||||
Oid
|
||||
beard(Oid picture)
|
||||
{
|
||||
Oid beard;
|
||||
int pic_fd,
|
||||
beard_fd;
|
||||
ImageHdr ihdr;
|
||||
char buf[BUFSIZE];
|
||||
int cc;
|
||||
Oid beard;
|
||||
int pic_fd,
|
||||
beard_fd;
|
||||
ImageHdr ihdr;
|
||||
char buf[BUFSIZE];
|
||||
int cc;
|
||||
|
||||
if ((pic_fd = lo_open(picture, INV_READ)) == -1)
|
||||
elog(WARN, "Cannot access picture large object");
|
||||
|
@ -14,34 +14,34 @@
|
||||
|
||||
typedef struct Complex
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
} Complex;
|
||||
double x;
|
||||
double y;
|
||||
} Complex;
|
||||
|
||||
/* These prototypes declare the requirements that Postgres places on these
|
||||
user written functions.
|
||||
*/
|
||||
Complex *complex_in(char *str);
|
||||
char *complex_out(Complex * complex);
|
||||
Complex *complex_add(Complex * a, Complex * b);
|
||||
bool complex_abs_lt(Complex * a, Complex * b);
|
||||
bool complex_abs_le(Complex * a, Complex * b);
|
||||
bool complex_abs_eq(Complex * a, Complex * b);
|
||||
bool complex_abs_ge(Complex * a, Complex * b);
|
||||
bool complex_abs_gt(Complex * a, Complex * b);
|
||||
int4 complex_abs_cmp(Complex * a, Complex * b);
|
||||
Complex *complex_in(char *str);
|
||||
char *complex_out(Complex * complex);
|
||||
Complex *complex_add(Complex * a, Complex * b);
|
||||
bool complex_abs_lt(Complex * a, Complex * b);
|
||||
bool complex_abs_le(Complex * a, Complex * b);
|
||||
bool complex_abs_eq(Complex * a, Complex * b);
|
||||
bool complex_abs_ge(Complex * a, Complex * b);
|
||||
bool complex_abs_gt(Complex * a, Complex * b);
|
||||
int4 complex_abs_cmp(Complex * a, Complex * b);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Input/Output functions
|
||||
*****************************************************************************/
|
||||
|
||||
Complex *
|
||||
Complex *
|
||||
complex_in(char *str)
|
||||
{
|
||||
double x,
|
||||
y;
|
||||
Complex *result;
|
||||
double x,
|
||||
y;
|
||||
Complex *result;
|
||||
|
||||
if (sscanf(str, " ( %lf , %lf )", &x, &y) != 2)
|
||||
{
|
||||
@ -62,10 +62,10 @@ complex_in(char *str)
|
||||
* pointer. POSTGRES thinks all output functions are:
|
||||
* char *out_func(char *);
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
complex_out(Complex * complex)
|
||||
{
|
||||
char *result;
|
||||
char *result;
|
||||
|
||||
if (complex == NULL)
|
||||
return (NULL);
|
||||
@ -79,10 +79,10 @@ complex_out(Complex * complex)
|
||||
* New Operators
|
||||
*****************************************************************************/
|
||||
|
||||
Complex *
|
||||
Complex *
|
||||
complex_add(Complex * a, Complex * b)
|
||||
{
|
||||
Complex *result;
|
||||
Complex *result;
|
||||
|
||||
result = (Complex *) palloc(sizeof(Complex));
|
||||
result->x = a->x + b->x;
|
||||
@ -100,8 +100,8 @@ complex_add(Complex * a, Complex * b)
|
||||
bool
|
||||
complex_abs_lt(Complex * a, Complex * b)
|
||||
{
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
|
||||
return (amag < bmag);
|
||||
}
|
||||
@ -109,8 +109,8 @@ complex_abs_lt(Complex * a, Complex * b)
|
||||
bool
|
||||
complex_abs_le(Complex * a, Complex * b)
|
||||
{
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
|
||||
return (amag <= bmag);
|
||||
}
|
||||
@ -118,8 +118,8 @@ complex_abs_le(Complex * a, Complex * b)
|
||||
bool
|
||||
complex_abs_eq(Complex * a, Complex * b)
|
||||
{
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
|
||||
return (amag == bmag);
|
||||
}
|
||||
@ -127,8 +127,8 @@ complex_abs_eq(Complex * a, Complex * b)
|
||||
bool
|
||||
complex_abs_ge(Complex * a, Complex * b)
|
||||
{
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
|
||||
return (amag >= bmag);
|
||||
}
|
||||
@ -136,8 +136,8 @@ complex_abs_ge(Complex * a, Complex * b)
|
||||
bool
|
||||
complex_abs_gt(Complex * a, Complex * b)
|
||||
{
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
|
||||
return (amag > bmag);
|
||||
}
|
||||
@ -145,8 +145,8 @@ complex_abs_gt(Complex * a, Complex * b)
|
||||
int4
|
||||
complex_abs_cmp(Complex * a, Complex * b)
|
||||
{
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
double amag = Mag(a),
|
||||
bmag = Mag(b);
|
||||
|
||||
if (amag < bmag)
|
||||
return -1;
|
||||
@ -166,12 +166,12 @@ complex_abs_cmp(Complex * a, Complex * b)
|
||||
* POSTGRES crashing, it is impossible to tell whether the bug is in your
|
||||
* code or POSTGRES's.
|
||||
*/
|
||||
void test_main(void);
|
||||
void test_main(void);
|
||||
void
|
||||
test_main()
|
||||
{
|
||||
Complex *a;
|
||||
Complex *b;
|
||||
Complex *a;
|
||||
Complex *b;
|
||||
|
||||
a = complex_in("(4.01, 3.77 )");
|
||||
printf("a = %s\n", complex_out(a));
|
||||
|
@ -17,9 +17,10 @@
|
||||
Postgres in his CREATE FUNCTION statement.
|
||||
*/
|
||||
|
||||
int add_one(int arg);
|
||||
char16 *concat16(char16 * arg1, char16 * arg2);
|
||||
text *copytext(text * t);
|
||||
int add_one(int arg);
|
||||
char16 *concat16(char16 * arg1, char16 * arg2);
|
||||
text *copytext(text * t);
|
||||
|
||||
bool
|
||||
c_overpaid(TUPLE t, /* the current instance of EMP */
|
||||
int4 limit);
|
||||
@ -32,24 +33,24 @@ add_one(int arg)
|
||||
return (arg + 1);
|
||||
}
|
||||
|
||||
char16 *
|
||||
char16 *
|
||||
concat16(char16 * arg1, char16 * arg2)
|
||||
{
|
||||
char16 *new_c16 = (char16 *) palloc(sizeof(char16));
|
||||
char16 *new_c16 = (char16 *) palloc(sizeof(char16));
|
||||
|
||||
memset(new_c16, 0, sizeof(char16));
|
||||
strncpy((char *) new_c16, (char *) arg1, 16);
|
||||
return (char16 *) (strncat((char *) new_c16, (char *) arg2, 16));
|
||||
}
|
||||
|
||||
text *
|
||||
text *
|
||||
copytext(text * t)
|
||||
{
|
||||
|
||||
/*
|
||||
* VARSIZE is the total size of the struct in bytes.
|
||||
*/
|
||||
text *new_t = (text *) palloc(VARSIZE(t));
|
||||
text *new_t = (text *) palloc(VARSIZE(t));
|
||||
|
||||
memset(new_t, 0, VARSIZE(t));
|
||||
|
||||
@ -69,8 +70,8 @@ bool
|
||||
c_overpaid(TUPLE t, /* the current instance of EMP */
|
||||
int4 limit)
|
||||
{
|
||||
bool isnull = false;
|
||||
int4 salary;
|
||||
bool isnull = false;
|
||||
int4 salary;
|
||||
|
||||
salary = (int4) GetAttributeByName(t, "salary", &isnull);
|
||||
|
||||
|
Reference in New Issue
Block a user