summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2026-03-10 19:29:58 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2026-03-10 19:29:58 +0100
commit2dd4663ee68419059f327545e70095c4257b19e3 (patch)
treefe3db2baa3f6d96a6e33cc37e77faa91440b3766
parent2e314136ed58b6860c667e379bef22190fe84aa2 (diff)
New upstream version 5.3upstream/5.3upstream
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in5
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/api.rst1
-rw-r--r--doc/changelog.rst15
-rw-r--r--doc/tie.rst56
-rw-r--r--include/Makefile.am2
-rw-r--r--include/Makefile.in2
-rw-r--r--include/libHX/ctype_helper.h2
-rw-r--r--include/libHX/tie.hpp23
-rw-r--r--src/internal.h2
-rw-r--r--src/libHX.map1
13 files changed, 113 insertions, 20 deletions
diff --git a/Makefile.am b/Makefile.am
index f7e3483..ffdf084 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,6 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = include src
pkgconfig_DATA = libHX.pc
-EXTRA_DIST = doc/api.rst doc/assorted.txt doc/bitmaps.rst doc/changelog.rst doc/const_cast.c doc/dirstamp.rst doc/files_and_dirs.rst doc/generator.cpp doc/helper_headers.rst doc/history.rst doc/init.rst doc/inline_clist.rst doc/inline_list.rst doc/install.rst doc/libHX_Documentation.rst doc/linked_list.rst doc/macros.rst doc/maps.rst doc/memory_container.rst doc/misc_functions.rst doc/option_parsing.rst doc/process_management.rst doc/random_numbers.rst doc/scope.rst doc/shconfig.rst doc/socket_functions.rst doc/string_formatter.rst doc/string_ops.rst doc/strlcpy-timing.rst doc/time_functions.rst doc/typecheck_casts.rst doc/ux-file.rst doc/ux-mmap.rst
+EXTRA_DIST = doc/api.rst doc/assorted.txt doc/bitmaps.rst doc/changelog.rst doc/const_cast.c doc/dirstamp.rst doc/files_and_dirs.rst doc/generator.cpp doc/helper_headers.rst doc/history.rst doc/init.rst doc/inline_clist.rst doc/inline_list.rst doc/install.rst doc/libHX_Documentation.rst doc/linked_list.rst doc/macros.rst doc/maps.rst doc/memory_container.rst doc/misc_functions.rst doc/option_parsing.rst doc/process_management.rst doc/random_numbers.rst doc/scope.rst doc/shconfig.rst doc/socket_functions.rst doc/string_formatter.rst doc/string_ops.rst doc/strlcpy-timing.rst doc/tie.rst doc/time_functions.rst doc/typecheck_casts.rst doc/ux-file.rst doc/ux-mmap.rst
${pkgconfig_DATA}: ${top_builddir}/config.status
diff --git a/Makefile.in b/Makefile.in
index 1e77c09..5e6dce7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -199,8 +199,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/build-aux/ltmain.sh \
$(top_srcdir)/build-aux/missing COPYING build-aux/ar-lib \
build-aux/compile build-aux/config.guess build-aux/config.sub \
- build-aux/depcomp build-aux/install-sh build-aux/ltmain.sh \
- build-aux/missing
+ build-aux/install-sh build-aux/ltmain.sh build-aux/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -384,7 +383,7 @@ top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = include src
pkgconfig_DATA = libHX.pc
-EXTRA_DIST = doc/api.rst doc/assorted.txt doc/bitmaps.rst doc/changelog.rst doc/const_cast.c doc/dirstamp.rst doc/files_and_dirs.rst doc/generator.cpp doc/helper_headers.rst doc/history.rst doc/init.rst doc/inline_clist.rst doc/inline_list.rst doc/install.rst doc/libHX_Documentation.rst doc/linked_list.rst doc/macros.rst doc/maps.rst doc/memory_container.rst doc/misc_functions.rst doc/option_parsing.rst doc/process_management.rst doc/random_numbers.rst doc/scope.rst doc/shconfig.rst doc/socket_functions.rst doc/string_formatter.rst doc/string_ops.rst doc/strlcpy-timing.rst doc/time_functions.rst doc/typecheck_casts.rst doc/ux-file.rst doc/ux-mmap.rst
+EXTRA_DIST = doc/api.rst doc/assorted.txt doc/bitmaps.rst doc/changelog.rst doc/const_cast.c doc/dirstamp.rst doc/files_and_dirs.rst doc/generator.cpp doc/helper_headers.rst doc/history.rst doc/init.rst doc/inline_clist.rst doc/inline_list.rst doc/install.rst doc/libHX_Documentation.rst doc/linked_list.rst doc/macros.rst doc/maps.rst doc/memory_container.rst doc/misc_functions.rst doc/option_parsing.rst doc/process_management.rst doc/random_numbers.rst doc/scope.rst doc/shconfig.rst doc/socket_functions.rst doc/string_formatter.rst doc/string_ops.rst doc/strlcpy-timing.rst doc/tie.rst doc/time_functions.rst doc/typecheck_casts.rst doc/ux-file.rst doc/ux-mmap.rst
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/configure b/configure
index e73e86f..4265bd9 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for libHX 5.2.
+# Generated by GNU Autoconf 2.72 for libHX 5.3.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,
@@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libHX'
PACKAGE_TARNAME='libhx'
-PACKAGE_VERSION='5.2'
-PACKAGE_STRING='libHX 5.2'
+PACKAGE_VERSION='5.3'
+PACKAGE_STRING='libHX 5.3'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1374,7 +1374,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-'configure' configures libHX 5.2 to adapt to many kinds of systems.
+'configure' configures libHX 5.3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1445,7 +1445,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libHX 5.2:";;
+ short | recursive ) echo "Configuration of libHX 5.3:";;
esac
cat <<\_ACEOF
@@ -1560,7 +1560,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libHX configure 5.2
+libHX configure 5.3
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2213,7 +2213,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libHX $as_me 5.2, which was
+It was created by libHX $as_me 5.3, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3910,7 +3910,7 @@ fi
# Define the identity of the package.
PACKAGE='libhx'
- VERSION='5.2'
+ VERSION='5.3'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -20393,7 +20393,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libHX $as_me 5.2, which was
+This file was extended by libHX $as_me 5.3, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20461,7 +20461,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-libHX config.status 5.2
+libHX config.status 5.3
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 8cbc9c3..b59122d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([libHX], [5.2])
+AC_INIT([libHX], [5.3])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/doc/api.rst b/doc/api.rst
index 332fca9..34006a0 100644
--- a/doc/api.rst
+++ b/doc/api.rst
@@ -9,6 +9,7 @@ Function reference
====== ====== ====== ========================================
RMV MinVer FirstA Name
====== ====== ====== ========================================
+5.3 5.3 5.3 HX::unique_tie
5.0 5.0 4.28 HXdeque_to_vecx
5.2 4.28 4.28 HX_getopt6
4.28 4.28 4.28 HX_getopt6_clean
diff --git a/doc/changelog.rst b/doc/changelog.rst
index 6d399ae..2fd3b9b 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -1,3 +1,18 @@
+v5.3 (2026-01-29)
+=================
+
+Enhancements:
+
+* Added the ``<libHX/tie.hpp>`` include together with the
+ ``HX::unique_tie`` function
+
+Fixes:
+
+* Make ``HX_isascii`` work in C23 mode
+* Drop symbols from libHX.map that no longer exist,
+ these caused a build failure with llvm-ld (lld)
+
+
v5.2 (2025-10-19)
=================
diff --git a/doc/tie.rst b/doc/tie.rst
new file mode 100644
index 0000000..ba61dd7
--- /dev/null
+++ b/doc/tie.rst
@@ -0,0 +1,56 @@
+==============
+Memory helpers
+==============
+
+``unique_tie``
+==============
+
+``unique_tie`` creates a proxy object for ``std::unique_ptr<T,D>`` instances to
+interact with foreign functions that output a value through a ``T**`` pointer.
+
+Normally, for functions which return their result through an argument pointer,
+a temporary variable may be necessary when one wishes to use unique_ptr:
+
+.. code-block: c++
+
+ struct mydel { void operator()(void *x) const { free(x); } };
+
+ unique_ptr<char[], mydel> u;
+ char *x;
+ bla_alloc(&x);
+ u.reset(x);
+
+With ``unique_tie``, this can be shortened to:
+
+.. code-block: c++
+
+ unique_ptr<char[], mydel> u;
+ bla_alloc(&unique_tie(u));
+
+This is similar to C++23's ``std::out_ptr`` and ``std::in_out_ptr``.
+``unique_tie`` has subtle differences, though:
+
+* Only usable to ``unique_ptr``, not ``shared_ptr`` or raw pointers.
+* No implict conversions / No user-defined conversion operators.
+* No ``void **`` conversion.
+* Clearing is explicit, with ``~``.
+* Address-taking is explicit in text, i.e. you have to type a ``&`` in source
+ code. This is a deliberate choice for helping trivial text grepping for
+ pointer-taking.
+* There is higher memory use for when using a unique_ptr with custom deleter
+ function, but the optimizer might just optimize it away anyway.
+
+Repeated use of a variable with clearing inbetween works like so:
+
+.. code-block: c++
+
+ unique_ptr<char[], mydel> u;
+ iconvxx("utf-8", "utf-16", &unique_tie(u), srctext1);
+ printf("%s\n", u.get());
+ iconvxx("utf-8", "utf-16", &~unique_tie(u), srctext2);
+ printf("%s\n", u.get());
+ iconvxx("utf-8", "utf-16", &~unique_tie(u), srctext3);
+ printf("%s\n", u.get());
+
+It is acceptable to employ/enforce ``&~`` in all uses – even the
+first – of unique_tie in your project to guard against human error.
diff --git a/include/Makefile.am b/include/Makefile.am
index e3d3f86..4122611 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -5,5 +5,5 @@ nobase_include_HEADERS = libHX.h libHX/cast.h \
libHX/endian.h libHX/endian_float.h libHX/init.h \
libHX/intdiff.hpp libHX/io.h libHX/list.h \
libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h \
- libHX/scope.hpp libHX/socket.h libHX/string.h \
+ libHX/scope.hpp libHX/socket.h libHX/string.h libHX/tie.hpp \
libHX/libxml_helper.h libHX/wx_helper.hpp
diff --git a/include/Makefile.in b/include/Makefile.in
index 3f3227d..29184bd 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -311,7 +311,7 @@ nobase_include_HEADERS = libHX.h libHX/cast.h \
libHX/endian.h libHX/endian_float.h libHX/init.h \
libHX/intdiff.hpp libHX/io.h libHX/list.h \
libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h \
- libHX/scope.hpp libHX/socket.h libHX/string.h \
+ libHX/scope.hpp libHX/socket.h libHX/string.h libHX/tie.hpp \
libHX/libxml_helper.h libHX/wx_helper.hpp
all: all-am
diff --git a/include/libHX/ctype_helper.h b/include/libHX/ctype_helper.h
index 0f42c4f..85dd29b 100644
--- a/include/libHX/ctype_helper.h
+++ b/include/libHX/ctype_helper.h
@@ -41,7 +41,7 @@ static __inline__ bool HX_isalpha(unsigned char c)
static __inline__ bool HX_isascii(unsigned char c)
{
- return isascii(c);
+ return c < 128;
}
static __inline__ bool HX_isdigit(unsigned char c)
diff --git a/include/libHX/tie.hpp b/include/libHX/tie.hpp
new file mode 100644
index 0000000..c3c9d69
--- /dev/null
+++ b/include/libHX/tie.hpp
@@ -0,0 +1,23 @@
+#pragma once
+#include <memory>
+
+namespace HX {
+
+template<typename T, typename D> class unique_proxy {
+ public:
+ unique_proxy(std::unique_ptr<T, D> &a) : u(a), p(u.get()) {}
+ ~unique_proxy() { u.reset(p); }
+ typename std::unique_ptr<T, D>::pointer *operator&() { return &p; }
+ unique_proxy &operator~() { u.reset(); p = nullptr; return *this; }
+ private:
+ std::unique_ptr<T, D> &u;
+ typename std::unique_ptr<T, D>::pointer p;
+};
+
+template<typename T, typename D> unique_proxy<T, D>
+unique_tie(std::unique_ptr<T, D> &u)
+{
+ return unique_proxy<T, D>(u);
+}
+
+} /* namespace */
diff --git a/src/internal.h b/src/internal.h
index 2f5aa8f..1c24a56 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -40,7 +40,7 @@
#define MAXLNLEN 1024 /* max length for usual line */
#define HXMC_IDENT 0x200571AF
-#if !defined(__cplusplus)
+#if !defined(__cplusplus) && __STDC_VERSION__ < 202300L
# define nullptr NULL
#endif
diff --git a/src/libHX.map b/src/libHX.map
index 1154304..4be16ed 100644
--- a/src/libHX.map
+++ b/src/libHX.map
@@ -46,7 +46,6 @@ global:
HX_strltrim;
HX_strmid;
HX_strndup;
- HX_strnlen;
HX_strquote;
HX_strrcspn;
HX_strrev;