Skip to content

Commit a64c1c5

Browse files
Refactor dt_util_dstrcat to dt_util_str_cat
`gchar *dt_util_dstrcat(gchar *str, const gchar *format, ...)` has been changed to `void dt_util_str_cat(gchar **str, const gchar *format, ...)` As the resulting string replaces str in most cases the code is more dense and clear. Originally implemented by @dterrahe Minor formatting and checked.
1 parent 40f497b commit a64c1c5

37 files changed

+272
-277
lines changed

src/common/act_on.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,12 @@ gboolean _cache_update(const gboolean only_visible,
252252
// if needed, we show the list of cached images in terminal
253253
if((darktable.unmuted & DT_DEBUG_ACT_ON) == DT_DEBUG_ACT_ON)
254254
{
255-
gchar *tx = dt_util_dstrcat
256-
(NULL,
257-
"[images to act on] new cache (%s) : ", only_visible ? "visible" : "all");
255+
gchar *tx = g_strdup_printf
256+
("[images to act on] new cache (%s) : ", only_visible ? "visible" : "all");
258257

259258
for(GList *ll = l;
260259
ll;
261-
ll = g_list_next(ll)) tx = dt_util_dstrcat(tx, "%d ", GPOINTER_TO_INT(ll->data));
260+
ll = g_list_next(ll)) dt_util_str_cat(&tx, "%d ", GPOINTER_TO_INT(ll->data));
262261
dt_print(DT_DEBUG_ACT_ON, "%s\n", tx);
263262
g_free(tx);
264263
}
@@ -382,7 +381,7 @@ gchar *dt_act_on_get_query(const gboolean only_visible)
382381
gchar *images = NULL;
383382
for(; l; l = g_list_next(l))
384383
{
385-
images = dt_util_dstrcat(images, "%d,", GPOINTER_TO_INT(l->data));
384+
dt_util_str_cat(&images, "%d,", GPOINTER_TO_INT(l->data));
386385
}
387386
if(images)
388387
{

0 commit comments

Comments
 (0)