mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
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
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.25 1999/08/31 01:37:36 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-lobj.c,v 1.26 1999/11/11 00:10:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ lo_close(PGconn *conn, int fd)
|
||||
*/
|
||||
|
||||
int
|
||||
lo_read(PGconn *conn, int fd, char *buf, int len)
|
||||
lo_read(PGconn *conn, int fd, char *buf, size_t len)
|
||||
{
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
@@ -167,7 +167,7 @@ lo_read(PGconn *conn, int fd, char *buf, int len)
|
||||
*
|
||||
*/
|
||||
int
|
||||
lo_write(PGconn *conn, int fd, char *buf, int len)
|
||||
lo_write(PGconn *conn, int fd, const char *buf, size_t len)
|
||||
{
|
||||
PQArgBlock argv[2];
|
||||
PGresult *res;
|
||||
@@ -378,7 +378,7 @@ lo_unlink(PGconn *conn, Oid lobjId)
|
||||
*/
|
||||
|
||||
Oid
|
||||
lo_import(PGconn *conn, char *filename)
|
||||
lo_import(PGconn *conn, const char *filename)
|
||||
{
|
||||
int fd;
|
||||
int nbytes,
|
||||
@@ -451,7 +451,7 @@ lo_import(PGconn *conn, char *filename)
|
||||
* returns -1 upon failure, 1 otherwise
|
||||
*/
|
||||
int
|
||||
lo_export(PGconn *conn, Oid lobjId, char *filename)
|
||||
lo_export(PGconn *conn, Oid lobjId, const char *filename)
|
||||
{
|
||||
int fd;
|
||||
int nbytes,
|
||||
@@ -522,7 +522,7 @@ lo_initialize(PGconn *conn)
|
||||
PGresult *res;
|
||||
PGlobjfuncs *lobjfuncs;
|
||||
int n;
|
||||
char *fname;
|
||||
const char *fname;
|
||||
Oid foid;
|
||||
|
||||
/* ----------------
|
||||
|
||||
Reference in New Issue
Block a user