From patchwork Sun Oct 27 05:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 1184919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=uclibc-bounces@uclibc.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dhbHQDD7"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4716Gj4SL0z9sP4 for ; Sun, 27 Oct 2019 16:43:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EDABD86CE0; Sun, 27 Oct 2019 05:43:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZG1I9xxnatiN; Sun, 27 Oct 2019 05:43:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 2CED786D85; Sun, 27 Oct 2019 05:43:51 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id C0AF91BF5E0 for ; Sun, 27 Oct 2019 05:43:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BA21A8573E for ; Sun, 27 Oct 2019 05:43:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qgG2OtHJevzt for ; Sun, 27 Oct 2019 05:43:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 205B485722 for ; Sun, 27 Oct 2019 05:43:49 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id q21so3637648plr.13 for ; Sat, 26 Oct 2019 22:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=vxCr7ipFvb0n7QiWYhrkgK6RIGaNcDtCuRDb0lrDMiA=; b=dhbHQDD7qMf1zJZ+XlFELQTOkATCpnJ+U8xJ9SpbpQr0qt7y1T6BVSZDxivP7g7EAd GLNsUURDfniqEXT2JopoGhceElVSrjTsFmsU+/Sbkyo58WzUgoGsKha4WJBkPwW9Xinn z2M6QIJHZM1aRSJPDY8X7CqF8fphmAxb5FcmUKNYz+M1pRWCPy5rWtP63soVwc9THchy gT6qwr7/Rv9vPQoasbjJOCgJN+0wlV+8UtK4KTRk9CM9Fe+wS8kONo/3il1mOrLWRvMW kuVEI30n4e051a62qpZk27FM/RtYbXg5LQL2dVYASoQJK5/8ZrlSi0cZLETW9B2OObgM cxRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=vxCr7ipFvb0n7QiWYhrkgK6RIGaNcDtCuRDb0lrDMiA=; b=UEuq9OiDOfrp0sw+VtVnb8V5j75FE21j8yLQFpkeVacDSLtEnu1oKdpxqPMwJ4s1xJ bqLDJNwK+V6eSt/csrbrN6aTYiWQEBKrVdnue+B3KjjWPqUxdwndv0LO/CLS3Wc3mB7x F7X9FfRNtdzsJvmYcXOeRFgvQQHEtG1vWZWVLyV+EEVnPALK2CmDi9svtnIHzNCgoaGZ e8rnSTIwyx27QvsvQ9Cw+hjYuF1PedEbTv+/dLpXdh/RvR+kgY2rXcTlhqfeSiV0r3R1 I02fYwISuljcCAiyMs/LahhKiQaOl4W8QHXn9CKzdODldf4ZL32KARL5hzHObV1ONAIu 1xpA== X-Gm-Message-State: APjAAAUPZ31me1KwUObDyY7+omNWn8kKNSgxBLG5qT5aWwSKjg4pmd7v tu2dWfa8q/vzR+NBu8r17tKurpALepk= X-Google-Smtp-Source: APXvYqzY56kLu5qoAqKqa6gAoMncoysQwv1Nl3rg6xwUYQOC/ccg2rYFCKZm6Y43Pp4gn8LgLjxECQ== X-Received: by 2002:a17:902:8208:: with SMTP id x8mr4640557pln.232.1572155028140; Sat, 26 Oct 2019 22:43:48 -0700 (PDT) Received: from localhost.localdomain (astound-69-42-4-171.ca.astound.net. [69.42.4.171]) by smtp.gmail.com with ESMTPSA id l22sm6819286pgj.4.2019.10.26.22.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Oct 2019 22:43:47 -0700 (PDT) From: Rosen Penev To: uclibc@uclibc.org, rep.dot.nop@gmail.com Subject: [PATCH] include/string: Bail out early on erase Date: Sat, 26 Oct 2019 22:43:45 -0700 Message-Id: <20191027054345.13895-1-rosenp@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: "uClibc" When string is empty. Signed-off-by: Rosen Penev --- include/string | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/string b/include/string index 020c469..abdcc0c 100644 --- a/include/string +++ b/include/string @@ -323,6 +323,9 @@ public: iterator temp = last; + if (!count) + return first; + while(last != vector::end()){ *(last - count) = *last; ++last;