mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
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.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* available with a PostgreSQL-compatible license. Kudos Wilfredo
|
||||
* S<>nchez <wsanchez@apple.com>.
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.9 2003/11/29 19:51:54 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.10 2004/01/07 18:56:27 neilc Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@@ -50,7 +50,7 @@ pg_dlsym(void *handle, char *funcname)
|
||||
else
|
||||
{
|
||||
free(symname);
|
||||
return (PGFunction) NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ BSD44_derived_dlerror(void)
|
||||
|
||||
strcpy(ret, error_message);
|
||||
error_message[0] = 0;
|
||||
return (ret[0] == 0) ? (char *) NULL : ret;
|
||||
return (ret[0] == 0) ? NULL : ret;
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -65,7 +65,7 @@ BSD44_derived_dlopen(const char *file, int num)
|
||||
#else
|
||||
void *vp;
|
||||
|
||||
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
|
||||
if ((vp = dlopen((char *) file, num)) == NULL)
|
||||
snprintf(error_message, sizeof(error_message),
|
||||
"dlopen '%s' failed. (%s)", file, dlerror());
|
||||
return vp;
|
||||
@@ -91,7 +91,7 @@ BSD44_derived_dlsym(void *handle, const char *name)
|
||||
name = buf;
|
||||
}
|
||||
#endif
|
||||
if ((vp = dlsym(handle, (char *) name)) == (void *) NULL)
|
||||
if ((vp = dlsym(handle, (char *) name)) == NULL)
|
||||
snprintf(error_message, sizeof(error_message),
|
||||
"dlsym (%s) failed", name);
|
||||
return vp;
|
||||
|
||||
@@ -53,7 +53,7 @@ BSD44_derived_dlerror(void)
|
||||
|
||||
strcpy(ret, error_message);
|
||||
error_message[0] = 0;
|
||||
return (ret[0] == 0) ? (char *) NULL : ret;
|
||||
return (ret[0] == 0) ? NULL : ret;
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -66,7 +66,7 @@ BSD44_derived_dlopen(const char *file, int num)
|
||||
#else
|
||||
void *vp;
|
||||
|
||||
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
|
||||
if ((vp = dlopen((char *) file, num)) == NULL)
|
||||
snprintf(error_message, sizeof(error_message),
|
||||
"dlopen (%s) failed", file);
|
||||
return vp;
|
||||
@@ -91,7 +91,7 @@ BSD44_derived_dlsym(void *handle, const char *name)
|
||||
snprintf(buf, sizeof(buf), "_%s", name);
|
||||
name = buf;
|
||||
}
|
||||
if ((vp = dlsym(handle, (char *) name)) == (void *) NULL)
|
||||
if ((vp = dlsym(handle, (char *) name)) == NULL)
|
||||
snprintf(error_message, sizeof(error_message),
|
||||
"dlsym (%s) failed", name);
|
||||
return vp;
|
||||
|
||||
@@ -53,7 +53,7 @@ BSD44_derived_dlerror(void)
|
||||
|
||||
strcpy(ret, error_message);
|
||||
error_message[0] = 0;
|
||||
return (ret[0] == 0) ? (char *) NULL : ret;
|
||||
return (ret[0] == 0) ? NULL : ret;
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -66,7 +66,7 @@ BSD44_derived_dlopen(const char *file, int num)
|
||||
#else
|
||||
void *vp;
|
||||
|
||||
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
|
||||
if ((vp = dlopen((char *) file, num)) == NULL)
|
||||
snprintf(error_message, sizeof(error_message),
|
||||
"dlopen (%s) failed", file);
|
||||
return vp;
|
||||
@@ -91,7 +91,7 @@ BSD44_derived_dlsym(void *handle, const char *name)
|
||||
snprintf(buf, sizeof(buf), "_%s", name);
|
||||
name = buf;
|
||||
}
|
||||
if ((vp = dlsym(handle, (char *) name)) == (void *) NULL)
|
||||
if ((vp = dlsym(handle, (char *) name)) == NULL)
|
||||
snprintf(error_message, sizeof(error_message),
|
||||
"dlsym (%s) failed", name);
|
||||
return vp;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/qnx4.c,v 1.5 2003/11/29 19:51:54 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/qnx4.c,v 1.6 2004/01/07 18:56:27 neilc Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -28,7 +28,7 @@
|
||||
void *
|
||||
pg_dlopen(char *filename)
|
||||
{
|
||||
return (void *) NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PGFunction
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.27 2003/12/01 22:15:37 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.28 2004/01/07 18:56:27 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -174,7 +174,7 @@ IpcMemoryDetach(int status, Datum shmaddr)
|
||||
static void
|
||||
IpcMemoryDelete(int status, Datum shmId)
|
||||
{
|
||||
if (shmctl(DatumGetInt32(shmId), IPC_RMID, (struct shmid_ds *) NULL) < 0)
|
||||
if (shmctl(DatumGetInt32(shmId), IPC_RMID, NULL) < 0)
|
||||
elog(LOG, "shmctl(%d, %d, 0) failed: %m",
|
||||
DatumGetInt32(shmId), IPC_RMID);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ PGSharedMemoryCreate(uint32 size, bool makePrivate, int port)
|
||||
* quietly.
|
||||
*/
|
||||
shmdt(memAddress);
|
||||
if (shmctl(shmid, IPC_RMID, (struct shmid_ds *) NULL) < 0)
|
||||
if (shmctl(shmid, IPC_RMID, NULL) < 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user