aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/postgres_ext.h5
-rw-r--r--src/interfaces/libpq/fe-lobj.c30
-rw-r--r--src/interfaces/libpq/libpq-fe.h12
-rw-r--r--src/test/examples/testlo64.c7
4 files changed, 27 insertions, 27 deletions
diff --git a/src/include/postgres_ext.h b/src/include/postgres_ext.h
index 9f2e3c52972..bf45c50dcf3 100644
--- a/src/include/postgres_ext.h
+++ b/src/include/postgres_ext.h
@@ -24,8 +24,6 @@
#ifndef POSTGRES_EXT_H
#define POSTGRES_EXT_H
-#include <stdint.h>
-
/*
* Object ID is a fundamental type in Postgres.
*/
@@ -44,9 +42,6 @@ typedef unsigned int Oid;
/* the above needs <stdlib.h> */
-/* Define a signed 64-bit integer type for use in client API declarations. */
-typedef int64_t pg_int64;
-
/*
* Identifiers of error message fields. Kept here to keep common
* between frontend and backend, and also to export them to libpq
diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c
index 04b3aef8854..05e17bed508 100644
--- a/src/interfaces/libpq/fe-lobj.c
+++ b/src/interfaces/libpq/fe-lobj.c
@@ -43,8 +43,8 @@
static int lo_initialize(PGconn *conn);
static Oid lo_import_internal(PGconn *conn, const char *filename, Oid oid);
-static pg_int64 lo_hton64(pg_int64 host64);
-static pg_int64 lo_ntoh64(pg_int64 net64);
+static int64_t lo_hton64(int64_t host64);
+static int64_t lo_ntoh64(int64_t net64);
/*
* lo_open
@@ -192,7 +192,7 @@ lo_truncate(PGconn *conn, int fd, size_t len)
* returns -1 upon failure
*/
int
-lo_truncate64(PGconn *conn, int fd, pg_int64 len)
+lo_truncate64(PGconn *conn, int fd, int64_t len)
{
PQArgBlock argv[2];
PGresult *res;
@@ -381,12 +381,12 @@ lo_lseek(PGconn *conn, int fd, int offset, int whence)
* lo_lseek64
* change the current read or write location on a large object
*/
-pg_int64
-lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence)
+int64_t
+lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence)
{
PQArgBlock argv[3];
PGresult *res;
- pg_int64 retval;
+ int64 retval;
int result_len;
if (lo_initialize(conn) < 0)
@@ -544,10 +544,10 @@ lo_tell(PGconn *conn, int fd)
* lo_tell64
* returns the current seek location of the large object
*/
-pg_int64
+int64_t
lo_tell64(PGconn *conn, int fd)
{
- pg_int64 retval;
+ int64 retval;
PQArgBlock argv[1];
PGresult *res;
int result_len;
@@ -1019,12 +1019,12 @@ lo_initialize(PGconn *conn)
* lo_hton64
* converts a 64-bit integer from host byte order to network byte order
*/
-static pg_int64
-lo_hton64(pg_int64 host64)
+static int64_t
+lo_hton64(int64_t host64)
{
union
{
- pg_int64 i64;
+ int64 i64;
uint32 i32[2];
} swap;
uint32 t;
@@ -1044,15 +1044,15 @@ lo_hton64(pg_int64 host64)
* lo_ntoh64
* converts a 64-bit integer from network byte order to host byte order
*/
-static pg_int64
-lo_ntoh64(pg_int64 net64)
+static int64_t
+lo_ntoh64(int64_t net64)
{
union
{
- pg_int64 i64;
+ int64 i64;
uint32 i32[2];
} swap;
- pg_int64 result;
+ int64 result;
swap.i64 = net64;
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index 34ddfdb1831..7d3a9df6fd5 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -20,6 +20,7 @@ extern "C"
{
#endif
+#include <stdint.h>
#include <stdio.h>
/*
@@ -233,8 +234,11 @@ typedef struct pgNotify
struct pgNotify *next; /* list link */
} PGnotify;
+/* deprecated name for int64_t */
+typedef int64_t pg_int64;
+
/* pg_usec_time_t is like time_t, but with microsecond resolution */
-typedef pg_int64 pg_usec_time_t;
+typedef int64_t pg_usec_time_t;
/* Function types for notice-handling callbacks */
typedef void (*PQnoticeReceiver) (void *arg, const PGresult *res);
@@ -691,13 +695,13 @@ extern int lo_close(PGconn *conn, int fd);
extern int lo_read(PGconn *conn, int fd, char *buf, size_t len);
extern int lo_write(PGconn *conn, int fd, const char *buf, size_t len);
extern int lo_lseek(PGconn *conn, int fd, int offset, int whence);
-extern pg_int64 lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence);
+extern int64_t lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence);
extern Oid lo_creat(PGconn *conn, int mode);
extern Oid lo_create(PGconn *conn, Oid lobjId);
extern int lo_tell(PGconn *conn, int fd);
-extern pg_int64 lo_tell64(PGconn *conn, int fd);
+extern int64_t lo_tell64(PGconn *conn, int fd);
extern int lo_truncate(PGconn *conn, int fd, size_t len);
-extern int lo_truncate64(PGconn *conn, int fd, pg_int64 len);
+extern int lo_truncate64(PGconn *conn, int fd, int64_t len);
extern int lo_unlink(PGconn *conn, Oid lobjId);
extern Oid lo_import(PGconn *conn, const char *filename);
extern Oid lo_import_with_oid(PGconn *conn, const char *filename, Oid lobjId);
diff --git a/src/test/examples/testlo64.c b/src/test/examples/testlo64.c
index 66c9abe1a99..c303db92e5b 100644
--- a/src/test/examples/testlo64.c
+++ b/src/test/examples/testlo64.c
@@ -12,6 +12,7 @@
*
*-------------------------------------------------------------------------
*/
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -75,7 +76,7 @@ importFile(PGconn *conn, char *filename)
}
static void
-pickout(PGconn *conn, Oid lobjId, pg_int64 start, int len)
+pickout(PGconn *conn, Oid lobjId, int64_t start, int len)
{
int lobj_fd;
char *buf;
@@ -110,7 +111,7 @@ pickout(PGconn *conn, Oid lobjId, pg_int64 start, int len)
}
static void
-overwrite(PGconn *conn, Oid lobjId, pg_int64 start, int len)
+overwrite(PGconn *conn, Oid lobjId, int64_t start, int len)
{
int lobj_fd;
char *buf;
@@ -148,7 +149,7 @@ overwrite(PGconn *conn, Oid lobjId, pg_int64 start, int len)
}
static void
-my_truncate(PGconn *conn, Oid lobjId, pg_int64 len)
+my_truncate(PGconn *conn, Oid lobjId, int64_t len)
{
int lobj_fd;