Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 13 Apr 2012 13:52:27 +1200
From: Andre Renaud <andre@...ewatersys.com>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] string.h, _BSD_SOURCE, and *index()

On Fri, Apr 13, 2012 at 1:45 PM, Isaac Dunham <idunham@...abit.com> wrote:
> (r)index was X/Open legacy, and has been dropped. The Open Group
> recommended using
> #define index(a,b) strchr((a),(b))
> #define rindex(a,b) strrchr((a),(b))
> Which will let us remove two more files if we do it (rindex.c & index.c)
> However, would removing those break the ABI?

I'm curious about this - what is the general consensus on using
#define to do these kind of translations, versus using static inline
functions, such as:
static inline char *index(const char *s, int c) {return strchr(s, c);}
static inline char *rindex(const char *s, int c) {return strrchr(s, c);}

Regards,
Andre

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.