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 31841 invoked from network); 23 Aug 2020 08:24:59 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 23 Aug 2020 08:24:59 -0000 Received: (qmail 15507 invoked by uid 550); 23 Aug 2020 08:24:52 -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 15477 invoked from network); 23 Aug 2020 08:24:52 -0000 X-IronPort-AV: E=Sophos;i="5.76,344,1592863200"; d="scan'208";a="464357335" Date: Sun, 23 Aug 2020 10:24:39 +0200 From: Jens Gustedt To: musl@lists.openwall.com Message-ID: <20200823102439.2bbaffb5@inria.fr> Organization: inria.fr X-Mailer: Claws Mail 3.17.5git22 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAACRQTFRFERslNjAsLTE9Ok9wUk9TaUs8iWhSrYZkj42Rz6aD3sGZ MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/nuk=Nz_Rb/kU4OMos3h=Nuq"; protocol="application/pgp-signature"; micalg=pgp-sha1 Subject: [musl] direct coding of asctime_r --Sig_/nuk=Nz_Rb/kU4OMos3h=Nuq Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello, I don't know if you guys noticed, but sometime ago we voted some of the ..._r functions from into the C standard, just to then discover that POSIX has deprecated the whole set of functions and proposes to replace them by `strftime`. One of the arguments to keep them, was that `asctime_r` does not need access to locale and has a fixed format, and so can be implemented with a much smaller footprint. Looking into musl I found that the current implementation is basically doing verbatim what the C standard says, namely uses `snprintf` under the hood to do the formatting. This has obviously the disadvantage that this drags the whole infrastructure that is needed for `snprintf` into the executable. Making some tests, I found that coding `asctime_r` straight forward with byte-copying has it shave off about 10k from the final executable. Would it be interesting for musl to change to such an implementation? Shall I prepare a patch to do so? Jens --=20 :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS ::: :: ::::::::::::::: office Strasbourg : +33 368854536 :: :: :::::::::::::::::::::: gsm France : +33 651400183 :: :: ::::::::::::::: gsm international : +49 15737185122 :: :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt :: --Sig_/nuk=Nz_Rb/kU4OMos3h=Nuq Content-Type: application/pgp-signature Content-Description: Digitale Signatur von OpenPGP -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSN9stI2OFN1pLljN0P0+hp2tU34gUCX0InyAAKCRAP0+hp2tU3 4qZqAJ9cFzStzW3QqYXSNp2+660pq6HZuACfeX0TnC+piIfVsM92ivXg0CleG5I= =qBi5 -----END PGP SIGNATURE----- --Sig_/nuk=Nz_Rb/kU4OMos3h=Nuq--