summaryrefslogtreecommitdiff
path: root/src/interfaces/libpgtcl
diff options
context:
space:
mode:
authorNeil Conway2004-01-07 18:56:30 +0000
committerNeil Conway2004-01-07 18:56:30 +0000
commit192ad63bd765d448e91389c6ff1d75f8b18bb268 (patch)
tree85873642a16b5ac877dc443a681fe9249c210693 /src/interfaces/libpgtcl
parentafca5d50dc296580925b560fff0eb75bb48f0cbe (diff)
More janitorial work: remove the explicit casting of NULL literals to a
pointer type when it is not necessary to do so. For future reference, casting NULL to a pointer type is only necessary when (a) invoking a function AND either (b) the function has no prototype OR (c) the function is a varargs function.
Diffstat (limited to 'src/interfaces/libpgtcl')
-rw-r--r--src/interfaces/libpgtcl/pgtcl.c44
-rw-r--r--src/interfaces/libpgtcl/pgtclCmds.c70
-rw-r--r--src/interfaces/libpgtcl/pgtclId.c6
3 files changed, 60 insertions, 60 deletions
diff --git a/src/interfaces/libpgtcl/pgtcl.c b/src/interfaces/libpgtcl/pgtcl.c
index f6e625048c7..7c4432e9221 100644
--- a/src/interfaces/libpgtcl/pgtcl.c
+++ b/src/interfaces/libpgtcl/pgtcl.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpgtcl/pgtcl.c,v 1.29 2003/11/29 19:52:11 pgsql Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpgtcl/pgtcl.c,v 1.30 2004/01/07 18:56:29 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,109 +53,109 @@ Pgtcl_Init(Tcl_Interp *interp)
Tcl_CreateCommand(interp,
"pg_conndefaults",
Pg_conndefaults,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_connect",
Pg_connect,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_disconnect",
Pg_disconnect,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_exec",
Pg_exec,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_select",
Pg_select,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_result",
Pg_result,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_execute",
Pg_execute,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_open",
Pg_lo_open,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_close",
Pg_lo_close,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
#ifdef PGTCL_USE_TCLOBJ
Tcl_CreateObjCommand(interp,
"pg_lo_read",
Pg_lo_read,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateObjCommand(interp,
"pg_lo_write",
Pg_lo_write,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
#else
Tcl_CreateCommand(interp,
"pg_lo_read",
Pg_lo_read,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_write",
Pg_lo_write,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
#endif
Tcl_CreateCommand(interp,
"pg_lo_lseek",
Pg_lo_lseek,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_creat",
Pg_lo_creat,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_tell",
Pg_lo_tell,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_unlink",
Pg_lo_unlink,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_import",
Pg_lo_import,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_lo_export",
Pg_lo_export,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_listen",
Pg_listen,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_CreateCommand(interp,
"pg_on_connection_loss",
Pg_on_connection_loss,
- (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+ NULL, NULL);
Tcl_PkgProvide(interp, "Pgtcl", "1.4");
diff --git a/src/interfaces/libpgtcl/pgtclCmds.c b/src/interfaces/libpgtcl/pgtclCmds.c
index 10b995117f0..bbd0064bf91 100644
--- a/src/interfaces/libpgtcl/pgtclCmds.c
+++ b/src/interfaces/libpgtcl/pgtclCmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpgtcl/pgtclCmds.c,v 1.76 2003/11/29 19:52:11 pgsql Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpgtcl/pgtclCmds.c,v 1.77 2004/01/07 18:56:29 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,7 +153,7 @@ tcl_value(char *value)
char *p;
if (!value)
- return (char *) NULL;
+ return NULL;
#ifdef TCL_ARRAYS_DEBUG
printf("pq_value = '%s'\n", value);
@@ -417,8 +417,8 @@ Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv
}
/* Check that it is a PG connection and not something else */
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
return Tcl_UnregisterChannel(interp, conn_chan);
@@ -450,7 +450,7 @@ Pg_exec(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
}
conn = PgGetConnectionId(interp, argv[1], &connid);
- if (conn == (PGconn *) NULL)
+ if (conn == NULL)
return TCL_ERROR;
if (connid->res_copyStatus != RES_COPY_NONE)
@@ -555,7 +555,7 @@ Pg_result(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
}
result = PgGetResultId(interp, argv[1]);
- if (result == (PGresult *) NULL)
+ if (result == NULL)
{
Tcl_AppendResult(interp, "\n",
argv[1], " is not a valid query result", 0);
@@ -878,7 +878,7 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
* Get the connection and make sure no COPY command is pending
*/
conn = PgGetConnectionId(interp, argv[i++], &connid);
- if (conn == (PGconn *) NULL)
+ if (conn == NULL)
return TCL_ERROR;
if (connid->res_copyStatus != RES_COPY_NONE)
@@ -1085,8 +1085,8 @@ Pg_lo_open(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
lobjId = atoi(argv[2]);
@@ -1153,8 +1153,8 @@ Pg_lo_close(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[]
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
fd = atoi(argv[2]);
@@ -1195,8 +1195,8 @@ Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc,
}
conn = PgGetConnectionId(interp, Tcl_GetStringFromObj(objv[1], NULL),
- (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ NULL);
+ if (conn == NULL)
return TCL_ERROR;
if (Tcl_GetIntFromObj(interp, objv[2], &fd) != TCL_OK)
@@ -1254,8 +1254,8 @@ Pg_lo_read(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
fd = atoi(argv[2]);
@@ -1310,8 +1310,8 @@ Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc,
}
conn = PgGetConnectionId(interp, Tcl_GetStringFromObj(objv[1], NULL),
- (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ NULL);
+ if (conn == NULL)
return TCL_ERROR;
if (Tcl_GetIntFromObj(interp, objv[2], &fd) != TCL_OK)
@@ -1357,8 +1357,8 @@ Pg_lo_write(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[]
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
fd = atoi(argv[2]);
@@ -1405,8 +1405,8 @@ Pg_lo_lseek(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[]
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
fd = atoi(argv[2]);
@@ -1457,8 +1457,8 @@ Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[]
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
modeStr = strdup(argv[2]);
@@ -1477,7 +1477,7 @@ Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[]
return TCL_ERROR;
}
- while ((modeWord = strtok((char *) NULL, "|")) != NULL)
+ while ((modeWord = strtok(NULL, "|")) != NULL)
{
if (strcmp(modeWord, "INV_READ") == 0)
mode |= INV_READ;
@@ -1518,8 +1518,8 @@ Pg_lo_tell(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
fd = atoi(argv[2]);
@@ -1552,8 +1552,8 @@ Pg_lo_unlink(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
lobjId = atoi(argv[2]);
@@ -1594,8 +1594,8 @@ Pg_lo_import(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
filename = argv[2];
@@ -1638,8 +1638,8 @@ Pg_lo_export(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[
return TCL_ERROR;
}
- conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
- if (conn == (PGconn *) NULL)
+ conn = PgGetConnectionId(interp, argv[1], NULL);
+ if (conn == NULL)
return TCL_ERROR;
lobjId = atoi(argv[2]);
@@ -1702,7 +1702,7 @@ Pg_select(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
}
conn = PgGetConnectionId(interp, argv[1], &connid);
- if (conn == (PGconn *) NULL)
+ if (conn == NULL)
return TCL_ERROR;
if ((result = PQexec(conn, argv[2])) == 0)
@@ -1858,7 +1858,7 @@ Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
* allocated by us.
*/
conn = PgGetConnectionId(interp, argv[1], &connid);
- if (conn == (PGconn *) NULL)
+ if (conn == NULL)
return TCL_ERROR;
/*
@@ -2032,7 +2032,7 @@ Pg_on_connection_loss(ClientData cData, Tcl_Interp *interp, int argc, CONST84 ch
* Get the command arguments.
*/
conn = PgGetConnectionId(interp, argv[1], &connid);
- if (conn == (PGconn *) NULL)
+ if (conn == NULL)
return TCL_ERROR;
if ((argc > 2) && *argv[2])
diff --git a/src/interfaces/libpgtcl/pgtclId.c b/src/interfaces/libpgtcl/pgtclId.c
index a86a2944762..1cdd85b975b 100644
--- a/src/interfaces/libpgtcl/pgtclId.c
+++ b/src/interfaces/libpgtcl/pgtclId.c
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpgtcl/pgtclId.c,v 1.44 2003/11/29 19:52:11 pgsql Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpgtcl/pgtclId.c,v 1.45 2004/01/07 18:56:29 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -133,7 +133,7 @@ PgOutputProc(DRIVER_OUTPUT_PROTO)
Tcl_File
PgGetFileProc(ClientData cData, int direction)
{
- return (Tcl_File) NULL;
+ return NULL;
}
#endif
@@ -231,7 +231,7 @@ PgGetConnectionId(Tcl_Interp *interp, CONST84 char *id,
Tcl_AppendResult(interp, id, " is not a valid postgresql connection", 0);
if (connid_p)
*connid_p = NULL;
- return (PGconn *) NULL;
+ return NULL;
}
connid = (Pg_ConnectionId *) Tcl_GetChannelInstanceData(conn_chan);