mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-30 15:51:24 +02:00
Silence compiler warnings, fix error in complex compare function.
This commit is contained in:
parent
227015b08e
commit
7bfb924aea
@ -1,3 +1,9 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
This file contains routines that can be bound to a Postgres backend and
|
||||||
|
called by the backend in the process of processing queries. The calling
|
||||||
|
format for these routines is dictated by Postgres architecture.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
/* do not include libpq-fe.h for backend-loaded functions*/
|
/* do not include libpq-fe.h for backend-loaded functions*/
|
||||||
/* #include "libpq-fe.h" */
|
/* #include "libpq-fe.h" */
|
||||||
@ -11,6 +17,20 @@ typedef struct Complex {
|
|||||||
double y;
|
double y;
|
||||||
} Complex;
|
} 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);
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Input/Output functions
|
* Input/Output functions
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -48,7 +68,7 @@ complex_out(Complex *complex)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
result = (char *) palloc(60);
|
result = (char *) palloc(60);
|
||||||
sprintf(result, "(%lg,%lg)", complex->x, complex->y);
|
sprintf(result, "(%g,%g)", complex->x, complex->y);
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,6 +151,7 @@ complex_abs_cmp(Complex *a, Complex *b)
|
|||||||
* POSTGRES crashing, it is impossible to tell whether the bug is in your
|
* POSTGRES crashing, it is impossible to tell whether the bug is in your
|
||||||
* code or POSTGRES's.
|
* code or POSTGRES's.
|
||||||
*/
|
*/
|
||||||
|
void test_main(void);
|
||||||
void
|
void
|
||||||
test_main()
|
test_main()
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,29 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
These are user-defined functions that can be bound to a Postgres backend
|
||||||
|
and called by Postgres to execute SQL functions of the same name.
|
||||||
|
|
||||||
|
The calling format for these functions is defined by the CREATE FUNCTION
|
||||||
|
SQL statement that binds them to the backend.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "postgres.h" /* for char16, etc. */
|
#include "postgres.h" /* for char16, etc. */
|
||||||
#include "utils/palloc.h" /* for palloc */
|
#include "utils/palloc.h" /* for palloc */
|
||||||
#include "libpq-fe.h" /* for TUPLE */
|
#include "libpq-fe.h" /* for TUPLE */
|
||||||
|
#include "executor/executor.h" /* for GetAttributeByName() */
|
||||||
|
|
||||||
|
/* The following prototypes declare what we assume the user declares to
|
||||||
|
Postgres in his CREATE FUNCTION statement.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
add_one(int arg)
|
add_one(int arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user