On 2010-08-24 12:25, bearophile wrote:
Walter Bright:
elf_findstr definitely looks like a problem area. I can't look at it right now,
so can you post this to bugzilla please?

I am able to find two versions of elf_findstr, one in elfobj.c and one in 
machobj.c, so it may be possible to remove one of them.

As the files indicate elfobj.c is for generating ELF (linux) object files and machobj.c is for generating Mach-O (osx) object files, both are needed. I guess he uses the same name for the functions to have a uniform interface, no need to change the code on the calling side.

Its docstring doesn't seem to show the 'suffix' argument.

I have seen that it performs strlen() of str and suffix at the beginning, so 
using fat pointers (C structs that keep ptr + len) as D may be enough to avoid 
those strelen calls and save some time.

 From what I see it seems to perform a linear search inside an Outbuffer, 
something like a search of strtab~strs inside an array of strings, so the 
structure may be replaced by an associative set or ordered set lookup instead.

Bye,
bearophile


--
/Jacob Carlborg

Reply via email to