Message ID | 1691781658-32520-15-git-send-email-roretzla@linux.microsoft.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | David Marchand |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EC05E43037; Fri, 11 Aug 2023 21:22:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60ADF4329B; Fri, 11 Aug 2023 21:21:17 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E75264325A for <dev@dpdk.org>; Fri, 11 Aug 2023 21:21:01 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id DA93620FD0F9; Fri, 11 Aug 2023 12:21:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DA93620FD0F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1691781660; bh=Qt4M7foTuZNdNfBGNlV8vL2SK6gVrZbPMI4un3fZkD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l4yvNGjzWmksfelZtWVTKQS1cCKzEh5/hklUbkShpdn/S8Qmoyr2KKcciWts/YTq5 WtznhR7A94sZrIxJCv9x6/KpBLN1H2tlyYxOzO+45HpV4/GPExahyGWLkJbIaGVYZl 0HdZuqCS0xd9aRNRMicTyfn1cvuH7A661pN4KuCY= From: Tyler Retzlaff <roretzla@linux.microsoft.com> To: dev@dpdk.org Cc: Bruce Richardson <bruce.richardson@intel.com>, Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>, Ciara Power <ciara.power@intel.com>, thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff <roretzla@linux.microsoft.com> Subject: [PATCH v11 14/16] log: use standard ternary operator instead of GCC extension Date: Fri, 11 Aug 2023 12:20:56 -0700 Message-Id: <1691781658-32520-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1691781658-32520-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1691781658-32520-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Series |
msvc integration changes
|
|
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
Tyler Retzlaff
Aug. 11, 2023, 7:20 p.m. UTC
Use standard ternary operator instead of gcc extension. There is
no concern of side-effects for this evaluation so allow the code
to be portable.
While here update the condition to compare default_log_stream
directly against NULL.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
lib/log/log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com] > Sent: Friday, 11 August 2023 21.21 > > Use standard ternary operator instead of gcc extension. There is > no concern of side-effects for this evaluation so allow the code > to be portable. > > While here update the condition to compare default_log_stream > directly against NULL. > > Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> > --- > lib/log/log.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/log/log.c b/lib/log/log.c > index 52c771f..b80725a 100644 > --- a/lib/log/log.c > +++ b/lib/log/log.c > @@ -93,7 +93,7 @@ struct log_cur_msg { > * of stderr, even if the application closes and > * reopens it. > */ > - return default_log_stream ? : stderr; I didn't know this GCC extension. Someone please consider disallowing this in checkpatches. > + return default_log_stream != NULL ? default_log_stream : stderr; > } > return f; > } > -- > 1.8.3.1 Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
On Mon, 25 Sep 2023 08:24:58 +0200 Morten Brørup <mb@smartsharesystems.com> wrote: > I didn't know this GCC extension. > > Someone please consider disallowing this in checkpatches. We don't need to make checkpatch more complex. When MSVC is in build system, it will catch it
diff --git a/lib/log/log.c b/lib/log/log.c index 52c771f..b80725a 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -93,7 +93,7 @@ struct log_cur_msg { * of stderr, even if the application closes and * reopens it. */ - return default_log_stream ? : stderr; + return default_log_stream != NULL ? default_log_stream : stderr; } return f; }