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 13793 invoked from network); 1 Oct 2020 02:35:45 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 1 Oct 2020 02:35:45 -0000 Received: (qmail 13837 invoked by uid 550); 1 Oct 2020 02:35:41 -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 13815 invoked from network); 1 Oct 2020 02:35:41 -0000 Date: Wed, 30 Sep 2020 22:35:29 -0400 From: Rich Felker To: ell1e Cc: musl@lists.openwall.com Message-ID: <20201001023528.GM17637@brightrain.aerifal.cx> References: <47f2d2dc-0f18-5d86-8206-1196502b60e0@wobble.ninja> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47f2d2dc-0f18-5d86-8206-1196502b60e0@wobble.ninja> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] Would it to be possible to get strtoll_l? On Thu, Oct 01, 2020 at 02:34:47AM +0200, ell1e wrote: > Hi everyone, > > I'm working on a project and since the global state setlocale() seems to > be a bit of a mess to rely on, I'm using the *_l() string functions > instead. However, musl libc appears to lack strtoll_l() right now, so > I'm wondering if that'll be added any time soon? The portable way to do this is just calling uselocale() rather than passing the locale_t to individual *_l functions. You can even implement a fallback strtoll_l as: localt_t old = uselocale(l); result = strtoll(a,b,c); uselocale(old); It's slightly more efficient if you keep the uselocale across multiple calls, but not that big a deal; uselocale is an extremely light operation. But is there a reason you don't just want plain strtoll? C allows that "additional locale-specific subject sequence forms may be accepted" in locales other than the C locale, but does not permit standard sequences to be interpreted differently, and in practice I'm not aware of implementations that do anything funny here. Rich