commit: 38639154906256254347582effbfe2856da7863a
parent 767057730d30be5c4ecf6a2e0d8f9c6934071e10
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 8 Jul 2021 02:40:22 +0200
bin/basename: static + assert to make scan-build happy
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/bin/basename.c b/bin/basename.c
@@ -2,13 +2,16 @@
// Copyright 2017-2021 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
+#include <assert.h> // assert()
#include <libgen.h> // basename()
#include <stdio.h> // fputs(), puts()
#include <string.h> // strlen(), strcmp()
-char *
+static char *
suffix_basename(char *name, char *suffix)
{
+ assert(name);
+ assert(suffix);
char *string = basename(name);
size_t suflen = suffix ? strlen(suffix) : 0;