aboutsummaryrefslogtreecommitdiff
path: root/src/backend/libpq/pqformat.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-08-29 03:22:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-08-29 03:22:01 +0000
commit5241a6259ff0a4a12d7659b25310f0987b51f211 (patch)
treec794a5e5ec6fc1dd134b46d94e9acf2dabd4b02d /src/backend/libpq/pqformat.c
parent8a24a55c8189debb779ac99f47c7054d6f9d8408 (diff)
downloadpostgresql-5241a6259ff0a4a12d7659b25310f0987b51f211.tar.gz
postgresql-5241a6259ff0a4a12d7659b25310f0987b51f211.zip
Remove support for version-0 FE/BE protocol, per pghackers discussion.
This breaks support for 6.2 or older client libraries.
Diffstat (limited to 'src/backend/libpq/pqformat.c')
-rw-r--r--src/backend/libpq/pqformat.c47
1 files changed, 5 insertions, 42 deletions
diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c
index 91c3669a1ad..01f8914bdbe 100644
--- a/src/backend/libpq/pqformat.c
+++ b/src/backend/libpq/pqformat.c
@@ -16,7 +16,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqformat.c,v 1.22 2002/08/08 06:32:26 ishii Exp $
+ * $Id: pqformat.c,v 1.23 2002/08/29 03:22:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,41 +57,6 @@
#include <endian.h>
#endif
-#ifndef BYTE_ORDER
-#error BYTE_ORDER must be defined as LITTLE_ENDIAN, BIG_ENDIAN or PDP_ENDIAN
-#endif
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-
-#define ntoh_s(n) n
-#define ntoh_l(n) n
-#define hton_s(n) n
-#define hton_l(n) n
-
-#else
-#if BYTE_ORDER == BIG_ENDIAN
-
-#define ntoh_s(n) (uint16)((((uint16)n & 0x00ff) << 8) | \
- (((uint16)n & 0xff00) >> 8))
-#define ntoh_l(n) (uint32)((((uint32)n & 0x000000ff) << 24) | \
- (((uint32)n & 0x0000ff00) << 8) | \
- (((uint32)n & 0x00ff0000) >> 8) | \
- (((uint32)n & 0xff000000) >> 24))
-#define hton_s(n) (ntoh_s(n))
-#define hton_l(n) (ntoh_l(n))
-
-#else
-#if BYTE_ORDER == PDP_ENDIAN
-
-#error PDP_ENDIAN macros not written yet
-
-#else
-
-#error BYTE_ORDER not defined as anything understood
-#endif
-#endif
-#endif
-
/* --------------------------------
* pq_sendbyte - append a raw byte to a StringInfo buffer
@@ -183,11 +148,11 @@ pq_sendint(StringInfo buf, int i, int b)
appendBinaryStringInfo(buf, (char *) &n8, 1);
break;
case 2:
- n16 = ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? hton_s(i) : htons((uint16) i));
+ n16 = htons((uint16) i);
appendBinaryStringInfo(buf, (char *) &n16, 2);
break;
case 4:
- n32 = ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? hton_l(i) : htonl((uint32) i));
+ n32 = htonl((uint32) i);
appendBinaryStringInfo(buf, (char *) &n32, 4);
break;
default:
@@ -261,13 +226,11 @@ pq_getint(int *result, int b)
break;
case 2:
status = pq_getbytes((char *) &n16, 2);
- *result = (int) ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ?
- ntoh_s(n16) : ntohs(n16));
+ *result = (int) (ntohs(n16));
break;
case 4:
status = pq_getbytes((char *) &n32, 4);
- *result = (int) ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ?
- ntoh_l(n32) : ntohl(n32));
+ *result = (int) (ntohl(n32));
break;
default: