fix MISRA C"Literal zero used in pointer context"

MISRC C required pointer to zero should be replace with NULL

Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
This commit is contained in:
Huihuang Shi
2018-06-08 13:12:06 +08:00
committed by lijinxia
parent 7710940195
commit 8940c896be
7 changed files with 8 additions and 11 deletions

View File

@@ -123,7 +123,7 @@ static const char *get_flags(const char *s, int *flags)
* found
*/
pos = strchr(flagchars, *s);
if (pos == 0)
if (pos == NULL)
break;
/* apply matching flags and continue with the next character */
@@ -214,7 +214,7 @@ static int format_number(struct print_param *param)
return res;
/* invalidate prefix */
param->vars.prefix = 0;
param->vars.prefix = NULL;
param->vars.prefixlen = 0;
}

View File

@@ -278,7 +278,7 @@ strtol(const char *nptr, char **endptr, register int base)
acc = neg ? LONG_MIN : LONG_MAX;
else if (neg)
acc = -acc;
if (endptr != 0)
if (endptr != NULL)
*endptr = (char *) (any ? s - 1 : nptr);
return acc;
}
@@ -340,7 +340,7 @@ strtoul(const char *nptr, char **endptr, register int base)
acc = ULONG_MAX;
else if (neg)
acc = -acc;
if (endptr != 0)
if (endptr != NULL)
*endptr = (char *) (any ? s - 1 : nptr);
return acc;
}