Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 21 Oct 2012 02:52:21 +0200
From: Abdoulaye Walsimou GAYE <awg@...toolkit.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 3/4] Import BSD functions defined in <netinet/ether.h>
 from NetBSD

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.