mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
elf: Add the endswith function to <endswith.h>
And include <stdbool.h> for a definition of bool. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
4a50fdf8b2
commit
a20bc2f623
1 changed files with 8 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#ifndef _ENDSWITH_H
|
||||
#define _ENDSWITH_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Return true if the N bytes at NAME end with with the characters in
|
||||
|
@ -30,4 +31,11 @@ endswithn (const char *name, size_t n, const char *suffix)
|
|||
strlen (suffix)) == 0);
|
||||
}
|
||||
|
||||
/* Same as endswithn, but uses the entire SUBJECT for matching. */
|
||||
static inline bool
|
||||
endswith (const char *subject, const char *suffix)
|
||||
{
|
||||
return endswithn (subject, strlen (subject), suffix);
|
||||
}
|
||||
|
||||
#endif /* _ENDSWITH_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue