zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint@zdharma.org>
To: Bart Schaefer <schaefer@brasslantern.com>, zsh-workers@zsh.org
Subject: Re: Return value from execstring(), or construct Options for a builtin?
Date: Fri, 9 Jun 2017 10:53:19 +0200	[thread overview]
Message-ID: <etPan.593a61ff.6b8b4567.6435@MacMini.local> (raw)
In-Reply-To: <170608161436.ZM21724@torch.brasslantern.com>

On 9 czerwca 2017 at 01:14:49, Bart Schaefer (schaefer@brasslantern.com) 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.:

https://github.com/zdharma/zredis/commit/8107b50362acb169ce9ad9dc6ce418ccdc96fc4f

> 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


      parent reply	other threads:[~2017-06-09  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 10:20 Sebastian Gniazdowski
2017-06-07 16:11 ` Bart Schaefer
2017-06-08 10:04   ` Sebastian Gniazdowski
2017-06-08 23:14     ` Bart Schaefer
2017-06-08 23:31       ` Bart Schaefer
2017-06-09  8:53       ` Sebastian Gniazdowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=etPan.593a61ff.6b8b4567.6435@MacMini.local \
    --to=psprint@zdharma.org \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).