#3293 closed Enhancement (fixed)
fggets() is overkill for parsing the blocklist
Reported by: | charles | Owned by: | charles |
---|---|---|---|
Priority: | Normal | Milestone: | 2.00 |
Component: | libtransmission | Version: | 1.93 |
Severity: | Normal | Keywords: | performance |
Cc: |
Description
fgets() is faster than fggets(), which uses fgetc() under the covers for every single character, and involves a malloc + free call for each line.
This is unnecessary -- we can preallocate a large enough buffer for any blocklist line. And if a line is longer than (to pick a number out of the air) 2048 characters, then line is corrupt and will be thrown away anyway, so in that situation fggets() still doesn't return any extra value.
Also this is the only place where fggets() is used in libtransmission, so we could also remove ggets.[ch].
Attachments (1)
Change History (4)
Changed 13 years ago by charles
comment:1 Changed 13 years ago by charles
- Milestone changed from 2.10 to 2.00
- Status changed from new to assigned
comment:2 Changed 13 years ago by charles
- Resolution set to fixed
- Status changed from assigned to closed
comment:3 Changed 13 years ago by charles
- Keywords performance added
Note: See
TracTickets for help on using
tickets.
patch applied to trunk by r10754.