From patchwork Tue Feb 12 22:26:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 10808853 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29FC517E0 for ; Tue, 12 Feb 2019 22:27:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A1DB2C720 for ; Tue, 12 Feb 2019 22:27:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EEED2C726; Tue, 12 Feb 2019 22:27:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAEB02C720 for ; Tue, 12 Feb 2019 22:27:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727993AbfBLW1C (ORCPT ); Tue, 12 Feb 2019 17:27:02 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:39568 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbfBLW1C (ORCPT ); Tue, 12 Feb 2019 17:27:02 -0500 Received: by mail-ed1-f65.google.com with SMTP id b14so254450edt.6 for ; Tue, 12 Feb 2019 14:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EjZdmoCpzjmQXbTddE7TrXbCYC7lkCVKOuquQIFRK80=; b=Uob11nBOxdxx46x6u3hkK0eba38GtluGGgBMU1zCBjQ7TxLjQoBU0cIcXPGFhvqVKF FG42hAWY+ZBTY5dXW0XWNsGlcD2fH6NC2T08E7y0gp3ge7GBhDXKz5wm3ZT0Wb0728RH r/Yz8axWYwHoQM2sSf0s//9DuBqsW0lKwWAWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EjZdmoCpzjmQXbTddE7TrXbCYC7lkCVKOuquQIFRK80=; b=LGr8uOjLEDXDHGqvYDmE3sSYriH8mxHiv1+dcvzLhn0e368ZtAW9VHJwRQnYo1L6kp uxgGz56uSZTL//oNLLsYADq6+91vKDOk4nf/Ih697xmvXmnoWIvNM7EKKnBKaoDhHzXf YrIHTEyrbCoJlMUrBKzNwXqlSpSYn7aQp0vjdtZ7ofwUfbl4Mhfn4XFsZ8O3u5imamSx 533am6x2yrLoytjfeJMb3PCJDhgTny1cvgnCOpZ04t0oDYy6RZQJoNH5NQmyxlKRyarX flJ8B8lEcj2i3x4GkqGggasgQd41iOp4JMKOGpoG2BwYxKkXguvFDDU8nqwWOesGCOnT YKRg== X-Gm-Message-State: AHQUAuYV9VFDK61lWvethys2MfKvCAo6wSojc0QUbaUVPdOkyIIIO6LF UzHtN2rYgeestTXWiDWUXCjIqsUx8fVcCesx X-Google-Smtp-Source: AHgI3IaCUCpshi3U6oX1kob0hSHoHY0XIkWm9v3MX7KgyO1zdK/xQqtThC5KL1/qBkgqUjNuskIVxw== X-Received: by 2002:a17:906:bb16:: with SMTP id jz22mr4262745ejb.106.1550010420477; Tue, 12 Feb 2019 14:27:00 -0800 (PST) Received: from prevas-ravi.waoo.dk (ip-5-186-119-174.cgn.fibianet.dk. [5.186.119.174]) by smtp.gmail.com with ESMTPSA id ay20sm3349582ejb.32.2019.02.12.14.26.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 14:26:59 -0800 (PST) From: Rasmus Villemoes To: git@vger.kernel.org Cc: Rasmus Villemoes Subject: [RFC PATCH 1/5] builtin/grep.c: change todo_* variables to unsigned Date: Tue, 12 Feb 2019 23:26:50 +0100 Message-Id: <20190212222654.7432-2-rv@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212222654.7432-1-rv@rasmusvillemoes.dk> References: <20190212222654.7432-1-rv@rasmusvillemoes.dk> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for subsequent patches that make todo_* free-running instead of reducing them mod TODO_SIZE, change their type to unsigned to avoid undefined behaviour in case anybody ever greps more than 2 billion files. Signed-off-by: Rasmus Villemoes --- builtin/grep.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/grep.c b/builtin/grep.c index 580fd38f41..6c1e90d43b 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -58,9 +58,9 @@ struct work_item { */ #define TODO_SIZE 128 static struct work_item todo[TODO_SIZE]; -static int todo_start; -static int todo_end; -static int todo_done; +static unsigned int todo_start; +static unsigned int todo_end; +static unsigned int todo_done; /* Has all work items been added? */ static int all_work_added; @@ -132,7 +132,7 @@ static struct work_item *get_work(void) static void work_done(struct work_item *w) { - int old_done; + unsigned int old_done; grep_lock(); w->done = 1;