skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 3e1bbd5d33826c5d7807a051ee22db3452ee4b21
parent ee2aeefa170b9806e719723f94ba933c90a9ae8b
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Fri, 13 Jan 2023 16:30:43 +0000

 Remove stdarg functions from strerr, everything is __VA_ARGS__ now

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
MNEWS | 4+++-
Mpackage/deps.mak | 4----
Msrc/include/skalibs/strerr.h | 5-----
Dsrc/libstddjb/strerr_diel.c | 24------------------------
Dsrc/libstddjb/strerr_dielsys.c | 23-----------------------
Dsrc/libstddjb/strerr_warnl.c | 22----------------------
Dsrc/libstddjb/strerr_warnlsys.c | 22----------------------
7 files changed, 3 insertions(+), 101 deletions(-)

diff --git a/NEWS b/NEWS @@ -5,7 +5,9 @@ In 2.13.0.0 - Bugfixes. - New functions: buffer_timed_put(), buffer_timed_puts(). - - strerr.h revamped. strerr_die, strerr_warn, strerr_diesys, strerr_warnsys removed. + - strerr.h revamped. strerr_die, strerr_warn, strerr_diesys, strerr_warnsys +and all the previous strerr2 macros are now __VA_ARGS__ macros around +strerr_diev() and friends. In 2.12.0.1 diff --git a/package/deps.mak b/package/deps.mak @@ -555,12 +555,8 @@ src/libstddjb/stralloc_reverse.o src/libstddjb/stralloc_reverse.lo: src/libstddj src/libstddjb/stralloc_reverse_blocks.o src/libstddjb/stralloc_reverse_blocks.lo: src/libstddjb/stralloc_reverse_blocks.c src/include/skalibs/stralloc.h src/libstddjb/stralloc_shrink.o src/libstddjb/stralloc_shrink.lo: src/libstddjb/stralloc_shrink.c src/include/skalibs/alloc.h src/include/skalibs/stralloc.h src/libstddjb/stralloc_zero.o src/libstddjb/stralloc_zero.lo: src/libstddjb/stralloc_zero.c src/include/skalibs/stralloc.h -src/libstddjb/strerr_diel.o src/libstddjb/strerr_diel.lo: src/libstddjb/strerr_diel.c src/include/skalibs/strerr.h -src/libstddjb/strerr_dielsys.o src/libstddjb/strerr_dielsys.lo: src/libstddjb/strerr_dielsys.c src/include/skalibs/strerr.h src/libstddjb/strerr_diev.o src/libstddjb/strerr_diev.lo: src/libstddjb/strerr_diev.c src/include/skalibs/strerr.h src/libstddjb/strerr_dievsys.o src/libstddjb/strerr_dievsys.lo: src/libstddjb/strerr_dievsys.c src/include/skalibs/strerr.h -src/libstddjb/strerr_warnl.o src/libstddjb/strerr_warnl.lo: src/libstddjb/strerr_warnl.c src/include/skalibs/strerr.h -src/libstddjb/strerr_warnlsys.o src/libstddjb/strerr_warnlsys.lo: src/libstddjb/strerr_warnlsys.c src/include/skalibs/strerr.h src/libstddjb/strerr_warnv.o src/libstddjb/strerr_warnv.lo: src/libstddjb/strerr_warnv.c src/include/skalibs/buffer.h src/include/skalibs/strerr.h src/libstddjb/strerr_warnvsys.o src/libstddjb/strerr_warnvsys.lo: src/libstddjb/strerr_warnvsys.c src/include/skalibs/buffer.h src/include/skalibs/strerr.h src/libstddjb/string_format.o src/libstddjb/string_format.lo: src/libstddjb/string_format.c src/include/skalibs/bytestr.h src/include/skalibs/stralloc.h diff --git a/src/include/skalibs/strerr.h b/src/include/skalibs/strerr.h @@ -10,11 +10,6 @@ extern void strerr_warnvsys (char const *const *, unsigned int) ; extern void strerr_diev (int, char const *const *, unsigned int) gccattr_noreturn ; extern void strerr_dievsys(int, char const *const *, unsigned int) gccattr_noreturn ; -extern void strerr_warnl (unsigned int, ...) ; -extern void strerr_warnlsys (unsigned int, ...) ; -extern void strerr_diel (int, unsigned int, ...) gccattr_noreturn ; -extern void strerr_dielsys (int, unsigned int, ...) gccattr_noreturn ; - #define strerr_array(...) ((char const *const[]){__VA_ARGS__}) #define strerr_warnn(n, ...) strerr_warnv(strerr_array(__VA_ARGS__), (n)) #define strerr_warnnsys(n, ...) strerr_warnvsys(strerr_array(__VA_ARGS__), (n)) diff --git a/src/libstddjb/strerr_diel.c b/src/libstddjb/strerr_diel.c @@ -1,24 +0,0 @@ -/* ISC license. */ - -/* MT-unsafe */ - -#include <stdarg.h> -#include <unistd.h> - -#include <skalibs/strerr.h> - -void strerr_diel (int e, unsigned int n, ...) -{ - if (n) - { - va_list ap ; - char const *v[n] ; - va_start(ap, n) ; - va_arg(ap, unsigned int) ; - for (unsigned int i = 0 ; i < n ; i++) - v[i++] = va_arg(ap, char const *) ; - va_end(ap) ; - strerr_warnv(v, n) ; - } - _exit(e) ; -} diff --git a/src/libstddjb/strerr_dielsys.c b/src/libstddjb/strerr_dielsys.c @@ -1,23 +0,0 @@ -/* ISC license. */ - -/* MT-unsafe */ - -#include <stdarg.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> - -#include <skalibs/strerr.h> - -void strerr_dielsys (int e, unsigned int n, ...) -{ - va_list ap ; - char const *v[n+1] ; - va_start(ap, n) ; - va_arg(ap, unsigned int) ; - for (unsigned int i = 0 ; i < n ; i++) - v[i++] = va_arg(ap, char const *) ; - va_end(ap) ; - v[n] = strerror(errno) ; - strerr_diev(e, v, n+1) ; -} diff --git a/src/libstddjb/strerr_warnl.c b/src/libstddjb/strerr_warnl.c @@ -1,22 +0,0 @@ -/* ISC license. */ - -/* MT-unsafe */ - -#include <stdarg.h> - -#include <skalibs/strerr.h> - -void strerr_warnl (unsigned int n, ...) -{ - if (n) - { - va_list ap ; - char const *v[n] ; - va_start(ap, n) ; - va_arg(ap, unsigned int) ; - for (unsigned int i = 0 ; i < n ; i++) - v[i++] = va_arg(ap, char const *) ; - va_end(ap) ; - strerr_warnv(v, n) ; - } -} diff --git a/src/libstddjb/strerr_warnlsys.c b/src/libstddjb/strerr_warnlsys.c @@ -1,22 +0,0 @@ -/* ISC license. */ - -/* MT-unsafe */ - -#include <stdarg.h> -#include <string.h> -#include <errno.h> - -#include <skalibs/strerr.h> - -void strerr_warnlsys (unsigned int n, ...) -{ - va_list ap ; - char const *v[n+1] ; - va_start(ap, n) ; - va_arg(ap, unsigned int) ; - for (unsigned int i = 0 ; i < n ; i++) - v[i++] = va_arg(ap, char const *) ; - va_end(ap) ; - v[n] = strerror(errno) ; - strerr_warnv(v, n+1) ; -}