From: Rob Hoelz Date: Wed, 27 Mar 2013 23:06:31 GMT Subject: Re: [PATCH] push: Alias pushurl from push rewrites Message-ID: <20130327180631.6a1a7a47@hoelz.ro> In-Reply-To: <20130327225656.GK28148@google.com> On Wed, 27 Mar 2013 15:56:56 -0700 Jonathan Nieder wrote: > Rob Hoelz wrote: > > > My mistake; I had not seen it! I thought you may have found a bug > > in my implementation, so I wanted to double check. =) > > Well, I had found an unfortunate consequence of the implementation > that uses an unnecessary copy. :) > > Will follow up to the updated patch. > I actually wanted to talk about the copy thing. I realize that this could have been avoided by simply saving a pointer to the old string and performing a comparison, but I figured if the implementation for alias_url were changed in the future to use realloc or something, it could potentially return the original char * with its contents altered. So, by copying the string, we can avoid strange bugs in the future. -Rob