Re: How to create a GUID?
Re: How to create a GUID?
- Subject: Re: How to create a GUID?
- From: "Finlay Dobbie" <email@hidden>
- Date: Sun, 7 Sep 2008 00:06:00 +0100
On Sat, Sep 6, 2008 at 10:55 PM, I. Savant <email@hidden> wrote:
> At the bottom of the page, there's this:
>
> - (NSString *)uuid
> {
> CFUUIDRef uuidRef = CFUUIDCreate(NULL);
> CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
> CFRelease(uuidRef);
> NSString *uuid = [NSString stringWithString:(NSString *)
> uuidStringRef];
> CFRelease(uuidStringRef);
> return uuid;
> }
Why the unnecessary copy?
- (NSString *)uuid
{
CFUUIDRef uuidRef = CFUUIDCreate(NULL);
CFStringRef uuidStringRef = CFUUIDCreateString(NULL, uuidRef);
CFRelease(uuidRef);
return [(NSString *)uuidStringRef autorelease];
}
-- Finlay
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden