Re: [PATCH] New common function "startswith"

Andreas Arnez
2015-03-03T15:49:09Z

On Tue, Mar 03 2015, Gary Benson wrote:

> diff --git a/gdb/common/common-utils.c b/gdb/common/common-utils.c
> index 2925dd5..5fb4af1 100644
> --- a/gdb/common/common-utils.c
> +++ b/gdb/common/common-utils.c
> @@ -151,3 +151,11 @@ savestring (const char *ptr, size_t len)
> p[len] = 0;
> return p;
> }
> +
> +/* See common-utils.h. */
> +
> +int
> +startswith (const char *s1, const char *s2)
> +{
> + return startswith (s1, s2);
> +}
> diff --git a/gdb/common/common-utils.h b/gdb/common/common-utils.h
> index 60aa030..c887b6b 100644
> --- a/gdb/common/common-utils.h
> +++ b/gdb/common/common-utils.h
> @@ -68,4 +68,9 @@ char *savestring (const char *ptr, size_t len);
>
> extern char *safe_strerror (int);
>
> +/* Return nonzero if the first strlen(S2) bytes of S1 match S2, zero
> + otherwise. */
> +
> +extern int startswith (const char *s1, const char *s2);
> +
> #endif

Hm, startswith() does not appear to be implemented in your patch. Maybe
an extern inline definition in the header file was intended?