Fix comparisons of pointers with zero to compare with NULL instead.
Per C standard, these are semantically the same thing; but saying NULL when you mean NULL is good for readability. Marti Raudsepp, per results of INRIA's Coccinelle.
This commit is contained in:
parent
48a1fb2390
commit
bfd3f37be3
|
@ -846,7 +846,7 @@ lexescape(struct vars * v)
|
||||||
if (ISERR())
|
if (ISERR())
|
||||||
FAILW(REG_EESCAPE);
|
FAILW(REG_EESCAPE);
|
||||||
/* ugly heuristic (first test is "exactly 1 digit?") */
|
/* ugly heuristic (first test is "exactly 1 digit?") */
|
||||||
if (v->now - save == 0 || ((int) c > 0 && (int) c <= v->nsubexp))
|
if (v->now == save || ((int) c > 0 && (int) c <= v->nsubexp))
|
||||||
{
|
{
|
||||||
NOTE(REG_UBACKREF);
|
NOTE(REG_UBACKREF);
|
||||||
RETV(BACKREF, (chr) c);
|
RETV(BACKREF, (chr) c);
|
||||||
|
|
|
@ -395,7 +395,7 @@ getWeights(ArrayType *win)
|
||||||
int i;
|
int i;
|
||||||
float4 *arrdata;
|
float4 *arrdata;
|
||||||
|
|
||||||
if (win == 0)
|
if (win == NULL)
|
||||||
return weights;
|
return weights;
|
||||||
|
|
||||||
if (ARR_NDIM(win) != 1)
|
if (ARR_NDIM(win) != 1)
|
||||||
|
|
|
@ -616,7 +616,7 @@ find_in_dynamic_libpath(const char *basename)
|
||||||
(errcode(ERRCODE_INVALID_NAME),
|
(errcode(ERRCODE_INVALID_NAME),
|
||||||
errmsg("zero-length component in parameter \"dynamic_library_path\"")));
|
errmsg("zero-length component in parameter \"dynamic_library_path\"")));
|
||||||
|
|
||||||
if (piece == 0)
|
if (piece == NULL)
|
||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
else
|
else
|
||||||
len = piece - p;
|
len = piece - p;
|
||||||
|
|
|
@ -576,7 +576,7 @@ tarWrite(const void *buf, size_t len, TAR_MEMBER *th)
|
||||||
{
|
{
|
||||||
size_t res;
|
size_t res;
|
||||||
|
|
||||||
if (th->zFH != 0)
|
if (th->zFH != NULL)
|
||||||
res = GZWRITE((void *) buf, 1, len, th->zFH);
|
res = GZWRITE((void *) buf, 1, len, th->zFH);
|
||||||
else
|
else
|
||||||
res = fwrite(buf, 1, len, th->nFH);
|
res = fwrite(buf, 1, len, th->nFH);
|
||||||
|
|
|
@ -246,7 +246,7 @@ pgsymlink(const char *oldpath, const char *newpath)
|
||||||
else
|
else
|
||||||
strcpy(nativeTarget, oldpath);
|
strcpy(nativeTarget, oldpath);
|
||||||
|
|
||||||
while ((p = strchr(p, '/')) != 0)
|
while ((p = strchr(p, '/')) != NULL)
|
||||||
*p++ = '\\';
|
*p++ = '\\';
|
||||||
|
|
||||||
len = strlen(nativeTarget) * sizeof(WCHAR);
|
len = strlen(nativeTarget) * sizeof(WCHAR);
|
||||||
|
|
|
@ -810,7 +810,7 @@ associate(void)
|
||||||
* Note, though, that if there's no rule, a '%s' in the format is
|
* Note, though, that if there's no rule, a '%s' in the format is
|
||||||
* a bad thing.
|
* a bad thing.
|
||||||
*/
|
*/
|
||||||
if (strchr(zp->z_format, '%') != 0)
|
if (strchr(zp->z_format, '%') != NULL)
|
||||||
error(_("%s in ruleless zone"));
|
error(_("%s in ruleless zone"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1111,9 +1111,9 @@ inzsub(char **fields, int nfields, int iscont)
|
||||||
z.z_filename = filename;
|
z.z_filename = filename;
|
||||||
z.z_linenum = linenum;
|
z.z_linenum = linenum;
|
||||||
z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UTC offset"), TRUE);
|
z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UTC offset"), TRUE);
|
||||||
if ((cp = strchr(fields[i_format], '%')) != 0)
|
if ((cp = strchr(fields[i_format], '%')) != NULL)
|
||||||
{
|
{
|
||||||
if (*++cp != 's' || strchr(cp, '%') != 0)
|
if (*++cp != 's' || strchr(cp, '%') != NULL)
|
||||||
{
|
{
|
||||||
error(_("invalid abbreviation format"));
|
error(_("invalid abbreviation format"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1438,9 +1438,9 @@ rulesub(struct rule * rp, const char *loyearp, const char *hiyearp,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ep = strchr(dp, '<')) != 0)
|
if ((ep = strchr(dp, '<')) != NULL)
|
||||||
rp->r_dycode = DC_DOWLEQ;
|
rp->r_dycode = DC_DOWLEQ;
|
||||||
else if ((ep = strchr(dp, '>')) != 0)
|
else if ((ep = strchr(dp, '>')) != NULL)
|
||||||
rp->r_dycode = DC_DOWGEQ;
|
rp->r_dycode = DC_DOWGEQ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2826,7 +2826,7 @@ mkdirs(char *argname)
|
||||||
if (argname == NULL || *argname == '\0')
|
if (argname == NULL || *argname == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
cp = name = ecpyalloc(argname);
|
cp = name = ecpyalloc(argname);
|
||||||
while ((cp = strchr(cp + 1, '/')) != 0)
|
while ((cp = strchr(cp + 1, '/')) != NULL)
|
||||||
{
|
{
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
Loading…
Reference in New Issue