Skip to content

Commit 61e41e8

Browse files
authored
Merge pull request #17696 from jenshannoschwalm/refactor_dt_print
Some more code maintenance based on dterrahes work
2 parents 40f497b + 8a312fb commit 61e41e8

File tree

220 files changed

+1835
-1848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+1835
-1848
lines changed

src/bauhaus/bauhaus.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ void dt_bauhaus_widget_set_field(GtkWidget *widget,
11231123
if(*w->label)
11241124
dt_print(DT_DEBUG_ALWAYS,
11251125
"[dt_bauhaus_widget_set_field] bauhaus label '%s'"
1126-
" set before field (needs to be after)\n",
1126+
" set before field (needs to be after)",
11271127
w->label);
11281128
w->field = field;
11291129
w->field_type = field_type;
@@ -1213,7 +1213,7 @@ void dt_bauhaus_update_from_field(dt_iop_module_t *module,
12131213
break;
12141214
default:
12151215
dt_print(DT_DEBUG_ALWAYS,
1216-
"[dt_bauhaus_update_from_field] unsupported slider data type\n");
1216+
"[dt_bauhaus_update_from_field] unsupported slider data type");
12171217
}
12181218
break;
12191219
case DT_BAUHAUS_COMBOBOX:
@@ -1233,7 +1233,7 @@ void dt_bauhaus_update_from_field(dt_iop_module_t *module,
12331233
break;
12341234
default:
12351235
dt_print(DT_DEBUG_ALWAYS,
1236-
"[dt_bauhaus_update_from_field] unsupported combo data type\n");
1236+
"[dt_bauhaus_update_from_field] unsupported combo data type");
12371237
}
12381238
break;
12391239
default:
@@ -1769,7 +1769,7 @@ static void _combobox_set(dt_bauhaus_widget_t *w,
17691769
if(*b != prevb) dt_iop_gui_changed(w->module, GTK_WIDGET(w), &prevb);
17701770
break;
17711771
default:
1772-
dt_print(DT_DEBUG_ALWAYS, "[_combobox_set] unsupported combo data type\n");
1772+
dt_print(DT_DEBUG_ALWAYS, "[_combobox_set] unsupported combo data type");
17731773
}
17741774
}
17751775
_highlight_changed_notebook_tab(GTK_WIDGET(w),
@@ -1905,7 +1905,7 @@ void dt_bauhaus_slider_set_stop(GtkWidget *widget,
19051905
else
19061906
{
19071907
dt_print(DT_DEBUG_ALWAYS,
1908-
"[bauhaus_slider_set_stop] only %d stops allowed.\n",
1908+
"[bauhaus_slider_set_stop] only %d stops allowed",
19091909
DT_BAUHAUS_SLIDER_MAX_STOPS);
19101910
}
19111911
}
@@ -3230,7 +3230,7 @@ static void _slider_value_change(dt_bauhaus_widget_t *w)
32303230
break;
32313231
default:
32323232
dt_print(DT_DEBUG_ALWAYS,
3233-
"[_slider_value_change] unsupported slider data type\n");
3233+
"[_slider_value_change] unsupported slider data type");
32343234
}
32353235
}
32363236

