Re: [PATCH 1/3] a pointer should not be compared to zero [coccinelle]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/01/13 21:33, Sami Kerola wrote "a pointer should not be compared
to zero":
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>

Why not? It is perfectly legal.
See http://www.c-faq.com/null/null2.html

> ---
> -	if (mnt == 0) {
> +	if (mnt == NULL) {

> -	while ((dp = readdir(dir)) != 0) {
> +	while ((dp = readdir(dir)) != NULL) {

> -	if (Sflag == 0)
> +	if (Sflag == NULL)

> -	if (Bflag == 0) {
> +	if (Bflag == NULL) {

> -	if (Mflag == 0)
> +	if (Mflag == NULL)

> -  if (types == 0) {
> +  if (types == NULL) {

> -				get_logname(&options, &termios, &chardata)) == 0)
> +				get_logname(&options, &termios, &chardata)) == NULL)

> -	for (cp = strtok(arg, ","); cp != 0; cp = strtok((char *)0, ",")) {
> +	for (cp = strtok(arg, ","); cp != NULL; cp = strtok((char *)0, ",")) {

> -		if ((term = getenv("TERM")) == 0) {
> +		if ((term = getenv("TERM")) == NULL) {

> -			if (Home == 0 || *Home == '\0') {
> +			if (Home == NULL || *Home == '\0') {

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux