Closed Bug 81758 Opened 23 years ago Closed 23 years ago

Excessive use of strlen [form sub]

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: drepper, Assigned: john)

References

Details

(Keywords: perf)

Attachments

(1 file)

The file layout/html/forms/src/nsFormFrame.cpp contains a lot of calls to the function PL_strlen() which are unnecessary. If these calls would be to strlen() instead expressions like strlen("FOO") would be optimized by the compiler to the constant 3. But since PL_strlen is used this cannot happen. I'll attach a patch which replaces these uses of PL_strlen() with uses of sizeof. sizeof is already used in some places in this file so the concept is not new. There is one more little patch included: one sprintf() call included in the parameter list a string constant. Instead of doing this simply use the string concatenation feature of the compiler which is in the same sprintf() call already done with the macro CRLF.
Keywords: patch, perf
This is all eric's code and he is doing some modifications to submits - reassigning
Assignee: rods → pollmann
Target Milestone: --- → mozilla1.0
Blocks: 71874
Looks good to me. I say drop it in if the patch hasn't bit-rotted.
Bulk reassigning form bugs to Alex
Assignee: pollmann → alexsavulov
Summary: Excessive use of strlen → Excessive use of strlen [form sub]
s/strlen/sizeof :)
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
don't move bugs that are in the 1.0 dependency tree. sorry.
Target Milestone: mozilla1.0.1 → mozilla1.0
Reassigning to John. Moved to Moz1.1
Assignee: alexsavulov → jkeiser
Target Milestone: mozilla1.0 → mozilla1.1
This *will* be fixed in bug 120682. Lengths are calculated after everything is concatenated together rather than in a big ol' separate loop. I just did a search on "strlen" in the code and found nothing, in fact.
Depends on: 120682
Target Milestone: mozilla1.1 → mozilla0.9.9
Marking nsbeta1+
Keywords: nsbeta1+
Checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
verifying according to comment #9 ("I just did a search on "strlen" in the code and found nothing, in fact.")
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: