Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1395427pxk; Thu, 10 Sep 2020 14:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkuw72MV684uKkhgGhOd51zH+3+lKj7mpI4ndIl2A+TOJgXcciJSuvWyTvseoIKGZYw2+B X-Received: by 2002:a17:906:e50:: with SMTP id q16mr11441888eji.544.1599772811657; Thu, 10 Sep 2020 14:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599772811; cv=none; d=google.com; s=arc-20160816; b=EEpMEWsEhD2W4huHqSSzA5flZoxCM7acJpBhYoDX/xHM6uf10kkLXdQ/v0WJB2QSfZ Lqy1+H5o9OLCiTsdJeLyQ2iiCpQgapOZOliGCvZMfpEXMiSlamKocsp5N+kaguK63tVj PAe7/w92AgozwEsMCIV1zMiyDU9mQV6tJREuOJGGKvlYcdSrj8imTIzlIwk4pjDb32nn s50lRWVCIhZ4Ga5j3yfoLfymFpDDi+20P//V0bfyeF5sfh+eH6nfG35sOFy0ui8jBcSQ 2NwkfaaTWjVGIGDBqslBpZYAYO6fp1lWex6VgTpQO0HxKhQU80PfQ2E3125JjdzHOUt0 3uEg== 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=TzEm2scSLES6WjsyM6iO//Wl6U7ZWi8QP6rMUqxU0zw=; b=XDzSxhk74TivZwjcv7HpbR9bzYhVbqJA0xrb4JXRbr+8faJDzSmd4Bh7vW9OtY3b9V 1QBjShJgQu79LDkaqpgL1jYTePGHJAWC01HY+94ta96fIjosZGChxdrFbyC4AHjnelF3 g0TqxqCRuA7gTeNTutQcEJ3qi2gVwSrmHUN9mMjbUIbUGMuNUW97RKNGctq/vQljLloH MbtQ+ipl2eapXBo51LIMg9t8R0XXTOCngR2Apcp3it/L3FKyKXY1AUzieC+Pq4f1ZIjd g4EDrSQe8S2T0pNPHRKG6xNxSW2zvLaZxyoGtC6QUE07OW/EC4Xg93B/t6JvElHT/dEa eXXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=USeiSt9v; 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 oy13si4350010ejb.481.2020.09.10.14.19.49; Thu, 10 Sep 2020 14:20:11 -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=USeiSt9v; 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 S1727822AbgIJVSf (ORCPT + 99 others); Thu, 10 Sep 2020 17:18:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbgIJVPM (ORCPT ); Thu, 10 Sep 2020 17:15:12 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8935CC061573; Thu, 10 Sep 2020 14:14:37 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id o5so8702841wrn.13; Thu, 10 Sep 2020 14:14:37 -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=TzEm2scSLES6WjsyM6iO//Wl6U7ZWi8QP6rMUqxU0zw=; b=USeiSt9vAcfkIWT9ODmSAMpQPtyLMHNWQHaduLG/9afYqf6Knq4YkuBT4Mr37TFUoz c/Kcjwq2udc5pXHNQHlKIjeHB/YOxtSE6N82CNVqhlVegtg8jApTy0Uu5rnZ1aeDm3T/ d2HX/18Wzt+WfKv3edOv/TjuWFGkt7FHpwBpNhm3+qmXrsJJrt1c0p/4B1QoXlpc2XOT VnuzXbSL44JrwwiYY0NK1Wv4whvqKtJ/PdmM3CPTHjRufai6adpAmB2wC1gZKEEMzv7o ibbWpTelzXyKWsNXrbj6k4f7vWNP6NIcfDY8FzCuC6rLQy/I5ESRiIkDycnIa5os/wlt uilQ== 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=TzEm2scSLES6WjsyM6iO//Wl6U7ZWi8QP6rMUqxU0zw=; b=aNTmlTRFMAcNHxd4XBuYoU4gGjviWAoVHi9IGJ6Uk1On0NDvHxhsX+KtqTytvamPAy 1gZDfg7twESjuhpNDgpH3Def3xLvoCX/UZ28DuaT1NLNA0OJNgwkuW6nL0UEkA406jzt TakJ71C3EanGP3DcDzc04vQk2beQm1/oC6Tq8LuhD6hYArFBnMejVIsg7BH90TTCI2Fy 30orKmH6iWZsTspPqTJ9Pxppmj+v2k0n9Ug9rUQpKNEXZ1lh7aE9JFBaPVZLTPVxrjDY AUFRHVJ9vsxlqZLO1ezyLLZd3bufKzwrZespkxacNkpu2iWJc+rkRgyHxWP9sXKWfNHX johQ== X-Gm-Message-State: AOAM530ezB8wF7co41x63+lPqDTC1YePssjyVlm75AB/AYgl1D/HMD0K 0sYBfkDuyLNG/TSN5+yghE4= X-Received: by 2002:a5d:470e:: with SMTP id y14mr6637853wrq.354.1599772474914; Thu, 10 Sep 2020 14:14:34 -0700 (PDT) Received: from localhost.localdomain ([170.253.60.68]) by smtp.googlemail.com with ESMTPSA id l10sm111502wru.59.2020.09.10.14.14.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 14:14:34 -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 23/24] select_tut.2: Use MAX(a, b) from Date: Thu, 10 Sep 2020 23:13:44 +0200 Message-Id: <20200910211344.3562-24-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 --- man2/select_tut.2 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/man2/select_tut.2 b/man2/select_tut.2 index f683dd49d..d23683d75 100644 --- a/man2/select_tut.2 +++ b/man2/select_tut.2 @@ -354,6 +354,7 @@ from one TCP port to another. #include #include #include +#include /* Definition of MAX(a, b) */ #include #include #include @@ -364,9 +365,6 @@ from one TCP port to another. static int forward_port; -#undef max -#define max(x,y) ((x) > (y) ? (x) : (y)) - static int listen_socket(int listen_port) { @@ -483,7 +481,7 @@ main(int argc, char *argv[]) FD_ZERO(&writefds); FD_ZERO(&exceptfds); FD_SET(h, &readfds); - nfds = max(nfds, h); + nfds = MAX(nfds, h); if (fd1 > 0 && buf1_avail < BUF_SIZE) FD_SET(fd1, &readfds); @@ -499,11 +497,11 @@ main(int argc, char *argv[]) if (fd1 > 0) { FD_SET(fd1, &exceptfds); - nfds = max(nfds, fd1); + nfds = MAX(nfds, fd1); } if (fd2 > 0) { FD_SET(fd2, &exceptfds); - nfds = max(nfds, fd2); + nfds = MAX(nfds, fd2); } ready = select(nfds + 1, &readfds, &writefds, &exceptfds, NULL); -- 2.28.0