Re: Creating NSStrings without copying memory

2017-05-02 Thread Ken Thomases
On May 2, 2017, at 3:11 PM, Jens Alfke wrote: > > I’ve got a heap block containing many UTF-8 strings, and I’m looking for the > cheapest way to create NSString objects from them, i.e. without copying all > the characters. > > -initWithBytesNoCopy:length:freeWhenDone: would be perfect, except

Re: Creating NSStrings without copying memory

2017-05-02 Thread Jens Alfke
> On May 2, 2017, at 1:42 PM, Mike Abdullah wrote: > > Drop down to CFString. It has similar api to the NSData one you like. Oh, you mean CFStringCreateWithBytesNoCopy? You’re right, I can use that the same way. I was being fixated on something that takes a block, and didn’t realize that (wit

Re: Creating NSStrings without copying memory

2017-05-02 Thread Mike Abdullah
Drop down to CFString. It has similar api to the NSData one you like. Mike. Sent from my iPhone > On 2 May 2017, at 22:11, Jens Alfke wrote: > > I’ve got a heap block containing many UTF-8 strings, and I’m looking for the > cheapest way to create NSString objects from them, i.e. without copyi

Creating NSStrings without copying memory

2017-05-02 Thread Jens Alfke
I’ve got a heap block containing many UTF-8 strings, and I’m looking for the cheapest way to create NSString objects from them, i.e. without copying all the characters. -initWithBytesNoCopy:length:freeWhenDone: would be perfect, except that the string bytes are not an individual malloc block (s