All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Masahiro Yamada <masahiroy@kernel.org>,
	 Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>,
	 Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	 Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	 David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kbuild@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: [PATCH RFC 07/12] drm/msm/headergen: use asprintf instead of custom aprintf
Date: Mon, 26 Feb 2024 04:11:43 +0200	[thread overview]
Message-ID: <20240226-fd-xml-shipped-v1-7-86bb6c3346d2@linaro.org> (raw)
In-Reply-To: <20240226-fd-xml-shipped-v1-0-86bb6c3346d2@linaro.org>

Replace custom aprintf() function with the standard asprintf().

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/headergen2/aprintf.c | 38 --------------------------------
 drivers/gpu/drm/msm/headergen2/rnn.c     |  5 ++++-
 drivers/gpu/drm/msm/headergen2/util.h    |  2 --
 3 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/msm/headergen2/aprintf.c b/drivers/gpu/drm/msm/headergen2/aprintf.c
deleted file mode 100644
index b3d924f59413..000000000000
--- a/drivers/gpu/drm/msm/headergen2/aprintf.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009-2011 Marcin Kościelnicki <koriakin@0x04.net>
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#include "util.h"
-#include <stdarg.h>
-
-char *aprintf(const char *format, ...) {
-	va_list va;
-	va_start(va, format);
-	size_t sz = vsnprintf(0, 0, format, va);
-	va_end(va);
-	char *res = malloc(sz + 1);
-	va_start(va, format);
-	vsnprintf(res, sz + 1, format, va);
-	va_end(va);
-	return res;
-}
diff --git a/drivers/gpu/drm/msm/headergen2/rnn.c b/drivers/gpu/drm/msm/headergen2/rnn.c
index d82d2a561b02..6cf3c54954bd 100644
--- a/drivers/gpu/drm/msm/headergen2/rnn.c
+++ b/drivers/gpu/drm/msm/headergen2/rnn.c
@@ -44,9 +44,12 @@
 #include "util/u_debug.h"
 
 static char *catstr (char *a, char *b) {
+	char *res;
+
 	if (!a)
 		return b;
-	return aprintf("%s_%s", a, b);
+
+	return asprintf(&res, "%s_%s", a, b) < 0 ? NULL : res;
 }
 
 static int strdiff (const char *a, const char *b) {
diff --git a/drivers/gpu/drm/msm/headergen2/util.h b/drivers/gpu/drm/msm/headergen2/util.h
index 98a32a34d076..07ad637e4521 100644
--- a/drivers/gpu/drm/msm/headergen2/util.h
+++ b/drivers/gpu/drm/msm/headergen2/util.h
@@ -110,6 +110,4 @@ struct astr {
 
 void print_escaped_astr(FILE *out, struct astr *astr);
 
-char *aprintf(const char *format, ...);
-
 #endif

-- 
2.39.2


  parent reply	other threads:[~2024-02-26  2:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  2:11 [PATCH RFC 00/12] drm/msm: add support for regenerating shipped xml.h headers Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 01/12] kbuild: create destination directory for _shipped handling Dmitry Baryshkov
2024-02-26  6:32   ` Masahiro Yamada
2024-02-26 11:01     ` Dmitry Baryshkov
2024-02-27 14:52       ` Masahiro Yamada
2024-02-26  2:11 ` [PATCH RFC 02/12] drm/msm/mdp5: add writeback block bases Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 03/12] drm/msm/hdmi: drop qfprom.xml.h Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 04/12] drm/msm/dsi: drop mmss_cc.xml.h Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 05/12] drm/msm: use _shipped suffix for all xml.h files Dmitry Baryshkov
2024-02-27  3:13   ` Masahiro Yamada
2024-02-26  2:11 ` [PATCH RFC 06/12] drm/msm/headergen: import source files from freedreno/envytools Dmitry Baryshkov
2024-02-26  2:11 ` Dmitry Baryshkov [this message]
2024-02-26  2:11 ` [PATCH RFC 08/12] drm/msm/headergen: don't output full file paths Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 09/12] drm/msm/headergen: generate _shipped files Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 10/12] drm/msm: import XML registers database Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 11/12] drm/msm: tie regeneration of shipped headers Dmitry Baryshkov
2024-02-26  2:11 ` [PATCH RFC 12/12] drm/msm: sync shipped headers database Dmitry Baryshkov
2024-02-26  6:24 ` [PATCH RFC 00/12] drm/msm: add support for regenerating shipped xml.h headers Masahiro Yamada
2024-02-26 10:49   ` Dmitry Baryshkov
2024-02-27  3:29     ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226-fd-xml-shipped-v1-7-86bb6c3346d2@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.