• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NSMutableData resetDataRangeTo:(NSRange)range];
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSMutableData resetDataRangeTo:(NSRange)range];


  • Subject: Re: [NSMutableData resetDataRangeTo:(NSRange)range];
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 14 Jul 2014 16:32:25 -0700

On Jul 14, 2014, at 1:07 PM, Carl Hoefs <email@hidden> wrote:

>     modifiableData = [ NSMutableData dataWithData: [ external call that gives me an NSData ] ];

It’s shorter and more idiomatic to just say
	modifiableData = [external mutableCopy];
(plus an autorelease if you’re not using ARC)

> Will get it working first, and if there's a performance panic, perhaps something can be done (but I extremely doubt it).


Well, the most optimal thing to do would be to create an empty NSMutableData of the correct size, then use memcpy to copy in the correct pieces from the original NSData and whatever other sources there are. That will save you some unnecessary copies and possibly realloc calls.

—Jens
_______________________________________________

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


  • Follow-Ups:
    • Re: [NSMutableData resetDataRangeTo:(NSRange)range];
      • From: Mike Abdullah <email@hidden>
References: 
 >[NSMutableData resetDataRangeTo:(NSRange)range]; (From: Carl Hoefs <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Matt Gough <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Carl Hoefs <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Mike Abdullah <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Carl Hoefs <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Ben Kennedy <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Carl Hoefs <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Jens Alfke <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Carl Hoefs <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Jens Alfke <email@hidden>)
 >Re: [NSMutableData resetDataRangeTo:(NSRange)range]; (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Re: [NSMutableData resetDataRangeTo:(NSRange)range];
  • Next by Date: Re: [NSMutableData resetDataRangeTo:(NSRange)range];
  • Previous by thread: Re: [NSMutableData resetDataRangeTo:(NSRange)range];
  • Next by thread: Re: [NSMutableData resetDataRangeTo:(NSRange)range];
  • Index(es):
    • Date
    • Thread