From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26442 invoked from network); 13 Jul 2021 17:40:18 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 13 Jul 2021 17:40:18 -0000 Received: (qmail 12221 invoked by uid 550); 13 Jul 2021 17:40:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 12202 invoked from network); 13 Jul 2021 17:40:15 -0000 Date: Tue, 13 Jul 2021 13:40:03 -0400 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20210713174002.GB13220@brightrain.aerifal.cx> References: <0F84CB3415BB437FBD48B8B81795064E@H270> <20210713154547.GA13220@brightrain.aerifal.cx> <93626619AB0D496E90CFA1DDAF9915FE@H270> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93626619AB0D496E90CFA1DDAF9915FE@H270> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Changes for strcspn(), strspn(), strtok() and strtok_r() On Tue, Jul 13, 2021 at 06:31:12PM +0200, Stefan Kanthak wrote: > Rich Felker wrote: > > > On Tue, Jul 13, 2021 at 02:02:06PM +0200, Stefan Kanthak wrote: > > >> #include > >> > >> char *strtok_r(char *restrict s, const char *restrict sep, char **restrict p) > >> { > >> if (!s && !(s = *p)) return NULL; > >> s += strspn(s, sep); > >> - if (!*s) return *p = 0; > >> + if (!*s) return *p = NULL; > >> *p = s + strcspn(s, sep); > >> if (**p) *(*p)++ = 0; > >> - else *p = 0; > >> + else *p = NULL; > >> return s; > >> } > > > > This is a gratuitous style change in the opposite direction of what's > > preferred in musl. > > Do you REALLY prefer using NULL and 0 in parallel for the null pointer? No, just 0. I didn't see that NULL also appeared above too; most places it appears are just leftovers from really old code.