<div dir="ltr">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.<br></div><br><div class="gmail_quote">On Mon Feb 23 2015 at 2:16:57 PM Vince Harron <<a href="mailto:vharron@google.com">vharron@google.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hi all,</p>
<p dir="ltr">We can't assume StringRef is null terminated, ever.</p>
<p dir="ltr">Vince<br>
</p>
<div class="gmail_quote">On Feb 23, 2015 4:48 PM, "Joerg Sonnenberger" <<a href="mailto:joerg@britannica.bec.de" target="_blank">joerg@britannica.bec.de</a>> wrote:<br type="attribution"></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Feb 23, 2015 at 05:31:50PM +0000, Zachary Turner wrote:<br>
> How so? Suppose you've got a function which takes a const char*. Obviously<br>
> it's null terminated or your function wouldn't be able to work. If you<br>
> replace that with a StringRef it's still null terminated because the call<br>
> site hasn't changed. Either way, its up to the caller to pass something<br>
> null terminated.<br>
><br>
> Any time you construct a StringRef from a std::string or ConstString, which<br>
> is very close to 100% of what we do, the StringRef is guaranteed to be null<br>
> terminated.<br>
<br>
But StringRef is normally a part of either a std::string or const char *.<br>
While there might be a null byte somewhere, it has no relation to the<br>
size of the string referenced by StringRef. The point is that accessing<br>
the data of a StringRef doesn't give a null terminated string of the<br>
same size as the StringRef, if at all.<br>
<br>
Joerg<br></blockquote></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
</blockquote></div></blockquote></div>