pmxcfs: status: call g_strdup instead of g_strdup_printf when no formatting is needed
This should be a tiny bit more efficient. Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com> Reviewed-by: Maximiliano Sandoval <m.sandoval@proxmox.com> Link: https://lore.proxmox.com/20250801095431.117317-3-l.wagner@proxmox.com Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
426cb07ed8
commit
c66917260e
1 changed files with 6 additions and 6 deletions
|
|
@ -1369,7 +1369,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
use_pve2_file = 1;
|
||||
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
filename = g_strdup(filename_pve2);
|
||||
} else {
|
||||
// neither file exists, check for directories to decide and create file
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
use_pve2_file = 1;
|
||||
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
filename = g_strdup(filename_pve2);
|
||||
|
||||
char *dir = g_path_get_dirname(filename);
|
||||
checked_mkdir(dir, 0755);
|
||||
|
|
@ -1441,7 +1441,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
// old file exists, use it
|
||||
use_pve2_file = 1;
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
filename = g_strdup(filename_pve2);
|
||||
} else {
|
||||
// neither file exists, check for directories to decide and create file
|
||||
|
||||
|
|
@ -1453,7 +1453,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
use_pve2_file = 1;
|
||||
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
filename = g_strdup(filename_pve2);
|
||||
|
||||
int argcount = sizeof(rrd_def_vm) / sizeof(void *) - 1;
|
||||
create_rrd_file(filename, argcount, rrd_def_vm);
|
||||
|
|
@ -1507,7 +1507,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
} else if (g_file_test(filename_pve2, G_FILE_TEST_EXISTS)) {
|
||||
// old file exists, use it
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
filename = g_strdup(filename_pve2);
|
||||
} else {
|
||||
// neither file exists, check for directories to decide and create file
|
||||
|
||||
|
|
@ -1520,7 +1520,7 @@ static void update_rrd_data(const char *key, gconstpointer data, size_t len) {
|
|||
create_rrd_file(filename, argcount, rrd_def_storage_pve9_0);
|
||||
} else if (g_file_test(RRDDIR "/pve2-storage", G_FILE_TEST_IS_DIR)) {
|
||||
g_free(filename);
|
||||
filename = g_strdup_printf("%s", filename_pve2);
|
||||
filename = g_strdup(filename_pve2);
|
||||
|
||||
char *dir = g_path_get_dirname(filename);
|
||||
checked_mkdir(dir, 0755);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue