From patchwork Tue Mar 7 16:50:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 736296 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vd2jG6rWSz9sCZ for ; Wed, 8 Mar 2017 03:50:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="rj9fE7DD"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=nXno1b6pekx9rBSo8OiaBQuKHOs0+ SX37vT2dreQQKXAiiemnnEyCspCmgfr3iCLnOVO+0vooU69u9OuHvaLNjAsyNL9c +9vaN2sRQ6QJBmCWrZli1YkV5IwE5D9DR1uBfI3uKhhiAJHtr1U3ZtW3wAREmTVG zAcVgzsqM1Moys= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=o/JzhPQnalY1zOROJXRGrcbAK0E=; b=rj9 fE7DD4E5VFtbXGXSZKXSGesoWOGMMCLr6I473SdZbO2WTbneGZg/36D3XB7c4nFM l5UG/QdWGG+YzHKFobee8y0qxczr0x5YDuq702cTUr7hbRVmhgUZ/tGwO1li7djc RScImHdrU7/IuQxMchpdIOMrgaAf3TkGLHD0QVO8= Received: (qmail 36195 invoked by alias); 7 Mar 2017 16:50:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 35620 invoked by uid 89); 7 Mar 2017 16:50:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=locks X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: [PATCH COMMITTED] tzset: Clean up preprocessor macros min, max, sign Message-ID: <9437a65a-cd13-c94c-60ba-0493cf65a21c@redhat.com> Date: Tue, 7 Mar 2017 17:50:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 sign is even used as an identifier later in the file (and there is no conflict only because the use is not function-like). Florian 2017-03-07 Florian Weimer * time/tzset.c (compute_offset): Open-code min macro. (min, max, sign): Remove. diff --git a/time/tzset.c b/time/tzset.c index f0e5c95..8868e9a 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -38,12 +38,6 @@ weak_alias (__timezone, timezone) /* This locks all the state variables in tzfile.c and this file. */ __libc_lock_define_initialized (static, tzset_lock) - -#define min(a, b) ((a) < (b) ? (a) : (b)) -#define max(a, b) ((a) > (b) ? (a) : (b)) -#define sign(x) ((x) < 0 ? -1 : 1) - - /* This structure contains all the information about a timezone given in the POSIX standard TZ envariable. */ typedef struct @@ -142,7 +136,13 @@ update_vars (void) static unsigned int compute_offset (unsigned int ss, unsigned int mm, unsigned int hh) { - return min (ss, 59) + min (mm, 59) * 60 + min (hh, 24) * 60 * 60; + if (ss > 59) + ss = 59; + if (mm > 59) + mm = 59; + if (hh > 24) + hh = 24; + return ss + mm * 60 + hh * 60 * 60; } /* Parses the time zone name at *TZP, and writes a pointer to an