[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 0/1] Reduce footprint of xstrtol module
From: |
Pino Toscano |
Subject: |
[PATCH 0/1] Reduce footprint of xstrtol module |
Date: |
Thu, 5 Dec 2019 16:18:34 +0100 |
Hi,
I noticed that using the xstrtol (or any of the other xstrto* modules
using it) drags a lot of other gnulib modules, 39 more to be exact
including dirname-lgpl, error, errno, getopt-gnu, msvc-*, etc.
The reason for this are:
- xstrtol.h includes getopt.h, which in turns requires getopt-gnu, etc
- it includes a xstrtol_fatal function(), that requires the
aforementioned getopt, plus gettext (for N_()), error, errno, etc
Since xstrtol_fatal() is only useful if you
- use getopt directly
- use xstrtol_fatal() to error out directly on xstro* failures
(so only in application, not in libraries)
I decided to move xstrtol_fatal() to an own xstrtol-error module.
This has the nice advantage to reduce the footprint a lot, reducing to
12 (yes!) the modules used. There are only two potential downsides:
1) users of the xstro* modules may use xstrtol_fatal() right now
2) some of the indirectly modules no more required can affect the
results of configure checks (for example the extensions module is no
more used)
I do not think they are big issues though:
(1) can be easily solved by using the new xstrtol-error module, and
including xstrtol-error.h where xstrtol_fatal() is used; I checked
on the Debian Code Search [1], and only coreutils and findutils use
it
(2) is somehow more tricky to check, however I think if you really
need extension (or any module) then you ought to explicitly use;
I know, reality is different, however give how gnulib is used people
can still determine that on their own
[1] https://codesearch.debian.net/
Thanks,
Pino Toscano (1):
Move xstrtol_fatal to a new xstrtol-error module
ChangeLog | 16 +++++++++++++++
MODULES.html.sh | 1 +
NEWS | 6 ++++++
lib/xstrtol-error.c | 2 +-
lib/xstrtol-error.h | 45 +++++++++++++++++++++++++++++++++++++++++++
lib/xstrtol.h | 20 -------------------
modules/xstrtol | 7 +------
modules/xstrtol-error | 27 ++++++++++++++++++++++++++
modules/xstrtol-tests | 1 +
tests/test-xstrtol.c | 2 +-
10 files changed, 99 insertions(+), 28 deletions(-)
create mode 100644 lib/xstrtol-error.h
create mode 100644 modules/xstrtol-error
--
2.21.0
- [PATCH 0/1] Reduce footprint of xstrtol module,
Pino Toscano <=