]> git.pond.sub.org Git - empserver/commit
nsc filetable: Get rid of untidy use of PACKAGE_STRING
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 26 Jun 2016 06:42:57 +0000 (08:42 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:17 +0000 (20:09 +0200)
commitb4b65f0c35408e9554192f79b569e62753d78f99
treec1ff206ffb76f7835001a8cfbf814815f33abab3
parent89a06ec2d4fcf4999bcfc3eada947ee6893e314e
nsc filetable: Get rid of untidy use of PACKAGE_STRING

Table version selector version shows the version string stored in
version[].  Its implementation is a bit of a hack:
empfile[EF_VERSION].cache is set to version[], so it gets passed as
context object to nstr_eval().  This permits reading version[] with an
NSC_STRINGY selector at offset 0, which is what nsc_init()'s
version_ca0 is.

Both empfile[] and version_ca need the size of version[].  Since
version.h provides only an incomplete type for version[], they use
sizeof(PACKAGE_STRING), which isn't exactly clean.

Redo version_ca0 as virtual selector.  Takes a bit more code, but it's
easier to understand.

The context object is now unused.  Setting empfile[EF_VERSION].cache
to a null pointer would trip assertions, so make it point to a dummy.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/common/filetable.c
src/lib/common/nsc.c