Author: araujo
Date: Fri Apr 15 03:38:58 2016
New Revision: 298028
URL: https://svnweb.freebsd.org/changeset/base/298028

Log:
  Use NULL instead of 0 for pointers.
  
  fopen(3) returns NULL in case it can't open the STREAM.
  fgetln(3) returns NULL if it can't get a line from a STREAM.
  malloc returns NULL if it can't allocate memory.

Modified:
  head/usr.sbin/fmtree/excludes.c

Modified: head/usr.sbin/fmtree/excludes.c
==============================================================================
--- head/usr.sbin/fmtree/excludes.c     Fri Apr 15 03:10:04 2016        
(r298027)
+++ head/usr.sbin/fmtree/excludes.c     Fri Apr 15 03:38:58 2016        
(r298028)
@@ -69,10 +69,10 @@ read_excludes_file(const char *name)
        size_t len;
 
        fp = fopen(name, "r");
-       if (fp == 0)
+       if (fp == NULL)
                err(1, "%s", name);
 
-       while ((line = fgetln(fp, &len)) != 0) {
+       while ((line = fgetln(fp, &len)) != NULL) {
                if (line[len - 1] == '\n')
                        len--;
                if (len == 0)
@@ -80,7 +80,7 @@ read_excludes_file(const char *name)
 
                str = malloc(len + 1);
                e = malloc(sizeof *e);
-               if (str == 0 || e == 0)
+               if (str == NULL || e == NULL)
                        errx(1, "memory allocation error");
                e->glob = str;
                memcpy(str, line, len);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to