From efec55cf62f798e6a4ec1fa7fc177be6720cf061 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 4 Mar 2024 13:46:33 +0200 Subject: [PATCH] color-lcms: print transformation id instead of pointer Pointer values are hard to track for humans, being long numbers. Now that we have unique id for each color transformation, print that instead of the pointer. It is a small number easy to track for humans. Transformation id numbers do get re-used aggressively, so you have to keep track of what is being destroyed and created over time when reading logs. Pointers had the same caveat, just a lot more random. The prefix 't' indicates "transformation". Signed-off-by: Pekka Paalanen --- libweston/color-lcms/color-lcms.c | 2 +- libweston/color-lcms/color-transform.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libweston/color-lcms/color-lcms.c b/libweston/color-lcms/color-lcms.c index e9efd833..10839787 100644 --- a/libweston/color-lcms/color-lcms.c +++ b/libweston/color-lcms/color-lcms.c @@ -327,7 +327,7 @@ transforms_scope_new_sub(struct weston_log_subscription *subs, void *data) weston_log_subscription_printf(subs, "Existent:\n"); wl_list_for_each(xform, &cm->color_transform_list, link) { - weston_log_subscription_printf(subs, "Color transformation %p:\n", xform); + weston_log_subscription_printf(subs, "Color transformation t%u:\n", xform->base.id); str = cmlcms_color_transform_search_param_string(&xform->search_key); weston_log_subscription_printf(subs, "%s", str); diff --git a/libweston/color-lcms/color-transform.c b/libweston/color-lcms/color-transform.c index e13def76..3cd71eeb 100644 --- a/libweston/color-lcms/color-transform.c +++ b/libweston/color-lcms/color-transform.c @@ -171,7 +171,7 @@ cmlcms_color_transform_destroy(struct cmlcms_color_transform *xform) unref_cprof(xform->search_key.output_profile); weston_log_scope_printf(cm->transforms_scope, - "Destroyed color transformation %p.\n", xform); + "Destroyed color transformation t%u.\n", xform->base.id); free(xform); } @@ -841,8 +841,9 @@ lcms_xform_error_logger(cmsContext context_id, in = xform->search_key.input_profile; out = xform->search_key.output_profile; - weston_log("LittleCMS error with color transformation from " + weston_log("LittleCMS error with color transformation t%u from " "'%s' (p%u) to '%s' (p%u), %s: %s\n", + xform->base.id, in ? in->base.description : "(none)", in ? in->base.id : 0, out ? out->base.description : "(none)", @@ -1007,7 +1008,7 @@ cmlcms_color_transform_create(struct weston_color_manager_lcms *cm, xform->search_key.output_profile = ref_cprof(search_param->output_profile); weston_log_scope_printf(cm->transforms_scope, - "New color transformation: %p\n", xform); + "New color transformation: t%u\n", xform->base.id); str = cmlcms_color_transform_search_param_string(&xform->search_key); weston_log_scope_printf(cm->transforms_scope, "%s", str); free(str);