Closed
Bug 743581
Opened 12 years ago
Closed 12 years ago
Remove nsCRT::strlen(const PRUnichar* s) from nsCRT.h
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
VERIFIED
FIXED
mozilla15
People
(Reporter: kshriram18, Assigned: kshriram18)
References
(Blocks 1 open bug, )
Details
(Keywords: perf)
Attachments
(1 file, 2 obsolete files)
30.74 KB,
patch
|
dougt
:
review+
sgautherie
:
feedback+
|
Details | Diff | Splinter Review |
As per comment #23,24 32,33 and 35, nsCRT::strlen should be removed.
Assignee | ||
Comment 1•12 years ago
|
||
Comments mentioned above are from Bug 150073
Updated•12 years ago
|
Comment 2•12 years ago
|
||
http://mxr.mozilla.org/mozilla-central/source/xpcom/ds/nsCRT.h#182 { 183 static PRUint32 strlen(const PRUnichar* s) { 184 // XXXbsmedberg: remove this null-check at some point 185 if (!s) { 186 NS_ERROR("Passing null to nsCRT::strlen"); 187 return 0; 188 } 189 return NS_strlen(s); 190 } } http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/nsCRTGlue.cpp#103 { 104 PRUint32 105 NS_strlen(const PRUnichar *aString) 106 { 107 const PRUnichar *end; 108 109 for (end = aString; *end; ++end) { 110 // empty loop 111 } 112 113 return end - aString; 114 } } This bug should mostly be as simple as s/nsCRT::strlen/NS_strlen/g... ***** Though I'm a little confused by (for example) http://mxr.mozilla.org/comm-central/source/mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp#536 { 551 char ** wlst; 560 PRInt32 inLength = nsCRT::strlen(wlst[index]); } as I would have expected all remaining calls to have PRUnichar args...
Severity: normal → minor
Target Milestone: mozilla14 → ---
Assignee | ||
Comment 3•12 years ago
|
||
(In reply to Serge Gautherie (:sgautherie) from comment #2) > Though I'm a little confused by (for example) > http://mxr.mozilla.org/comm-central/source/mozilla/extensions/spellcheck/ > hunspell/src/mozHunspell.cpp#536 > { > 551 char ** wlst; > > 560 PRInt32 inLength = nsCRT::strlen(wlst[index]); > } > as I would have expected all remaining calls to have PRUnichar args... Not anymore I guess, unless I'm missing something
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #622771 -
Flags: feedback?(sgautherie.bz)
Attachment #622771 -
Flags: feedback?(doug.turner)
Comment 5•12 years ago
|
||
Comment on attachment 622771 [details] [diff] [review] Patch that removes nsCRT::strlen(const PRUnichar*) Review of attachment 622771 [details] [diff] [review]: ----------------------------------------------------------------- Did this succeed on Try? ::: intl/unicharutil/src/nsSaveAsCharset.cpp @@ +203,5 @@ > > *outString = NULL; > > nsresult rv; > + PRInt32 inStringLength = NS_strlen(inString); // original input string length Keep the comment aligned. ::: layout/base/nsBidi.cpp @@ +280,5 @@ > return NS_ERROR_INVALID_ARG; > } > > if(aLength==-1) { > + aLength=NS_strlen(aText); Add missing spaces. ::: layout/printing/nsPrintEngine.cpp @@ +2416,2 @@ > if (aDoFront) { > + PRUnichar * ptr = &aStr[NS_strlen(aStr)-aLen+3]; Add missing spaces. ::: netwerk/streamconv/converters/mozTXTToHTMLConv.cpp @@ +1093,5 @@ > // sendmail/mbox > // Placed here for performance increase > const PRUnichar * indexString = &line[logLineStart]; > // here, |logLineStart < lineLength| is always true > + PRUint32 minlength = MinInt(6,NS_strlen(indexString)); Add missing spaces. ::: xpcom/ds/nsCRT.h @@ +177,5 @@ > } > * WARNING - STRTOK WHACKS str THE FIRST TIME IT IS CALLED * > * MAKE A COPY OF str IF YOU NEED TO USE IT AFTER strtok() * > */ > + static char* strtok(char* str, const char* delims, char* *newStr); Right, but leave this line alone wrt this bug. ::: xpcom/ds/nsVariant.cpp @@ +442,5 @@ > if(str) > { > if(nsnull == (*(outp++) = (PRUnichar*) > nsMemory::Clone(str, > + (NS_strlen(str)+1)*sizeof(PRUnichar)))) Add missing spaces.
Attachment #622771 -
Flags: review?(doug.turner)
Attachment #622771 -
Flags: feedback?(sgautherie.bz)
Attachment #622771 -
Flags: feedback?(doug.turner)
Attachment #622771 -
Flags: feedback+
Comment 6•12 years ago
|
||
(In reply to Shriram (irc: Mavericks) from comment #3) > (In reply to Serge Gautherie (:sgautherie) from comment #2) > > as I would have expected all remaining calls to have PRUnichar args... > > Not anymore I guess, unless I'm missing something I'm not sure what you meant. Ftr, could you check and list the calls which have not an (obvious) PRUnichar arg?
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Serge Gautherie (:sgautherie) from comment #6) > (In reply to Shriram (irc: Mavericks) from comment #3) > > (In reply to Serge Gautherie (:sgautherie) from comment #2) > > > as I would have expected all remaining calls to have PRUnichar args... > > > > Not anymore I guess, unless I'm missing something > > I'm not sure what you meant. > Ftr, could you check and list the calls which have not an (obvious) > PRUnichar arg? I meant on http://mxr.mozilla.org/comm-central/source/mozilla/extensions/spellcheck/hunspell/src/mozHunspell.cpp#560 it has strlen(wlst[index]) only
Assignee | ||
Comment 8•12 years ago
|
||
I sent it to try before but hit a Try Syntax Error issue. I sent one again for this patch with the following: try: -b do -p all -u all -t none --post-to-bugzilla Bug 743581
Attachment #622771 -
Attachment is obsolete: true
Attachment #622771 -
Flags: review?(doug.turner)
Attachment #623018 -
Flags: feedback?(sgautherie.bz)
Assignee | ||
Comment 9•12 years ago
|
||
So, the try submission's @ https://tbpl.mozilla.org/?tree=Try&rev=9e3a2601d7f5
Assignee | ||
Comment 10•12 years ago
|
||
The latest try submission @ https://tbpl.mozilla.org/?tree=Try&rev=946a73cb71e7
Comment 11•12 years ago
|
||
Comment on attachment 623018 [details] [diff] [review] Patch that removes nsCRT::strlen(const PRUnichar*) (In reply to Shriram (irc: Mavericks) from comment #3) > Not anymore I guess, unless I'm missing something Hum, right: fixed bug bug 150073. Must have been some comm-central (delayed) update artefact :-/ (In reply to Shriram (irc: Mavericks) from comment #9) > https://tbpl.mozilla.org/?tree=Try&rev=9e3a2601d7f5 This run had a failing patch. (In reply to Shriram (irc: Mavericks) from comment #10) > https://tbpl.mozilla.org/?tree=Try&rev=946a73cb71e7 This run succeeded.
Attachment #623018 -
Flags: review?(doug.turner)
Attachment #623018 -
Flags: feedback?(sgautherie.bz)
Attachment #623018 -
Flags: feedback+
Comment 12•12 years ago
|
||
Comment on attachment 623018 [details] [diff] [review] Patch that removes nsCRT::strlen(const PRUnichar*) Oh, this _is_ the failing patch.
Attachment #623018 -
Attachment is obsolete: true
Attachment #623018 -
Flags: review?(doug.turner)
Updated•12 years ago
|
Attachment #623018 -
Flags: review-
Comment 13•12 years ago
|
||
(In reply to Serge Gautherie (:sgautherie) from comment #11) > (In reply to Shriram (irc: Mavericks) from comment #10) > > https://tbpl.mozilla.org/?tree=Try&rev=946a73cb71e7 > > This run succeeded. You sure about that? The Android R3 failures look real (though I don't know if it was an issue with the underlying changeset or the patch itself).
Comment 14•12 years ago
|
||
(In reply to Ryan VanderMeulen from comment #13) > You sure about that? The Android R3 failures look real (though I don't know Ftr, I usually don't care about Android as it has (or used to have?) so many (random) issues. > if it was an issue with the underlying changeset or the patch itself). Try http://hg.mozilla.org/try/rev/946a73cb71e7 was pushed on top of m-c http://hg.mozilla.org/try/rev/654ac86492e8 which ran at https://tbpl.mozilla.org/?rev=654ac86492e8 jford@mozilla.com – Wed May 9 17:27:32 2012 PDT which already had ... bug 754001!
Status: NEW → ASSIGNED
Comment 15•12 years ago
|
||
Good, I was hoping it was something like that. Thanks for confirming. Shriram - looks like you're good to go!
Assignee | ||
Comment 16•12 years ago
|
||
Attachment #625400 -
Flags: review?(doug.turner)
Updated•12 years ago
|
Attachment #625400 -
Flags: review?(doug.turner)
Updated•12 years ago
|
Attachment #625400 -
Flags: feedback+
Updated•12 years ago
|
Attachment #625400 -
Flags: review?(doug.turner) → review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 17•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f2796ce2a175 :-)
Keywords: checkin-needed
Target Milestone: --- → mozilla15
Comment 18•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f2796ce2a175
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 19•12 years ago
|
||
While looking at the diff, I noticed a sub-optimal use of NS_Strlen in nsFilePicker: https://bugzilla.mozilla.org/attachment.cgi?id=625400&action=diff#a/widget/windows/nsFilePicker.cpp_sec1 NS_Strlen is called twice on current within 2 lines when the code can very easily be refactored so that the length of current is captured in an automatic variable. Should this be filed as a separate bug?
Comment 20•12 years ago
|
||
V.Fixed, per MXR search. ***** (In reply to Manoj from comment #19) > Should this be filed as a separate bug? Yes, please.
Status: RESOLVED → VERIFIED
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•