@@ -3554,15 +3554,15 @@ void dt_bauhaus_vimkey_exec(const char *input)
35543554
case DT_BAUHAUS_SLIDER:
35553555
old_value = dt_bauhaus_slider_get(w);
35563556
new_value = dt_calculator_solve(old_value, input);
3557-
dt_print(DT_DEBUG_ALWAYS, " = %f\n", new_value);
3557+
dt_print(DT_DEBUG_ALWAYS, " = %f", new_value);
35583558
if(dt_isfinite(new_value))
35593559
dt_bauhaus_slider_set(w, new_value);
35603560
break;
35613561
case DT_BAUHAUS_COMBOBOX:
35623562
// TODO: what about text as entry?
35633563
old_value = dt_bauhaus_combobox_get(w);
35643564
new_value = dt_calculator_solve(old_value, input);
3565-
dt_print(DT_DEBUG_ALWAYS, " = %f\n", new_value);
3565+
dt_print(DT_DEBUG_ALWAYS, " = %f", new_value);
35663566
if(dt_isfinite(new_value))
35673567
dt_bauhaus_combobox_set(w, new_value);
35683568
break;
@@ -3673,7 +3673,7 @@ static float _action_process_slider(gpointer target,
36733673
break;
36743674
default:
36753675
dt_print(DT_DEBUG_ALWAYS,
3676-
"[_action_process_slider] unknown shortcut effect (%d) for slider\n",
3676+
"[_action_process_slider] unknown shortcut effect (%d) for slider",
36773677
effect);
36783678
break;
36793679
}
@@ -3710,7 +3710,7 @@ static float _action_process_slider(gpointer target,
37103710
break;
37113711
default:
37123712
dt_print(DT_DEBUG_ALWAYS,
3713-
"[_action_process_slider] unknown shortcut effect (%d) for slider\n",
3713+
"[_action_process_slider] unknown shortcut effect (%d) for slider",
37143714
effect);
37153715
break;
37163716
}
@@ -3719,7 +3719,7 @@ static float _action_process_slider(gpointer target,
37193719
break;
37203720
default:
37213721
dt_print(DT_DEBUG_ALWAYS,
3722-
"[_action_process_slider] unknown shortcut element (%d) for slider\n",
3722+
"[_action_process_slider] unknown shortcut element (%d) for slider",
37233723
element);
37243724
break;
37253725
}

src/common/act_on.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,13 @@ 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));
262-
dt_print(DT_DEBUG_ACT_ON, "%s\n", tx);
260+
ll = g_list_next(ll)) dt_util_str_cat(&tx, "%d ", GPOINTER_TO_INT(ll->data));
261+
dt_print(DT_DEBUG_ACT_ON, "%s", tx);
263262
g_free(tx);
264263
}
265264

@@ -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
{
@@ -443,7 +442,7 @@ dt_imgid_t dt_act_on_get_main_image()
443442
}
444443

445444
if((darktable.unmuted & DT_DEBUG_ACT_ON) == DT_DEBUG_ACT_ON)
446-
dt_print(DT_DEBUG_ACT_ON, "[images to act on] single image : %d\n", ret);
445+
dt_print(DT_DEBUG_ACT_ON, "[images to act on] single image : %d", ret);
447446

448447
return ret;
449448
}

src/common/bilateral.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ void dt_bilateral_grid_size(dt_bilateral_t *b,
7676
#if 0
7777
if(b->sigma_s != sigma_s)
7878
dt_print(DT_DEBUG_ALWAYS,
79-
"[bilateral] clamped sigma_s (%g -> %g)!\n",sigma_s,b->sigma_s);
79+
"[bilateral] clamped sigma_s (%g -> %g)!",sigma_s,b->sigma_s);
8080
if(b->sigma_r != sigma_r)
8181
dt_print(DT_DEBUG_ALWAYS,
82-
"[bilateral] clamped sigma_r (%g -> %g)!\n",sigma_r,b->sigma_r);
82+
"[bilateral] clamped sigma_r (%g -> %g)!",sigma_r,b->sigma_r);
8383
#endif
8484
}
8585

@@ -187,13 +187,13 @@ dt_bilateral_t *dt_bilateral_init(const int width, // width of input image
187187
if(!b->buf)
188188
{
189189
dt_print(DT_DEBUG_ALWAYS,
190-
"[bilateral] unable to allocate buffer for %zux%zux%zu grid\n",
190+
"[bilateral] unable to allocate buffer for %zux%zux%zu grid",
191191
b->size_x,b->size_y,b->size_z);
192192
free(b);
193193
return NULL;
194194
}
195195
dt_print(DT_DEBUG_DEV,
196-
"[bilateral] created grid [%ld %ld %ld] with sigma (%f %f) (%f %f)\n",
196+
"[bilateral] created grid [%ld %ld %ld] with sigma (%f %f) (%f %f)",
197197
b->size_x, b->size_y, b->size_z, b->sigma_s, sigma_s, b->sigma_r, sigma_r);
198198
return b;
199199
}

