From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18976 invoked by alias); 2 Dec 2019 07:56:36 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 18957 invoked by uid 89); 2 Dec 2019 07:56:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Dec 2019 07:56:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575273393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uYpinVXOof/hu79tbTjSovHmGnmlvxEg7T9dZuZy8ts=; b=bz7FEVghsA5/y580qMyecBb2Wr92Ovfb1nHJL9juMWy4f7TG0FvnD0/cgJyelBpO1D/Pg4 SjXG5JSnhJmpAo4L0ItbEBNHvkYxLH5m8/omGRgxBIitdq4maDry1b9NQeKshkCPOljwr0 efJ0DsHwTxKb5ufWvYeO+3f6tmqwE+I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-OvgNlpAwPaCJQZOk-6IbwA-1; Mon, 02 Dec 2019 02:56:31 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16130800D4C for ; Mon, 2 Dec 2019 07:56:30 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-116-164.ams2.redhat.com [10.36.116.164]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3963E60BF7; Mon, 2 Dec 2019 07:56:28 +0000 (UTC) From: Florian Weimer To: "Frank Ch. Eigler" Cc: elfutils-devel@sourceware.org Subject: Re: RFC: deb/ddeb support for debuginfod References: <20191130155850.GA19319@redhat.com> Date: Mon, 02 Dec 2019 07:56:00 -0000 In-Reply-To: <20191130155850.GA19319@redhat.com> (Frank Ch. Eigler's message of "Sat, 30 Nov 2019 10:58:50 -0500") Message-ID: <875ziz17px.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: OvgNlpAwPaCJQZOk-6IbwA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00225.txt.bz2 * Frank Ch. Eigler: > +inline bool > +string_endswith(const string& haystack, const string& needle) > +{ > + return (haystack.size() >=3D needle.size() && > + haystack.substr(haystack.size()-needle.size()) =3D=3D needle); > +} I think you should use std::equal because substr allocations. So something loke htos: return (haystack.size() >=3D needle.size() && std::equal(haystack.end() - needle.size(), haystack.end(), needle.begin(), needle.end()));