From owner-svn-src-all@freebsd.org Fri Apr 15 04:37:56 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 449C6AECAF3; Fri, 15 Apr 2016 04:37:56 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-ob0-x232.google.com (mail-ob0-x232.google.com [IPv6:2607:f8b0:4003:c01::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A58C1BD9; Fri, 15 Apr 2016 04:37:56 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-ob0-x232.google.com with SMTP id bg3so58983040obb.1; Thu, 14 Apr 2016 21:37:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc; bh=admKQYPByJBeb/KL0Rj7VK2bPZznz2uf30ABUKoCuyA=; b=kG/+7PSproClcNVlyFfU4cRmtZkVoG/7hNTxT244nN8a1vf2ehG2yfpqaRgagkMdE3 nwCUAZyzbOmL0NIuS+r7+AH6xXlr2AK8l+old4MwtvgirQoh6H9ffc0vYGXDXSI5tmf8 JqKPgr7VRTaSAuvMEEL8GtztU4WFokZs4SjcRM5+TgTXC3evkVx7kDJdc8ril7R9kVZZ vODUuQmYYoVNr7VWS+lsjESuISaTsHWOFXnAUVfO9965/f79dksu9Pz+MO3qnuy4UyvL r690gyODrc+c9bKMi0ReyZJuWq+21czRPa67CQGpBmwYGPQBQ8l9kn87ZQKwNJ4WrE6Z bJ+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:cc; bh=admKQYPByJBeb/KL0Rj7VK2bPZznz2uf30ABUKoCuyA=; b=bqkZMSfh/XCtnfD9sWAcuyTW51PanuEUJnmquK/yWKwSVxjCUPrHOZ83xcGK75rYgK ez1wC1a3/TEifywd4CQOKsuedSPAhccqsw8je8acoMNpip2qFy7Q3rp3Up/a0vN2Sf6B E6chSelcQcpq/JAKhJ6eqxgwid4tN+Egka/m5iQXJJ9HNqSEIiNp/TQq5pN7uxflNo3O w4hk+UVhM0k49thlxx+j7bAvhco/PuR17RKV6O/lleSZKwYHEIgcM6yrHXmagtjmWiT6 LCdT5ep5PRZWQ68kRn6+fBp87Pi3aTHTdDOfBe8u3018muaoK1kweEoJ99cjLu1vf1w/ esNg== X-Gm-Message-State: AOPr4FUvAY1wDpWP38gB81ekmLsZWdX2gcc/ReUfXd9+ddhEWbtiHyz24NmWqKeWPd1G87CLcgKtafwj5lZKWA== MIME-Version: 1.0 X-Received: by 10.60.54.8 with SMTP id f8mr9662823oep.31.1460695075216; Thu, 14 Apr 2016 21:37:55 -0700 (PDT) Received: by 10.182.156.65 with HTTP; Thu, 14 Apr 2016 21:37:55 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <201604150410.u3F4AlLP065717@repo.freebsd.org> References: <201604150410.u3F4AlLP065717@repo.freebsd.org> Date: Fri, 15 Apr 2016 12:37:55 +0800 Message-ID: Subject: Re: svn commit: r298033 - head/usr.sbin/tzsetup From: Marcelo Araujo To: Marcelo Araujo Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2016 04:37:56 -0000 2016-04-15 12:10 GMT+08:00 Marcelo Araujo : > Author: araujo > Date: Fri Apr 15 04:10:47 2016 > New Revision: 298033 > URL: https://svnweb.freebsd.org/changeset/base/298033 > > Log: > Use NULL instead of 0 for pointers. > > fgetln(3) will returns NULL if cannot get a line from a stream. > strsep(3) it will returns NULL if the end of the string was reached. > jemalloc(3) malloc will returns NULL if it cannot allocate memory. > fgetln(3) it will returns NULL if it cannot get a line from a stream. > This last line (fgetln(3)) must be strchr(3) and it will return NULL if the character does not appear in the string. > > MFC after: 4 weeks > > Modified: > head/usr.sbin/tzsetup/tzsetup.c > > Modified: head/usr.sbin/tzsetup/tzsetup.c > > ============================================================================== > --- head/usr.sbin/tzsetup/tzsetup.c Fri Apr 15 03:50:33 2016 > (r298032) > +++ head/usr.sbin/tzsetup/tzsetup.c Fri Apr 15 04:10:47 2016 > (r298033) > @@ -344,7 +344,7 @@ read_iso3166_table(void) > err(1, "%s", path_iso3166); > lineno = 0; > > - while ((s = fgetln(fp, &len)) != 0) { > + while ((s = fgetln(fp, &len)) != NULL) { > lineno++; > if (s[len - 1] != '\n') > errx(1, "%s:%d: invalid format", path_iso3166, > lineno); > @@ -354,7 +354,7 @@ read_iso3166_table(void) > > /* Isolate the two-letter code. */ > t = strsep(&s, "\t"); > - if (t == 0 || strlen(t) != 2) > + if (t == NULL || strlen(t) != 2) > errx(1, "%s:%d: invalid format", path_iso3166, > lineno); > if (t[0] < 'A' || t[0] > 'Z' || t[1] < 'A' || t[1] > 'Z') > errx(1, "%s:%d: invalid code `%s'", path_iso3166, > @@ -362,10 +362,10 @@ read_iso3166_table(void) > > /* Now skip past the three-letter and numeric codes. */ > name = strsep(&s, "\t"); /* 3-let */ > - if (name == 0 || strlen(name) != 3) > + if (name == NULL || strlen(name) != 3) > errx(1, "%s:%d: invalid format", path_iso3166, > lineno); > name = strsep(&s, "\t"); /* numeric */ > - if (name == 0 || strlen(name) != 3) > + if (name == NULL || strlen(name) != 3) > errx(1, "%s:%d: invalid format", path_iso3166, > lineno); > > name = s; > @@ -407,7 +407,7 @@ add_zone_to_country(int lineno, const ch > path_zonetab, lineno); > > zp = malloc(sizeof(*zp)); > - if (zp == 0) > + if (zp == NULL) > errx(1, "malloc(%zu)", sizeof(*zp)); > > if (cp->nzones == 0) > @@ -483,7 +483,7 @@ read_zones(void) > err(1, "%s", path_zonetab); > lineno = 0; > > - while ((line = fgetln(fp, &len)) != 0) { > + while ((line = fgetln(fp, &len)) != NULL) { > lineno++; > if (line[len - 1] != '\n') > errx(1, "%s:%d: invalid format", path_zonetab, > lineno); > @@ -498,7 +498,7 @@ read_zones(void) > /* coord = */ strsep(&line, "\t"); /* Unused */ > file = strsep(&line, "\t"); > p = strchr(file, '/'); > - if (p == 0) > + if (p == NULL) > errx(1, "%s:%d: invalid zone name `%s'", > path_zonetab, > lineno, file); > contbuf[0] = '\0'; > @@ -558,7 +558,7 @@ make_menus(void) > continent_names[i].continent->menu = > malloc(sizeof(dialogMenuItem) * > continent_names[i].continent->nitems); > - if (continent_names[i].continent->menu == 0) > + if (continent_names[i].continent->menu == NULL) > errx(1, "malloc for continent menu"); > continent_names[i].continent->nitems = 0; > continents[i].prompt = continent_items[i].prompt; > > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_)