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:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.101 2003/11/29 19:51:57 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.102 2004/01/07 18:56:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -307,10 +307,8 @@ array_in(PG_FUNCTION_ARGS)
|
||||
retval->size = nbytes;
|
||||
retval->ndim = ndim;
|
||||
retval->elemtype = element_type;
|
||||
memcpy((char *) ARR_DIMS(retval), (char *) dim,
|
||||
ndim * sizeof(int));
|
||||
memcpy((char *) ARR_LBOUND(retval), (char *) lBound,
|
||||
ndim * sizeof(int));
|
||||
memcpy(ARR_DIMS(retval), dim, ndim * sizeof(int));
|
||||
memcpy(ARR_LBOUND(retval), lBound, ndim * sizeof(int));
|
||||
|
||||
CopyArrayEls(ARR_DATA_PTR(retval), dataPtr, nitems,
|
||||
typlen, typbyval, typalign, true);
|
||||
@@ -972,10 +970,8 @@ array_recv(PG_FUNCTION_ARGS)
|
||||
retval->size = nbytes;
|
||||
retval->ndim = ndim;
|
||||
retval->elemtype = element_type;
|
||||
memcpy((char *) ARR_DIMS(retval), (char *) dim,
|
||||
ndim * sizeof(int));
|
||||
memcpy((char *) ARR_LBOUND(retval), (char *) lBound,
|
||||
ndim * sizeof(int));
|
||||
memcpy(ARR_DIMS(retval), dim, ndim * sizeof(int));
|
||||
memcpy(ARR_LBOUND(retval), lBound, ndim * sizeof(int));
|
||||
|
||||
CopyArrayEls(ARR_DATA_PTR(retval), dataPtr, nitems,
|
||||
typlen, typbyval, typalign, true);
|
||||
@@ -1384,7 +1380,7 @@ array_ref(ArrayType *array,
|
||||
char *arraydataptr,
|
||||
*retptr;
|
||||
|
||||
if (array == (ArrayType *) NULL)
|
||||
if (array == NULL)
|
||||
RETURN_NULL(Datum);
|
||||
|
||||
if (arraylen > 0)
|
||||
@@ -1463,7 +1459,7 @@ array_get_slice(ArrayType *array,
|
||||
int bytes,
|
||||
span[MAXDIM];
|
||||
|
||||
if (array == (ArrayType *) NULL)
|
||||
if (array == NULL)
|
||||
RETURN_NULL(ArrayType *);
|
||||
|
||||
if (arraylen > 0)
|
||||
@@ -1602,7 +1598,7 @@ array_set(ArrayType *array,
|
||||
lenbefore,
|
||||
lenafter;
|
||||
|
||||
if (array == (ArrayType *) NULL)
|
||||
if (array == NULL)
|
||||
RETURN_NULL(ArrayType *);
|
||||
|
||||
if (arraylen > 0)
|
||||
@@ -1798,9 +1794,9 @@ array_set_slice(ArrayType *array,
|
||||
lenbefore,
|
||||
lenafter;
|
||||
|
||||
if (array == (ArrayType *) NULL)
|
||||
if (array == NULL)
|
||||
RETURN_NULL(ArrayType *);
|
||||
if (srcArray == (ArrayType *) NULL)
|
||||
if (srcArray == NULL)
|
||||
return array;
|
||||
|
||||
if (arraylen > 0)
|
||||
@@ -2279,8 +2275,8 @@ construct_md_array(Datum *elems,
|
||||
result->ndim = ndims;
|
||||
result->flags = 0;
|
||||
result->elemtype = elmtype;
|
||||
memcpy((char *) ARR_DIMS(result), (char *) dims, ndims * sizeof(int));
|
||||
memcpy((char *) ARR_LBOUND(result), (char *) lbs, ndims * sizeof(int));
|
||||
memcpy(ARR_DIMS(result), dims, ndims * sizeof(int));
|
||||
memcpy(ARR_LBOUND(result), lbs, ndims * sizeof(int));
|
||||
CopyArrayEls(ARR_DATA_PTR(result), elems, nelems,
|
||||
elmlen, elmbyval, elmalign, false);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* formatting.c
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.71 2003/12/25 03:36:23 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.72 2004/01/07 18:56:28 neilc Exp $
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1999-2003, PostgreSQL Global Development Group
|
||||
@@ -927,7 +927,7 @@ index_seq_search(char *str, KeyWord *kw, int *index)
|
||||
int poz;
|
||||
|
||||
if (!KeyWord_INDEX_FILTER(*str))
|
||||
return (KeyWord *) NULL;
|
||||
return NULL;
|
||||
|
||||
if ((poz = *(index + (*str - ' '))) > -1)
|
||||
{
|
||||
@@ -940,10 +940,10 @@ index_seq_search(char *str, KeyWord *kw, int *index)
|
||||
return k;
|
||||
k++;
|
||||
if (!k->name)
|
||||
return (KeyWord *) NULL;
|
||||
return NULL;
|
||||
} while (*str == *k->name);
|
||||
}
|
||||
return (KeyWord *) NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static KeySuffix *
|
||||
@@ -959,7 +959,7 @@ suff_search(char *str, KeySuffix *suf, int type)
|
||||
if (!strncmp(str, s->name, s->len))
|
||||
return s;
|
||||
}
|
||||
return (KeySuffix *) NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ----------
|
||||
@@ -1246,7 +1246,7 @@ parse_format(FormatNode *node, char *str, KeyWord *kw,
|
||||
}
|
||||
n->type = NODE_TYPE_CHAR;
|
||||
n->character = *str;
|
||||
n->key = (KeyWord *) NULL;
|
||||
n->key = NULL;
|
||||
n->suffix = 0;
|
||||
++n;
|
||||
x = *str;
|
||||
@@ -1266,7 +1266,7 @@ parse_format(FormatNode *node, char *str, KeyWord *kw,
|
||||
{
|
||||
n->type = NODE_TYPE_CHAR;
|
||||
n->character = *str;
|
||||
n->key = (KeyWord *) NULL;
|
||||
n->key = NULL;
|
||||
node_set = 1;
|
||||
last = 0;
|
||||
str++;
|
||||
@@ -2731,7 +2731,7 @@ DCH_cache_getnew(char *str)
|
||||
return ent;
|
||||
}
|
||||
|
||||
return (DCHCacheEntry *) NULL; /* never */
|
||||
return NULL; /* never */
|
||||
}
|
||||
|
||||
static DCHCacheEntry *
|
||||
@@ -2761,7 +2761,7 @@ DCH_cache_search(char *str)
|
||||
i++;
|
||||
}
|
||||
|
||||
return (DCHCacheEntry *) NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static text *
|
||||
@@ -3362,7 +3362,7 @@ NUM_cache_search(char *str)
|
||||
i++;
|
||||
}
|
||||
|
||||
return (NUMCacheEntry *) NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.59 2003/11/29 19:51:59 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/numutils.c,v 1.60 2004/01/07 18:56:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ pg_atoi(char *s, int size, int c)
|
||||
* Some versions of strtol treat the empty string as an error, but
|
||||
* some seem not to. Make an explicit test to be sure we catch it.
|
||||
*/
|
||||
if (s == (char *) NULL)
|
||||
if (s == NULL)
|
||||
elog(ERROR, "NULL pointer");
|
||||
if (*s == 0)
|
||||
ereport(ERROR,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.65 2003/11/29 19:51:59 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.66 2004/01/07 18:56:28 neilc Exp $
|
||||
*
|
||||
* ----------
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ typedef struct RI_QueryHashEntry
|
||||
* Local data
|
||||
* ----------
|
||||
*/
|
||||
static HTAB *ri_query_cache = (HTAB *) NULL;
|
||||
static HTAB *ri_query_cache = NULL;
|
||||
|
||||
|
||||
/* ----------
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.153 2004/01/05 23:39:54 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.154 2004/01/07 18:56:28 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -3822,7 +3822,7 @@ make_greater_string(const Const *str_const)
|
||||
if (workstr != NULL)
|
||||
pfree(workstr);
|
||||
|
||||
return (Const *) NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user