[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hash: provide hash_xinitialize
From: |
Bruno Haible |
Subject: |
Re: hash: provide hash_xinitialize |
Date: |
Mon, 09 Sep 2019 16:05:42 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-159-generic; KDE/5.18.0; x86_64; ; ) |
Hi Akim,
> * modules/hash (Depends-on): Add xalloc.
> * lib/hash.h, lib/hash.c (hash_xinitialize): New.
This patch produces gnulib-tool warnings:
$ ./gnulib-tool --test hash
gnulib-tool: warning: module hash depends on a module with an incompatible
license: error
gnulib-tool: warning: module hash depends on a module with an incompatible
license: getprogname
gnulib-tool: warning: module hash depends on a module with an incompatible
license: xalloc
gnulib-tool: warning: module hash depends on a module with an incompatible
license: xalloc-die
...
What gnulib-tool is telling you is that the module 'hash' has a license
that makes it suitable for use in libraries. Adding a dependency to 'xalloc'
to it can't be done in this module, because library code should never
call xalloc_die().
The fix is to create a new module, with prefix 'x', that adds the
function. You can leave it declared in hash.h; this is not a problem.
But it needs to be defined in a different compilation unit.
For a model of this idiom, look at the modules 'concat-filename'
and 'xconcat-filename'.
Bruno