src/common/bilateralcl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ dt_bilateral_cl_t *dt_bilateral_init_cl(const int devid,
8787
if(!dt_opencl_local_buffer_opt(devid, darktable.opencl->bilateral->kernel_splat, &locopt))
8888
{
8989
dt_print(DT_DEBUG_OPENCL,
90-
"[opencl_bilateral] can not identify resource limits for device %d in bilateral grid\n", devid);
90+
"[opencl_bilateral] can not identify resource limits for device %d in bilateral grid", devid);
9191
return NULL;
9292
}
9393

9494
if(locopt.sizex * locopt.sizey < 16 * 16)
9595
{
9696
dt_print(DT_DEBUG_OPENCL,
97-
"[opencl_bilateral] device %d does not offer sufficient resources to run bilateral grid\n",
97+
"[opencl_bilateral] device %d does not offer sufficient resources to run bilateral grid",
9898
devid);
9999
return NULL;
100100
}

src/common/box_filters.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ void dt_box_mean_horizontal(float *const __restrict__ buf,
651651
dt_free_align(scratch);
652652
}
653653
else
654-
dt_print(DT_DEBUG_ALWAYS,"[box_mean] unable to allocate scratch memory\n");
654+
dt_print(DT_DEBUG_ALWAYS, "[box_mean] unable to allocate scratch memory");
655655
}
656656
else if(ch == (9|BOXFILTER_KAHAN_SUM))
657657
{
@@ -664,7 +664,7 @@ void dt_box_mean_horizontal(float *const __restrict__ buf,
664664
dt_free_align(scratch);
665665
}
666666
else
667-
dt_print(DT_DEBUG_ALWAYS,"[box_mean] unable to allocate scratch memory\n");
667+
dt_print(DT_DEBUG_ALWAYS, "[box_mean] unable to allocate scratch memory");
668668
}
669669
else
670670
dt_unreachable_codepath();

src/common/cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ dt_cache_entry_t *dt_cache_testget(dt_cache_t *cache,
134134
dt_pthread_mutex_unlock(&cache->lock);
135135
const double end = dt_get_debug_wtime();
136136
if(end - start > 0.1)
137-
dt_print(DT_DEBUG_ALWAYS, "try+ wait time %.06fs mode %c \n", end - start, mode);
137+
dt_print(DT_DEBUG_ALWAYS, "try+ wait time %.06fs mode %c", end - start, mode);
138138

139139
if(mode == 'w')
140140
{
@@ -149,7 +149,7 @@ dt_cache_entry_t *dt_cache_testget(dt_cache_t *cache,
149149
dt_pthread_mutex_unlock(&cache->lock);
150150
const double end = dt_get_debug_wtime();
151151
if(end - start > 0.1)
152-
dt_print(DT_DEBUG_ALWAYS, "try- wait time %.06fs\n", end - start);
152+
dt_print(DT_DEBUG_ALWAYS, "try- wait time %.06fs", end - start);
153153
return 0;
154154
}
155155

@@ -226,7 +226,7 @@ dt_cache_entry_t *dt_cache_get_with_caller(dt_cache_t *cache,
226226
// here dies your 32-bit system:
227227
dt_cache_entry_t *entry = (dt_cache_entry_t *)g_slice_alloc(sizeof(dt_cache_entry_t));
228228
const int ret = dt_pthread_rwlock_init(&entry->lock, 0);
229-
if(ret) dt_print(DT_DEBUG_ALWAYS, "rwlock init: %d\n", ret);
229+
if(ret) dt_print(DT_DEBUG_ALWAYS, "rwlock init: %d", ret);
230230

231231
entry->data = 0;
232232
entry->data_size = cache->entry_size;
@@ -264,7 +264,7 @@ dt_cache_entry_t *dt_cache_get_with_caller(dt_cache_t *cache,
264264
dt_pthread_mutex_unlock(&cache->lock);
265265
const double end = dt_get_debug_wtime();
266266
if(end - start > 0.1)
267-
dt_print(DT_DEBUG_ALWAYS, "wait time %.06fs\n", end - start);
267+
dt_print(DT_DEBUG_ALWAYS, "wait time %.06fs", end - start);
268268

269269
// WARNING: do *NOT* unpoison here. it must be done by the caller!
270270

0 commit comments

Comments
 (0)