From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Move streq and compare_cstrings to gdbsupport
Date: Wed, 14 Dec 2022 14:51:43 -0500 [thread overview]
Message-ID: <5652cff7-6fc3-82cb-091b-7a3d166c7a1b@simark.ca> (raw)
In-Reply-To: <20221214194606.4141035-3-tromey@adacore.com>
> diff --git a/gdbsupport/common-utils.h b/gdbsupport/common-utils.h
> index 8a9448a638b..7f5ec584a2e 100644
> --- a/gdbsupport/common-utils.h
> +++ b/gdbsupport/common-utils.h
> @@ -93,6 +93,22 @@ startswith (gdb::string_view string, gdb::string_view pattern)
> && strncmp (string.data (), pattern.data (), pattern.length ()) == 0);
> }
>
> +/* Return true if the strings are equal. */
> +
> +static inline bool
> +streq (const char *lhs, const char *rhs)
> +{
> + return !strcmp (lhs, rhs);
> +}
While at it, you could maybe change it to
return strcmp (lhs, rhs) == 0;
to make it follow our code convention.
Otherwise, both patches LGTM:
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
prev parent reply other threads:[~2022-12-14 19:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-14 19:46 [PATCH 0/2] Two minor cleanups Tom Tromey
2022-12-14 19:46 ` [PATCH 1/2] Remove subset_compare Tom Tromey
2022-12-14 19:46 ` [PATCH 2/2] Move streq and compare_cstrings to gdbsupport Tom Tromey
2022-12-14 19:51 ` Simon Marchi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5652cff7-6fc3-82cb-091b-7a3d166c7a1b@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).