1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Windows portability macros SOCK_ERRNO and SOCK_STRERROR should be in

libpq-int.h, not cluttering application namespace in libpq-fe.h.
This commit is contained in:
Tom Lane
2001-11-02 20:51:27 +00:00
parent 9685afb0b2
commit c42d3b3c24
2 changed files with 259 additions and 252 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-fe.h,v 1.77 2001/10/28 06:26:12 momjian Exp $
* $Id: libpq-fe.h,v 1.78 2001/11/02 20:51:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -22,20 +22,13 @@ extern "C"
#include <stdio.h>
#ifdef WIN32
#define SOCK_ERRNO (WSAGetLastError ())
#define SOCK_STRERROR winsock_strerror
#else
#define SOCK_ERRNO errno
#define SOCK_STRERROR strerror
#endif
/* postgres_ext.h defines the backend's externally visible types,
/*
* postgres_ext.h defines the backend's externally visible types,
* such as Oid.
*/
#include "postgres_ext.h"
/* SSL type is needed here only to declare PQgetssl() */
#ifdef USE_SSL
#include <openssl/ssl.h>
#endif
@ -250,13 +243,16 @@ extern "C"
extern void PQuntrace(PGconn *conn);
/* Override default notice processor */
extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn, PQnoticeProcessor proc, void *arg);
extern PQnoticeProcessor PQsetNoticeProcessor(PGconn *conn,
PQnoticeProcessor proc,
void *arg);
/* === in fe-exec.c === */
/* Quoting strings before inclusion in queries. */
extern size_t PQescapeString(char *to, const char *from, size_t length);
extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen);
extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
size_t *bytealen);
/* Simple synchronous query */
extern PGresult *PQexec(PGconn *conn, const char *query);
@ -337,8 +333,7 @@ extern "C"
* really old printing routines
*/
extern void PQdisplayTuples(const PGresult *res,
FILE *fp, /* where to send the
* output */
FILE *fp, /* where to send the output */
int fillAlign, /* pad the fields with
* spaces */
const char *fieldSep, /* field separator */

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-int.h,v 1.42 2001/10/28 06:26:12 momjian Exp $
* $Id: libpq-int.h,v 1.43 2001/11/02 20:51:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -353,4 +353,16 @@ __attribute__((format_arg(1)));
#define libpq_gettext(x) (x)
#endif
/*
* These macros are needed to let error-handling code be portable between
* Unix and Windows. (ugh)
*/
#ifdef WIN32
#define SOCK_ERRNO (WSAGetLastError())
#define SOCK_STRERROR winsock_strerror
#else
#define SOCK_ERRNO errno
#define SOCK_STRERROR strerror
#endif
#endif /* LIBPQ_INT_H */