Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1394403pxk; Thu, 10 Sep 2020 14:18:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEgMolcv4Jw35Uzar/1bUSnJFRK6wp4Nz4gvWUeyTvGFBYRc0YyiQaOlWQ5vxXx00UDbMn X-Received: by 2002:aa7:c707:: with SMTP id i7mr11594402edq.107.1599772704176; Thu, 10 Sep 2020 14:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599772704; cv=none; d=google.com; s=arc-20160816; b=Cyd28YvcV+9DO6PG+Bzygo2boa9SFxGRP97QXSwhhz9adgE/Cjs0BQjq3g2me+3RAY 1qvDXAS90ClcJjctsgOitTIRyF7X/Co4ZCFcXuaySeTyoj0qjWb4QhNIiaVavpvxq3fe 0MfXG7tGZP7oh0m7+DJJ8kG8riSZowxDI0F1h5CM5bQW80PbF/nrM+mqTUwmlRzq3Fla X0D/TYoVBGcvtcm2FCy2j5ReJgALthKVXBJtN8xrhiCfqFRsazKkbaJ89DA8kFh5LK9E uUkV6xAoDwjU3oFt+hOU9sxwkcOVUxBfim9y7/xpZJHZREmqLKUIapLXUQSFr4YsfFLT 0F/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kVpAIfBHlKKnBhZV8vhXwdUPQ2Bvfn5GqICMyE+J7Ms=; b=oJHHIohcv2fMbsXUxqB+DY8ZscZw5NlH7INRM/Hrkmf9gzP6jCV5D3zp801bRFbArN dPEyu8q4Tcn7E1qBgwE5fd2ger0JKL6Uxgzd5ksHzUu8c0pZWclyFRaVcnWTGU/SqB67 Bv2OcyViaBUkZtYyYGE/F3ycnbvBB7UfOw7kHGOzyqVSgBQjlxbacwcvQ+H77fuhX7zP TXfxrYkY/t3sr3LWa7F34E0D/fDI1GpcN7XXZ0lEWYj+u/6OCEdiAfEqyIU49wUyD6oW Z8oWhzgtYH2FoB3FfBiQq0EvJX1sAw99UHVLOC4fqCPxH8gfPjfXTLn6nKb8EsQOSxwg gtrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZzHsxghq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si4400955edv.181.2020.09.10.14.18.01; Thu, 10 Sep 2020 14:18:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZzHsxghq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbgIJVRZ (ORCPT + 99 others); Thu, 10 Sep 2020 17:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728036AbgIJVOr (ORCPT ); Thu, 10 Sep 2020 17:14:47 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6A97C0617A1; Thu, 10 Sep 2020 14:14:26 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id z1so8762930wrt.3; Thu, 10 Sep 2020 14:14:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kVpAIfBHlKKnBhZV8vhXwdUPQ2Bvfn5GqICMyE+J7Ms=; b=ZzHsxghq7dnyH0+9+wcEhtX+ZJO5fL+hOdeFcbgAMFcp2THuM7HHaNBFz1cSF/ZQ42 xTWpNaly0y6nJa8QeyiMIp2uJn5mGaUjSPq6tr5n/o7Ztl66a1XwrsB4E8FpUliAkEYn Za+/n0AJXus5Afu6QU5EwpLnl1x3ABgeBUgzz+TjGjtcQTnT6R4Hl6VhkEBgjXvo3Z5f ta1drycf71PzWqo098QwQjs1K29rQrlI+z9UuY3UCIE+d90QBw/mCzZ/pN5pltnRi+PC K9P15+7EZyZdZDBTgqigLhZqLp2fiXF0pBsg2d8ve4fhCY2BPgi3Lxa7peRTQc15Tfg6 fLOA== 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=kVpAIfBHlKKnBhZV8vhXwdUPQ2Bvfn5GqICMyE+J7Ms=; b=H69ulZWPXJNcAFWBFEMJip7FCRogp8kxJeslAhL0KK//DZBJodMRSQYCy+8Z2/KMz2 9qWdzhfp0rV7/60fh8KM+1/oBSVKdMcYCDARcCrOQ6MkkQy9PENj0voDwTHjFBU+pwE5 V5l6sPrDmffwiPxVvH7rr2wmS4oBu+En/a3fe6unRcq64uO56pwSByGaTFwkeu3Q9yT9 72gFNrdU+LnQVmycrRHLzThqg5BankYKZrhn9V0lU34P+C+k6kfKggdR5XlIFDYMymgO KbeyD6Tgiafpq1BjGuDT8kyTRCAR98lYvehxzJIRlow7MqhD5j4r81UEVz65jtEQf1UN 68BQ== X-Gm-Message-State: AOAM532jIMI8HyDjPX5mFUKv5xai9qoG0oI9BypOMSZqBbBfryV5MIzz h4O72Atq7f5h53g9DvhfZCA= X-Received: by 2002:a5d:5042:: with SMTP id h2mr11048791wrt.409.1599772465334; Thu, 10 Sep 2020 14:14:25 -0700 (PDT) Received: from localhost.localdomain ([170.253.60.68]) by smtp.googlemail.com with ESMTPSA id l10sm111502wru.59.2020.09.10.14.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 14:14:24 -0700 (PDT) From: Alejandro Colomar To: mtk.manpages@gmail.com Cc: linux-man@vger.kernel.org, linux-kernel@vger.kernel.org, Alejandro Colomar Subject: [PATCH 14/24] fread.3: Move ARRAY_SIZE logic into macro Date: Thu, 10 Sep 2020 23:13:35 +0200 Message-Id: <20200910211344.3562-15-colomar.6.4.3@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910211344.3562-1-colomar.6.4.3@gmail.com> References: <20200910211344.3562-1-colomar.6.4.3@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Alejandro Colomar --- man3/fread.3 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man3/fread.3 b/man3/fread.3 index 4c5dc3dbc..8e71e620e 100644 --- a/man3/fread.3 +++ b/man3/fread.3 @@ -136,6 +136,8 @@ Class: 0x02 #include #include +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + int main(void) { @@ -147,9 +149,7 @@ main(void) unsigned char buffer[4]; - size_t ret = - fread(buffer, sizeof(buffer) / sizeof(*buffer), sizeof(*buffer), - fp); + size_t ret = fread(buffer, ARRAY_SIZE(buffer), sizeof(*buffer), fp); if (ret != sizeof(*buffer)) { fprintf(stderr, "fread() failed: %zu\en", ret); exit(EXIT_FAILURE); -- 2.28.0