FWIW Pavel's original suggestion (which I missed in my original response) appears pretty easy to do. All the called function does is to do a case insensitive string compare, which StringRef contains a method for. So it seems easy to change that function to take a StringRef, which is better than any of the other suggestions proposed anyway.
On Mon Feb 23 2015 at 2:16:57 PM Vince Harron <[email protected]> wrote: > Hi all, > > We can't assume StringRef is null terminated, ever. > > Vince > On Feb 23, 2015 4:48 PM, "Joerg Sonnenberger" <[email protected]> > wrote: > >> On Mon, Feb 23, 2015 at 05:31:50PM +0000, Zachary Turner wrote: >> > How so? Suppose you've got a function which takes a const char*. >> Obviously >> > it's null terminated or your function wouldn't be able to work. If you >> > replace that with a StringRef it's still null terminated because the >> call >> > site hasn't changed. Either way, its up to the caller to pass something >> > null terminated. >> > >> > Any time you construct a StringRef from a std::string or ConstString, >> which >> > is very close to 100% of what we do, the StringRef is guaranteed to be >> null >> > terminated. >> >> But StringRef is normally a part of either a std::string or const char *. >> While there might be a null byte somewhere, it has no relation to the >> size of the string referenced by StringRef. The point is that accessing >> the data of a StringRef doesn't give a null terminated string of the >> same size as the StringRef, if at all. >> >> Joerg >> > _______________________________________________ >> lldb-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >> >
_______________________________________________ lldb-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
