Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Return value from execstring(), or construct Options for a builtin?

On 9 czerwca 2017 at 01:14:49, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> I would suggest creating a hash table object in db.c whose keys are the
> strings passed to "ztie -d" and whose values are structs containing a
> DbBackendEntryPoint pointer. Then provide callable routines that
> can be invoked from the db module setup_ / cleanup_ functions to
> add/remove an entry point.

Done it. I was following curses.c because it has hash table for colorpairs. Now the arrays {zgdbm,zredis}_tied aren't searched to get backend type of given tied parameter. Instead, DB_IS_TIED is invoked on each backend, via hash table scanning. Tests are passing (like yesterday). The diff is quite nice to look at, because it replaces multiple ifs with gethashnode2, etc.:


> Forgot to mention that this also provides an obvious hook for getting a
> list of which databases are available, in case a script is interested.

It will also allow user to assure he loaded the modules correctly. Presence in `zmodload` output can be misleading in case of doing loads and unloads without care.

Sebastian Gniazdowski
psprint /at/ zdharma.org

Messages sorted by: Reverse Date, Date, Thread, Author