From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0EC1CA0546; Tue, 6 Apr 2021 16:58:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3C4C141177; Tue, 6 Apr 2021 16:58:29 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id DC0CC141134 for ; Tue, 6 Apr 2021 16:58:27 +0200 (CEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 71B375C01B0; Tue, 6 Apr 2021 10:58:25 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 06 Apr 2021 10:58:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm3; bh= qdzNBUOL5LsUzNAcC7bPSzemvng6vYp+k0jl7mGxz9A=; b=PZJ43C6UUBmvpHKc joZhqM2JMGx63L6JXrIpopiG+yTV92XK8jLuwwK0+Y/FrH9ljwaYFXk+sDl73gu4 uBj+KexaA4EWL9sbC6Q8OnXabDDq4W5cETadgdCgDoL6n3qAudmx64c/kb5IxFnj xm7Jfc7lx2ZKwSJjHtga1FHXPsEeMdJvyEoBhQU2sGGLXSLGLme8Yafl6OCpyudG 17tdDKR6SmQ8D/Xi9T1R1o5bNIBxcC0SUzd6+poV0EwLlnVgKD9RQGmnZBHOfSeJ OJrmnvGvGLQZbYV/5PW7yP3cqBF3CjoX5T/PwSQ8MI7vnIDco4SMSEVQoYtJ1Da7 OOetCA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=qdzNBUOL5LsUzNAcC7bPSzemvng6vYp+k0jl7mGxz 9A=; b=nRqUsVax+ohGOxejxtfp7rXATDdoGnXxApib2QpFEgciXKePdymba6n+m M48/3YvMK8/IrwPLV6tPuJtyiO97CfHMgLF1ZuPcNYxHRx61eS0Qz7+WeNWHYplG V+346QLBBgmXvqUl5V8vLEsTIl5fk9+LuWNGP1XeR7OkB3ndOyKGaNxvqsIBZ3R6 8LAyNjBflFlN5SJ9iYgzvsJTseEhsWAmbSxCSZkIKyAeBZFCxKBJoa+DpAFGlMQe u1c0IlwwPuk9b6GiLBjN34bCtZrLHOk8eQ63xWljLdbZ5UeSuIQHAThV/B8CGgDn NlUXSVLhLXx0KhEeSm+7fJPcJ48RQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejhedgvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 599CB1080064; Tue, 6 Apr 2021 10:58:23 -0400 (EDT) From: Thomas Monjalon To: David Marchand Cc: dev , Bruce Richardson , Andrew Rybchenko , Ray Kinsella Date: Tue, 06 Apr 2021 16:58:20 +0200 Message-ID: <3173281.rQA7gXJnz7@thomas> In-Reply-To: References: <20210405193000.1113542-1-thomas@monjalon.net> <20210406131137.1732110-5-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v6 4/4] log: add option argument help X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 06/04/2021 16:28, David Marchand: > On Tue, Apr 6, 2021 at 3:12 PM Thomas Monjalon wrote: > > +void > > +rte_log_list_types(FILE *out, const char *prefix) > > +{ > > + struct rte_log_dynamic_type *sorted_types; > > + const size_t type_size = sizeof(rte_logs.dynamic_types[0]); > > + const size_t type_count = rte_logs.dynamic_types_len; > > + const size_t total_size = type_size * type_count; > > + size_t type; > > + > > + sorted_types = malloc(total_size); > > + if (sorted_types == NULL) { > > + /* no sorting - unlikely */ > > + sorted_types = rte_logs.dynamic_types; > > + } else { > > + memcpy(sorted_types, rte_logs.dynamic_types, total_size); > > + qsort(sorted_types, type_count, type_size, log_type_compare); > > + } > > + > > + for (type = 0; type < type_count; ++type) { > > + if (sorted_types[type].name == NULL) > > + continue; > > + fprintf(out, "%s%s\n", prefix, sorted_types[type].name); > > + } > > Missing something like: > > if (sorted_types != rte_logs.dynamic_types) > free(sorted_types); No, what is missing really is coffee, but I don't drink some ;) Thank you for the good review.