From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/3944 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: SUN_LEN Date: Wed, 21 Aug 2013 19:00:36 +0200 Message-ID: <20130821170036.GF30088@port70.net> References: <5214AC94.9090408@barfooze.de> <5214B4CF.4090202@barfooze.de> <20130821144552.GD30088@port70.net> <20130821162339.GY20515@brightrain.aerifal.cx> <20130821163428.GE30088@port70.net> <20130821163645.GZ20515@brightrain.aerifal.cx> <20130821164220.GA20515@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1377104446 29936 80.91.229.3 (21 Aug 2013 17:00:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 21 Aug 2013 17:00:46 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-3948-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 21 19:00:49 2013 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 1VCBm4-0000fS-Fk for gllmg-musl@plane.gmane.org; Wed, 21 Aug 2013 19:00:48 +0200 Original-Received: (qmail 20145 invoked by uid 550); 21 Aug 2013 17:00:48 -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 20137 invoked from network); 21 Aug 2013 17:00:47 -0000 Content-Disposition: inline In-Reply-To: <20130821164220.GA20515@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:3944 Archived-At: * Rich Felker [2013-08-21 12:42:20 -0400]: > > 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. > > Here's a sketch of what it could be: > > static __inline unsigned long __SUN_LEN(struct sockaddr_un *__s) > { > unsigned long __i; > for (__i=0; __s->sun_path[__i]; __i++); > return __i+2; > } > #define SUN_LEN(s) __SUN_LEN(s) you could include stddef.h, but this works as well