Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 12 Apr 2012 18:45:22 -0700
From: Isaac Dunham <>
Subject: [PATCH] string.h, _BSD_SOURCE, and *index()

I was working on _BSD_SOURCE for string.h.
Warning: several of the functions are mislabeled as _GNU_SOURCE in the
Everything in strings.h should be available if _GNU_SOURCE ||
BSD_SOURCE is defined and  string.h is included.
Actually, that's slightly an oversimplification-there are two
functions (*_l) that should be _GNU_SOURCE only.

(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?

There are two patches attached: the first (string.diff) will define
everything from strings.h if defined _BSD_SOURCE || _GNU_SOURCE
The second patch (rindex.diff) applies the second change, but does not
remove (r)index.c, to prevent ABI breakage.

Isaac Dunham

View attachment "string.diff" of type "text/x-patch" (2056 bytes)

View attachment "index.diff" of type "text/x-patch" (929 bytes)

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.