From owner-svn-src-projects@freebsd.org Mon May 20 20:51:05 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBB8B159229A for ; Mon, 20 May 2019 20:51:05 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFB8391EDF; Mon, 20 May 2019 20:51:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x4KKovtp002036 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 20 May 2019 23:51:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x4KKovtp002036 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x4KKovZC002035; Mon, 20 May 2019 23:50:57 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 20 May 2019 23:50:57 +0300 From: Konstantin Belousov To: Alan Somers Cc: src-committers , svn-src-projects@freebsd.org Subject: Re: svn commit: r348007 - projects/fuse2/lib/libc/gen Message-ID: <20190520205057.GU2748@kib.kiev.ua> References: <201905201936.x4KJaaIC023310@repo.freebsd.org> <20190520202210.GT2748@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 20:51:05 -0000 On Mon, May 20, 2019 at 02:43:36PM -0600, Alan Somers wrote: > On Mon, May 20, 2019 at 2:22 PM Konstantin Belousov wrote: > > > > On Mon, May 20, 2019 at 07:36:36PM +0000, Alan Somers wrote: > > > +static bool > > > +are_fusefs(const char *fsname, const char *vfc_name) > > > +{ > > > + const char fusefs[] = "fusefs"; > > > + const char fusefs_dot[] = "fusefs."; > > Both arrays should be static. > > Ok. > > > > > > + > > > + return (strncmp(fsname, fusefs_dot, strlen(fusefs_dot)) == 0 && > > strlen() is not needed, you can use sizeof() - 1. > > > > > + strcmp(fusefs, vfc_name) == 0); > > > +} > > True, but I though that strlen would be more readable. Clang is smart > enough to realize that strlen's argument is a constant and omit the > call to strlen, so that's what I went with. Is there any other reason > to prefer sizeof() - 1 ? The reason is that it would also work for not so smart compiler, or with a smart compiler after we finally turn on -ffreestanding for libc, as it ought to be.