From 48fbf21a6d6085d561757afb162d9f7b98792bf9 Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Fri, 5 Dec 2025 21:54:50 -0700 Subject: map: stop setting errno on error the return of these functions already give all the necessary information. this is not c standard library code, we have no need of such a nonsensical error reporting mechanism NOTE: since errno needs to be thread local accessing it from non-libc code ends up being a function call and serves as a pointless optimization barrier. --- map.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'map.h') diff --git a/map.h b/map.h index e733bd3..d3457d9 100644 --- a/map.h +++ b/map.h @@ -31,8 +31,7 @@ void *map_first(const Map *map, const char **key); * @param map The map to search within. * @param prefix The prefix to search for. * @return The corresponding value, if the given prefix is unique. - * Otherwise ``NULL``. If no such prefix exists, then ``errno`` - * is set to ``ENOENT``. + * Otherwise ``NULL``. */ void *map_closest(const Map *map, const char *prefix); /** @@ -47,8 +46,8 @@ bool map_contains(const Map *map, const char *prefix); * @param map The map to store the key-value pair in. * @param key The key to store. * @param value The value associated with the key. - * @return False if we run out of memory (``errno = ENOMEM``), or if the key - * already appears in the map (``errno = EEXIST``). + * @return False if we run out of memory, or if the key + * already appears in the map. */ bool map_put(Map *map, const char *key, const void *value); /** -- cgit v1.2.3