On Wed, Sep 11, 2002 at 12:50:28PM +0200, Leopold Toetsch wrote:I like this idea. (but I've no idea of the subtle implications)
> The op_code() function in op_lib_t does look up an op_info_table entry
> by the op's full_name. To accomplish this, the current implementation
> builds via ops2c.pl basically a static hash table, which get's appended
> to core_ops.c and core_ops_prederef.c.
> My proposal is: build a hash table at runtime on the first invocation of
Where you thinking of building the hash table in one hit using a linear
parse over the op names the first time a lookup is requested?
An alternative (more complex, may not be worth it) is to perform the hash
Initialise with a flag that says the hash isn't complete, and a pointer at
When somewhere requests a name, look in the hash. If found, good
Resume the linear search using the pointer. Hash everything you pass by
If you find it, good. hash it too, save the new pointer, return the result.
If you hit the end, flag the hash as complete, return failure.
ex::lib::zip is using this approach to scan the directory of the zip file
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.