From patchwork Thu Aug 2 04:35:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 952578 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41gy5r03VDz9s2g for ; Thu, 2 Aug 2018 14:35:28 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="P/+E48/k"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41gy5q4gxNzF1R6 for ; Thu, 2 Aug 2018 14:35:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="P/+E48/k"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41gy5W50mfzF0pD for ; Thu, 2 Aug 2018 14:35:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="P/+E48/k"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 41gy5W2Rkqz9s5K; Thu, 2 Aug 2018 14:35:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1533184511; bh=LDC7K/v1tstaQJKAFqRn/y1u+2L90CHGxXHV61oQr0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P/+E48/kUZiTw1sEALiekvnFQGsxb/6y+H4mfOExQWqBF52haUGvu/Pk4oMcWGhNt HoiB2fsL8L3lvSlv7z/xwyO9ka6a4KAyqnMEuZSqkDYr3WlPwtSQLz1W93qGDbsJbo RhqQCoDHBiumP7ncwn7z+FM11t0dqnMG6ECGrNVpJGSWqGsvt2zwiAXgauvDZCz/8v +QsguuPyMNtjo5HiuM2Kb3p2vI3rKh316tMiq2EmQ/1X7Qva0f+8Mx+/n7Caierm3H josUR8B162Ev+XWXOp8LZi14fPjB/2gMCE/x5/jYrP9j6cTk1Op/lUjLDebKw4ApJ1 9CS4x/gH+5JIg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 2 Aug 2018 14:35:06 +1000 Message-Id: <20180802043507.28734-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180802043507.28734-1-amitay@ozlabs.org> References: <20180802043507.28734-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 3/4] progress: Add assert to avoid programming errors X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- src/progress.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/progress.c b/src/progress.c index 8aef486..648596d 100644 --- a/src/progress.c +++ b/src/progress.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "progress.h" @@ -33,6 +34,8 @@ static void progress_bar(unsigned int percent) { unsigned int i, progress; + assert(percent <= 100); + progress = (percent * PROGRESS_CHARS) / 101; fprintf(stderr, "\r[");