On 06/05/2025 5:24 pm, Kevin Lampis wrote:
> diff --git a/xen/include/xen/string.h b/xen/include/xen/string.h
> index bd4a8f48e9..70c231b690 100644
> --- a/xen/include/xen/string.h
> +++ b/xen/include/xen/string.h
> @@ -26,6 +26,7 @@ size_t strnlen(const char *s, size_t count);
>  char *strpbrk(const char *cs,const char *ct);
>  char *strsep(char **s, const char *ct);
>  size_t strspn(const char *s, const char *accept);
> +size_t strcspn(const char *s, const char *reject);
>  
>  void *memset(void *s, int c, size_t n);
>  void *memcpy(void *dest, const void *src, size_t n);

Lower down in this file, you also want a define aliasing to
__builtin_strcspn() in the style of the others you'll see.  In turn,
you'll need to...

> diff --git a/xen/lib/strcspn.c b/xen/lib/strcspn.c
> new file mode 100644
> index 0000000000..42e3308dac
> --- /dev/null
> +++ b/xen/lib/strcspn.c
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + *  Copyright (C) 1991, 1992  Linus Torvalds
> + */
> +
> +#include <xen/string.h>
> +
> +/**
> + * strcspn - Calculate the length of the initial substring of @s which does 
> not contain letters in @reject
> + * @s: The string to be searched
> + * @reject: The string to avoid
> + */
> +size_t strcspn(const char *s, const char *reject)

... write this as "size_t (strcspn)(const ..."

to avoid the macro expansion in this one place.

~Andrew

Reply via email to