This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] New common function "startswith"
- From: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>
- To: Gary Benson <gbenson at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 03 Mar 2015 16:49:00 +0100
- Subject: Re: [PATCH] New common function "startswith"
- Authentication-results: sourceware.org; auth=none
- References: <1425388224-8146-1-git-send-email-gbenson at redhat dot com>
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?