From patchwork Fri Feb 14 05:55:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 865093 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1f8a:b0:38f:210b:807b with SMTP id hj10csp199521wrb; Thu, 13 Feb 2025 21:56:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVEYhpCNMt7j1d57+SiCaYyAXJUAlG+pX2SGv9KrE4NXxIjbLTEYEhBFS+fpALIzj7XwB6qyA==@linaro.org X-Google-Smtp-Source: AGHT+IGEzAzVxMxydCRcG54tPnf0liCBNoJTFb6MpWel/zeJ7YMc7uRionrSWdmmauqBg7tyTqUZ X-Received: by 2002:ac8:7fc2:0:b0:471:c21c:a2b with SMTP id d75a77b69052e-471c21c0b11mr74666121cf.45.1739512614500; Thu, 13 Feb 2025 21:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739512614; cv=none; d=google.com; s=arc-20240605; b=ZLQptlkJ4AbzW4d1mIZGBX78sz3pQDHukihwytItyPJv69vPgubpzYdMgXDE/3F+Xc bz5ooM4bjR15s+65Ip6LQnVSjF2LcuI++cgAQ5xH8VIOCPsPKqLm3Gp4wvezdAMgbq7r cSXWQd4fJha9ZMCOoY/VtO2zeI3h1u0gU/AIohDQ26cLx7Ik7FnuoOkMrUd+9Xib0R62 M7SHuz0pYWdDM+K9DslQnt6bOZIPb0RJ3AZic1C+yCDuaHSMeyCjnRDnsW+DU1KHTrQQ iG5SkegfN14l3+pk872ORkDQBy/b8hCdaYj7AW0u20f2oK1+99gBWSYno3b/f8egMWeG Ltlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=/zxstQqttW6Et0vHll5zlwK5F+6k5+gCIcLFt/tano0=; fh=IMXbw0xx+6Q/2UEl1nyvDi1qBBGGml6rPCVUBtTSKyg=; b=aK2PrqHUUkniEURgdU1ky/bHh2+nIQybOtgCqJCMpIm/ZPudbb9KoMpPuboIMb70XX hkWMsGP+MbOPa8z9iHKa26e4K6r1uhgqG+yxps3dzFX2TewTyVeaLVELJl7Je7JmBNx4 57S+emZUK2qY65NzAmSad4Ca0EJJJyIkiHFEwph00eBRCDOmnxOHAc8udfaVF7RUn+me bGMVnFxOnEQ3EdbroACQcHAqrFWeB1V5cfKBONF6dOv50faKe7Nm9ECYLlnB16x+RP87 8eo7gGrkiWjTQZDHTm+kHtOWsPkxbnAw/eVAncrO+AK5S1M2kgweZTp+h0+SmpwWbArn Xs1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-471c29efc3bsi27811891cf.111.2025.02.13.21.56.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Feb 2025 21:56:54 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tiofj-0000Zf-Io; Fri, 14 Feb 2025 00:55:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tioff-0000Xg-E2; Fri, 14 Feb 2025 00:55:27 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tiofc-00083g-Ui; Fri, 14 Feb 2025 00:55:26 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id BA689EAB0C; Fri, 14 Feb 2025 08:55:12 +0300 (MSK) Received: from gandalf.tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with ESMTP id B99BF1B5FC2; Fri, 14 Feb 2025 08:55:20 +0300 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id A909A53460; Fri, 14 Feb 2025 08:55:20 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, Michael Tokarev Subject: [PULL 1/4] overall: Remove unnecessary g_strdup_printf() calls Date: Fri, 14 Feb 2025 08:55:17 +0300 Message-Id: <20250214055520.3159764-2-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250214055520.3159764-1-mjt@tls.msk.ru> References: <20250214055520.3159764-1-mjt@tls.msk.ru> MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Replace g_strdup_printf("%s", value) -> g_strdup(value) to avoid unnecessary string formatting. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael Tokarev Signed-off-by: Michael Tokarev --- crypto/hash-afalg.c | 2 +- hw/ppc/spapr_caps.c | 2 +- plugins/loader.c | 2 +- target/i386/cpu.c | 2 +- trace/simple.c | 2 +- ui/console.c | 4 +--- ui/gtk.c | 3 +-- util/module.c | 2 +- 8 files changed, 8 insertions(+), 11 deletions(-) diff --git a/crypto/hash-afalg.c b/crypto/hash-afalg.c index 8c0ce5b520..bd3fe3b427 100644 --- a/crypto/hash-afalg.c +++ b/crypto/hash-afalg.c @@ -59,7 +59,7 @@ qcrypto_afalg_hash_format_name(QCryptoHashAlgo alg, if (is_hmac) { name = g_strdup_printf("hmac(%s)", alg_name); } else { - name = g_strdup_printf("%s", alg_name); + name = g_strdup(alg_name); } return name; diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 7edd138360..904bff87ce 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -1034,7 +1034,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc) for (i = 0; i < ARRAY_SIZE(capability_table); i++) { SpaprCapabilityInfo *cap = &capability_table[i]; g_autofree char *name = g_strdup_printf("cap-%s", cap->name); - g_autofree char *desc = g_strdup_printf("%s", cap->description); + g_autofree char *desc = g_strdup(cap->description); object_class_property_add(klass, name, cap->type, cap->get, cap->set, diff --git a/plugins/loader.c b/plugins/loader.c index ebc01da9c6..99686b5466 100644 --- a/plugins/loader.c +++ b/plugins/loader.c @@ -128,7 +128,7 @@ static int plugin_add(void *opaque, const char *name, const char *value, /* Will treat arg="argname" as "argname=on" */ fullarg = g_strdup_printf("%s=%s", value, "on"); } else { - fullarg = g_strdup_printf("%s", value); + fullarg = g_strdup(value); } warn_report("using 'arg=%s' is deprecated", value); error_printf("Please use '%s' directly\n", fullarg); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b5dd60d281..72ab147e85 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6166,7 +6166,7 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data) desc = g_strdup_printf("%s [%s]", model_id, cc->model->note); } if (!desc) { - desc = g_strdup_printf("%s", model_id); + desc = g_strdup(model_id); } if (cc->model && cc->model->cpudef->deprecation_note) { diff --git a/trace/simple.c b/trace/simple.c index 18af590cf7..c0aba00cb7 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -366,7 +366,7 @@ void st_set_trace_file(const char *file) /* Type cast needed for Windows where getpid() returns an int. */ trace_file_name = g_strdup_printf(CONFIG_TRACE_FILE "-" FMT_pid, (pid_t)getpid()); } else { - trace_file_name = g_strdup_printf("%s", file); + trace_file_name = g_strdup(file); } st_set_trace_file_enabled(saved_enable); diff --git a/ui/console.c b/ui/console.c index 914ed2cc76..6456e8dd90 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1386,9 +1386,7 @@ char *qemu_console_get_label(QemuConsole *con) object_get_typename(c->device), c->head); } else { - return g_strdup_printf("%s", dev->id ? - dev->id : - object_get_typename(c->device)); + return g_strdup(dev->id ? : object_get_typename(c->device)); } } return g_strdup("VGA"); diff --git a/ui/gtk.c b/ui/gtk.c index c023743148..59bda83da6 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1944,8 +1944,7 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc, vcd->console = vc; snprintf(buffer, sizeof(buffer), "vc%d", idx); - vc->label = g_strdup_printf("%s", vc->vte.chr->label - ? vc->vte.chr->label : buffer); + vc->label = g_strdup(vc->vte.chr->label ? : buffer); group = gd_vc_menu_init(s, vc, idx, group, view_menu); vc->vte.terminal = vte_terminal_new(); diff --git a/util/module.c b/util/module.c index 3eb0f06df1..1aa2079d01 100644 --- a/util/module.c +++ b/util/module.c @@ -234,7 +234,7 @@ int module_load(const char *prefix, const char *name, Error **errp) search_dir = getenv("QEMU_MODULE_DIR"); if (search_dir != NULL) { - dirs[n_dirs++] = g_strdup_printf("%s", search_dir); + dirs[n_dirs++] = g_strdup(search_dir); } dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR);