From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2174 Path: news.gmane.org!not-for-mail From: Abdoulaye Walsimou GAYE Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 3/4] Import BSD functions defined in from NetBSD Date: Sun, 21 Oct 2012 02:52:21 +0200 Message-ID: <50834745.7090307@embtoolkit.org> References: <1350764145-10305-1-git-send-email-awg@embtoolkit.org> <1350764145-10305-4-git-send-email-awg@embtoolkit.org> <5083450C.4070701@barfooze.de> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1350780751 9788 80.91.229.3 (21 Oct 2012 00:52:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 21 Oct 2012 00:52:31 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2175-gllmg-musl=m.gmane.org@lists.openwall.com Sun Oct 21 02:52:39 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TPjmO-0002s9-6g for gllmg-musl@plane.gmane.org; Sun, 21 Oct 2012 02:52:36 +0200 Original-Received: (qmail 1422 invoked by uid 550); 21 Oct 2012 00:52:28 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 1413 invoked from network); 21 Oct 2012 00:52:28 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 In-Reply-To: <5083450C.4070701@barfooze.de> Xref: news.gmane.org gmane.linux.lib.musl.general:2174 Archived-At: On 10/21/2012 02:42 AM, John Spencer wrote: > On 10/20/2012 10:15 PM, Abdoulaye Walsimou Gaye wrote: >> +/* >> + * ether_aton(): >> + * This function converts an ASCII string of the same form and to a structure >> + * containing the 6 octets of the address. It returns a pointer to a >> + * static structure that is reused for each call. >> + */ >> +struct ether_addr *ether_aton(const char *s) >> +{ >> + static struct ether_addr n; >> + unsigned int i[6]; >> + >> + assert(s != NULL); >> + >> + if (sscanf(s, " %x:%x:%x:%x:%x:%x ",&i[0],&i[1], >> + &i[2],&i[3],&i[4],&i[5]) == 6) { >> + n.ether_addr_octet[0] = (unsigned char)i[0]; >> + n.ether_addr_octet[1] = (unsigned char)i[1]; >> + n.ether_addr_octet[2] = (unsigned char)i[2]; >> + n.ether_addr_octet[3] = (unsigned char)i[3]; >> + n.ether_addr_octet[4] = (unsigned char)i[4]; >> + n.ether_addr_octet[5] = (unsigned char)i[5]; >> + return&n; >> + } >> + return NULL; >> +} > > why do you duplicate the code and not use simply the _r functions from [4/4] with the static buffer ? > btw the usage of sscanf is both bloated and slow. This was for record of the original code from NetBSD, before patching it in [4/4] > > anyway, i doubt it makes sense to add this crap; i never needed it for sabotage which is almost feature complete and compiles 250 packages. I can not argue with this kind of comments. Cheers, AWG