Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 21 Aug 2013 12:36:45 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: SUN_LEN

On Wed, Aug 21, 2013 at 06:34:29PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@...ifal.cx> [2013-08-21 12:23:39 -0400]:
> > > #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
> > > #define SUN_LEN(s) (sizeof *(s) - sizeof (s)->sun_path + strlen((s)->sun_path))
> > > #endif
> > 
> > This is insufficient, since sys/un.h does not expose strlen. We could
> > either add a conditional declaration of strlen under this #if, or make
> > an inline function for SUN_LEN that just does the strlen-like loop
> > manually. I'm not sure what's best.
> 
> declare strlen
> 
> but i would not worry about this much, if you use such a
> macro you are already outside the well-defined zone..
> and musl does not need to be nice there

Declaring strlen is not easy because size_t is not defined. So I guess
we also need an additional #if before including bits/alltypes.h to
define __NEED_size_t...

This is why I thought a function might be less ugly.

Rich

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.