Closed Bug 81593 Opened 23 years ago Closed 23 years ago

inefficient use of strlen

Categories

(SeaMonkey :: Passwords & Permissions, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: drepper, Assigned: morse)

References

Details

Attachments

(1 file)

(I hope the wallet extension falls into this category; if not please let me know.)

During some code inspections I did lately I came across many very inefficient
uses of strlen (or PR_strlen or ...).  They generally fall into two categories:

- use of strlen() to test for empty strings; this could be done better by
  a constant-time test for zero of the first character

- use of strlen() in a loop end test; this is inefficient since the test is
  repeated in every iteration; the compiler cannot see that the result will
  always be the same.


I'll now append a patch which removes these problems in the files in
extensions/wallet/src.  I've tested it lightly.
Keywords: patch, review
Looks fine to me.  Thanks for doing this.

r=morse
sr=blizzard
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.2
a= asa@mozilla.org for checkin to the trunk.
(on behalf of drivers)
Blocks: 83989
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Verified fix checked into lxr.mozilla.org
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: