dutil: Adopt strstart() from the linux perf tools sources

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2018-12-20 14:52:25 -03:00
parent 3aa3fd506e
commit a2cdc6c2a0
1 changed files with 10 additions and 0 deletions

10
dutil.h
View File

@ -291,6 +291,16 @@ static inline bool strlist__empty(const struct strlist *slist)
return rb_first(&slist->entries) == NULL;
}
/**
* strstarts - does @str start with @prefix?
* @str: string to examine
* @prefix: prefix to look for.
*/
static inline bool strstarts(const char *str, const char *prefix)
{
return strncmp(str, prefix, strlen(prefix)) == 0;
}
void *zalloc(const size_t size);
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,