-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/basename.c: Basename(): Use stprcspn() instead of its pattern
Signed-off-by: Alejandro Colomar <[email protected]>
- Loading branch information
1 parent
46535f6
commit c9514aa
Showing
1 changed file
with
13 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh | ||
* SPDX-FileCopyrightText: 1996 - 1997, Marek Michałkiewicz | ||
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh | ||
// SPDX-FileCopyrightText: 1996-1997, Marek Michałkiewicz | ||
// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko | ||
// SPDX-FileCopyrightText: 2024, Alejandro Colomar <[email protected]> | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
/* | ||
* basename.c - not worth copyrighting :-). Some versions of Linux libc | ||
|
@@ -15,17 +13,19 @@ | |
|
||
#include <config.h> | ||
|
||
#ident "$Id$" | ||
#include <stddef.h> | ||
#include <stdlib.h> | ||
|
||
#include "defines.h" | ||
#include "prototypes.h" | ||
/*@observer@*/const char *Basename (const char *str) | ||
#include "string/strspn/stprcspn.h" | ||
|
||
|
||
/*@observer@*/const char * | ||
Basename(const char *str) | ||
{ | ||
if (str == NULL) { | ||
abort (); | ||
} | ||
|
||
char *cp = strrchr (str, '/'); | ||
|
||
return (NULL != cp) ? cp + 1 : str; | ||
return stprcspn(str, "/"); | ||
} |