This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: RFC: deb/ddeb support for debuginfod
- From: Florian Weimer <fweimer at redhat dot com>
- To: "Frank Ch. Eigler" <fche at redhat dot com>
- Cc: elfutils-devel at sourceware dot org
- Date: Mon, 02 Dec 2019 08:56:26 +0100
- Subject: Re: RFC: deb/ddeb support for debuginfod
- References: <20191130155850.GA19319@redhat.com>
* Frank Ch. Eigler:
> +inline bool
> +string_endswith(const string& haystack, const string& needle)
> +{
> + return (haystack.size() >= needle.size() &&
> + haystack.substr(haystack.size()-needle.size()) == needle);
> +}
I think you should use std::equal because substr allocations. So
something loke htos:
return (haystack.size() >= needle.size()
&& std::equal(haystack.end() - needle.size(), haystack.end(),
needle.begin(), needle.end()));