From 2a24ec6f167a21ef074609e165d77f1f7c715259 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 11 Nov 1999 00:10:14 +0000 Subject: In the spirit of TODO item * Add use of 'const' for varibles in source tree (which is misspelled, btw.) I went through the front-end libpq code and did so. This affects in particular the various accessor functions (such as PQdb() and PQgetvalue()) as well as, by necessity, the internal helpers they use. I have been really thorough in that regard, perhaps some people will find it annoying that things like char * foo = PQgetvalue(res, 0, 0) will generate a warning. On the other hand it _should_ generate one. This is no real compatibility break, although a few clients will have to be fixed to suppress warnings. (Which again would be in the spirit of the above TODO.) In addition I replaced some int's by size_t's and removed some warnings (and generated some new ones -- grmpf!). Also I rewrote PQoidStatus (so it actually honors the const!) and supplied a new function PQoidValue that returns a proper Oid type. This is only front-end stuff, none of the communicaton stuff was touched. The psql patch also adds some new consts to honor the new libpq situation, as well as fixes a fatal condition that resulted when using the -V (--version) option and there is no database listening. So, to summarize, the psql you should definitely put in (with or without the libpq). If you think I went too far with the const-mania in libpq, let me know and I'll make adjustments. If you approve it, I will also update the docs. -Peter -- Peter Eisentraut Sernanders vaeg 10:115 --- src/interfaces/libpq/libpq-int.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/interfaces/libpq/libpq-int.h') diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 2b3db3fe7f..7323e9fe06 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -11,7 +11,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: libpq-int.h,v 1.12 1999/09/27 03:13:16 momjian Exp $ + * $Id: libpq-int.h,v 1.13 1999/11/11 00:10:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -247,7 +247,7 @@ extern int pqPacketSend(PGconn *conn, const char *buf, size_t len); /* === in fe-exec.c === */ extern void pqSetResultError(PGresult *res, const char *msg); -extern void *pqResultAlloc(PGresult *res, int nBytes, int isBinary); +extern void *pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary); extern char *pqResultStrdup(PGresult *res, const char *str); extern void pqClearAsyncResult(PGconn *conn); @@ -261,10 +261,10 @@ extern void pqClearAsyncResult(PGconn *conn); extern int pqGetc(char *result, PGconn *conn); extern int pqGets(PQExpBuffer buf, PGconn *conn); extern int pqPuts(const char *s, PGconn *conn); -extern int pqGetnchar(char *s, int len, PGconn *conn); -extern int pqPutnchar(const char *s, int len, PGconn *conn); -extern int pqGetInt(int *result, int bytes, PGconn *conn); -extern int pqPutInt(int value, int bytes, PGconn *conn); +extern int pqGetnchar(char *s, size_t len, PGconn *conn); +extern int pqPutnchar(const char *s, size_t len, PGconn *conn); +extern int pqGetInt(int *result, size_t bytes, PGconn *conn); +extern int pqPutInt(int value, size_t bytes, PGconn *conn); extern int pqReadData(PGconn *conn); extern int pqFlush(PGconn *conn); extern int pqWait(int forRead, int forWrite, PGconn *conn); -- cgit v1.2.1