|
Message-ID: <20120413033013.GH7281@brightrain.aerifal.cx> Date: Thu, 12 Apr 2012 23:30:13 -0400 From: Rich Felker <dalias@...ifal.cx> To: musl@...ts.openwall.com Subject: Re: [PATCH] string.h, _BSD_SOURCE, and *index() On Thu, Apr 12, 2012 at 06:45:22PM -0700, Isaac Dunham wrote: > I was working on _BSD_SOURCE for string.h. > Warning: several of the functions are mislabeled as _GNU_SOURCE in the > manpages. > Everything in strings.h should be available if _GNU_SOURCE || > BSD_SOURCE is defined and string.h is included. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) #include <strings.h> #endif Actually I thought that was already there (minus the BSD) but it seems I was mistaken. In any case, I think it's cleaner than duplicating all the prototypes in 2 places. > Actually, that's slightly an oversimplification-there are two > functions (*_l) that should be _GNU_SOURCE only. OK. > (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? Yes. It would also break the API for programs which declare these functions manually rather than using the header (that's more popular than you think), and as your patch is written it's violating the SUSv4 namespace (since these symbols were removed, you can't define them). The advice on using macros is advice for _applications_, not for implementations. The proper fix is just to move the declarations inside _GNU_SOURCE/_BSD_SOURCE. 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.