Bug 72387

Summary: Remove useless const modifier from KURL::init
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: WebCore Misc.Assignee: David Kilzer (:ddkilzer) <ddkilzer>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, koivisto, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 71921    
Bug Blocks:    
Attachments:
Description Flags
Patch v1 none

Description David Kilzer (:ddkilzer) 2011-11-15 07:55:43 PST
Follow-up to Bug 71921 Comment #17.
Comment 1 David Kilzer (:ddkilzer) 2011-11-15 08:06:36 PST
Created attachment 115168 [details]
Patch v1
Comment 2 Andreas Kling 2011-11-15 08:45:02 PST
Comment on attachment 115168 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=115168&action=review

> Source/WebCore/platform/KURL.cpp:489
> -                const char* bufferStart = bufferPos;
> +                char* bufferStart = bufferPos;

Why is this const useless but the ones further down (baseString, baseStringStart, pathStart, baseStringEnd, relStringStart, relStringPos) aren't?
Comment 3 David Kilzer (:ddkilzer) 2011-11-15 08:52:40 PST
(In reply to comment #2)
> (From update of attachment 115168 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=115168&action=review
> 
> > Source/WebCore/platform/KURL.cpp:489
> > -                const char* bufferStart = bufferPos;
> > +                char* bufferStart = bufferPos;
> 
> Why is this const useless but the ones further down (baseString, baseStringStart, pathStart, baseStringEnd, relStringStart, relStringPos) aren't?

Per Darin's statement in Bug 71921 Comment #17, they would be useless as well.  This patch was only to remove the useless 'const' modifier I added for Bug 71921, but I can remove the rest if that's what the consensus is.
Comment 4 Darin Adler 2011-11-15 10:14:32 PST
We use const char* all the time, and I did not mean to imply that was useless. I am not saying that the const keyword is useless, just that making actual local variables const is not something we do in most WebKit code. Not the characters that a local variable points to, the local variable itself.
Comment 5 Darin Adler 2011-11-15 10:15:49 PST
Comment on attachment 115168 [details]
Patch v1

Given that this is a pointer into a buffer of non-const characters, I think it's fine for it to be char*, even though I did not mean to claim this was useless at all!
Comment 6 WebKit Review Bot 2011-11-15 11:16:57 PST
Comment on attachment 115168 [details]
Patch v1

Clearing flags on attachment: 115168

Committed r100298: <http://trac.webkit.org/changeset/100298>
Comment 7 WebKit Review Bot 2011-11-15 11:17:01 PST
All reviewed patches have been landed.  Closing bug.