From cdccc69c62579b0c13b35fad0728079652b8f3c9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 31 Jan 2023 11:21:30 +0100 Subject: Move library source into src sub-directory Signed-off-by: David Oberhollenzer --- lib/compat/strndup.c | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 lib/compat/strndup.c (limited to 'lib/compat/strndup.c') diff --git a/lib/compat/strndup.c b/lib/compat/strndup.c deleted file mode 100644 index 7e77f6c..0000000 --- a/lib/compat/strndup.c +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ -/* - * strndup.c - * - * Copyright (C) 2019 David Oberhollenzer - */ -#include "config.h" -#include "compat.h" - -#include -#include - -#ifndef HAVE_STRNDUP -char *strndup(const char *str, size_t max_len) -{ - size_t len = 0; - char *out; - - while (len < max_len && str[len] != '\0') - ++len; - - out = malloc(len + 1); - - if (out != NULL) { - memcpy(out, str, len); - out[len] = '\0'; - } - - return out; -} -#endif -- cgit v1.2.3