diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 273127e13..cf9984a3b 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -8,6 +8,14 @@ :see-release-notes: If you are upgrading: please see release notes. :breaking: pass:quotes[*[breaking]*] +[[v4.3.3]] +== Version 4.3.3 (under dev) + +[[v4.3.3_fixed]] +=== Fixed + +* core, plugins: return "0x0" instead of "(nil)" for pointers formatted in strings + [[v4.3.2]] == Version 4.3.2 (2024-06-06) diff --git a/src/core/core-eval.c b/src/core/core-eval.c index 2317d4ba9..e28d54a36 100644 --- a/src/core/core-eval.c +++ b/src/core/core-eval.c @@ -1149,9 +1149,9 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path, int type, debug_id; struct t_hashtable *hashtable; - EVAL_DEBUG_MSG(1, "eval_hdata_get_value(\"%s\", %p, \"%s\")", + EVAL_DEBUG_MSG(1, "eval_hdata_get_value(\"%s\", 0x%lx, \"%s\")", (hdata) ? hdata->name : "(null)", - pointer, + (unsigned long)pointer, path); value = NULL; @@ -1167,7 +1167,7 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path, /* no path? just return current pointer as string */ if (!path || !path[0]) { - snprintf (str_value, sizeof (str_value), "%p", pointer); + snprintf (str_value, sizeof (str_value), "0x%lx", (unsigned long)pointer); value = strdup (str_value); goto end; } @@ -1224,7 +1224,8 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path, break; case WEECHAT_HDATA_POINTER: pointer = hdata_pointer (hdata, pointer, var_name); - snprintf (str_value, sizeof (str_value), "%p", pointer); + snprintf (str_value, sizeof (str_value), + "0x%lx", (unsigned long)pointer); value = strdup (str_value); break; case WEECHAT_HDATA_TIME: @@ -1273,7 +1274,7 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path, case HASHTABLE_POINTER: case HASHTABLE_BUFFER: snprintf (str_value, sizeof (str_value), - "%p", ptr_value); + "0x%lx", (unsigned long)ptr_value); value = strdup (str_value); break; case HASHTABLE_TIME: @@ -1288,7 +1289,8 @@ eval_hdata_get_value (struct t_hdata *hdata, void *pointer, const char *path, } else { - snprintf (str_value, sizeof (str_value), "%p", pointer); + snprintf (str_value, sizeof (str_value), + "0x%lx", (unsigned long)pointer); value = strdup (str_value); } break; @@ -2432,8 +2434,8 @@ eval_replace_regex (const char *string, regex_t *regex, const char *replace, result = NULL; - EVAL_DEBUG_MSG(1, "eval_replace_regex(\"%s\", %p, \"%s\")", - string, regex, replace); + EVAL_DEBUG_MSG(1, "eval_replace_regex(\"%s\", 0x%lx, \"%s\")", + string, (unsigned long)regex, replace); if (!string || !regex || !replace) goto end; diff --git a/src/core/core-hashtable.c b/src/core/core-hashtable.c index 6adbe3eb2..25c8e00ce 100644 --- a/src/core/core-hashtable.c +++ b/src/core/core-hashtable.c @@ -559,7 +559,8 @@ hashtable_to_string (enum t_hashtable_type type, const void *value) break; case HASHTABLE_POINTER: case HASHTABLE_BUFFER: - snprintf (str_value, sizeof (str_value), "%p", value); + snprintf (str_value, sizeof (str_value), "0x%lx", + (unsigned long)value); return str_value; break; case HASHTABLE_TIME: diff --git a/src/core/core-hashtable.h b/src/core/core-hashtable.h index b2c8a8fa3..9ba78e1a3 100644 --- a/src/core/core-hashtable.h +++ b/src/core/core-hashtable.h @@ -43,7 +43,8 @@ struct t_infolist_item; #define HASHTABLE_SET_POINTER(__name, __pointer) \ if (__pointer) \ { \ - snprintf (str_value, sizeof (str_value), "%p", __pointer); \ + snprintf (str_value, sizeof (str_value), \ + "0x%lx", (unsigned long)__pointer); \ hashtable_set (hashtable, __name, str_value); \ } \ else \ diff --git a/src/core/core-input.c b/src/core/core-input.c index f3bddfa5b..22696f75d 100644 --- a/src/core/core-input.c +++ b/src/core/core-input.c @@ -265,7 +265,7 @@ input_data (struct t_gui_buffer *buffer, const char *data, } /* execute modifier "input_text_for_buffer" */ - snprintf (str_buffer, sizeof (str_buffer), "%p", buffer); + snprintf (str_buffer, sizeof (str_buffer), "0x%lx", (unsigned long)buffer); new_data = hook_modifier_exec (NULL, "input_text_for_buffer", str_buffer, diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index bfd20720d..88a36d863 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -947,7 +947,7 @@ gui_bar_item_input_text_cb (const void *pointer, void *data, } /* for modifiers */ - snprintf (str_buffer, sizeof (str_buffer), "%p", buffer); + snprintf (str_buffer, sizeof (str_buffer), "0x%lx", (unsigned long)buffer); /* execute modifier with basic string (without cursor tag) */ ptr_input = NULL; diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index e7fc5a5d4..b2688dbaf 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -434,7 +434,7 @@ gui_bar_check_conditions (struct t_gui_bar *bar, */ snprintf (str_modifier, sizeof (str_modifier), "bar_condition_%s", bar->name); - snprintf (str_window, sizeof (str_window), "%p", window); + snprintf (str_window, sizeof (str_window), "0x%lx", (unsigned long)window); str_displayed = hook_modifier_exec (NULL, str_modifier, str_window, diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 7f1831d65..ba2204419 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -677,8 +677,8 @@ gui_chat_printf_datetime_tags_internal (struct t_gui_buffer *buffer, if (modifier_data && string) { snprintf (modifier_data, length_data, - "%p;%s", - buffer, + "0x%lx;%s", + (unsigned long)buffer, (tags) ? tags : ""); if (display_time) { diff --git a/src/gui/gui-history.c b/src/gui/gui-history.c index 35eddc7c5..add6c9813 100644 --- a/src/gui/gui-history.c +++ b/src/gui/gui-history.c @@ -192,7 +192,7 @@ gui_history_add (struct t_gui_buffer *buffer, const char *string) { char *string2, str_buffer[128]; - snprintf (str_buffer, sizeof (str_buffer), "%p", buffer); + snprintf (str_buffer, sizeof (str_buffer), "0x%lx", (unsigned long)buffer); string2 = hook_modifier_exec (NULL, "history_add", str_buffer, string); /* diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index 442add09d..cce248c4c 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -158,7 +158,8 @@ gui_input_text_changed_modifier_and_signal (struct t_gui_buffer *buffer, gui_buffer_undo_add (buffer); /* send modifier, and change input if needed */ - snprintf (str_buffer, sizeof (str_buffer), "%p", buffer); + snprintf (str_buffer, sizeof (str_buffer), + "0x%lx", (unsigned long)buffer); new_input = hook_modifier_exec (NULL, "input_text_content", str_buffer, diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index 6d7f9e7fd..b79b3a107 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -69,8 +69,8 @@ gui_nicklist_send_signal (const char *signal, struct t_gui_buffer *buffer, if (str_args) { snprintf (str_args, length, - "%p,%s", - buffer, + "0x%lx,%s", + (unsigned long)buffer, (arguments) ? arguments : ""); (void) hook_signal_send (signal, WEECHAT_HOOK_SIGNAL_STRING, str_args); diff --git a/src/plugins/buflist/buflist-mouse.c b/src/plugins/buflist/buflist-mouse.c index 087a618c6..6828e6929 100644 --- a/src/plugins/buflist/buflist-mouse.c +++ b/src/plugins/buflist/buflist-mouse.c @@ -155,7 +155,7 @@ end: } /* add pointer and plugin name */ - snprintf (str_value, sizeof (str_value), "%p", ptr_buffer); + snprintf (str_value, sizeof (str_value), "0x%lx", (unsigned long)ptr_buffer); weechat_hashtable_set (info, "pointer", str_value); weechat_hashtable_set (info, "plugin", weechat_buffer_get_string (ptr_buffer, "plugin")); diff --git a/src/plugins/fset/fset-mouse.c b/src/plugins/fset/fset-mouse.c index 795acce10..fb7d61312 100644 --- a/src/plugins/fset/fset-mouse.c +++ b/src/plugins/fset/fset-mouse.c @@ -82,7 +82,8 @@ fset_mouse_focus_cb (const void *pointer, void *data, struct t_hashtable *info) if (!ptr_fset_option) return info; - snprintf (str_value, sizeof (str_value), "%p", ptr_fset_option); + snprintf (str_value, sizeof (str_value), + "0x%lx", (unsigned long)ptr_fset_option); weechat_hashtable_set (info, "fset_option", str_value); snprintf (str_value, sizeof (str_value), "%ld", option_index); weechat_hashtable_set (info, "fset_option_index", str_value); diff --git a/src/plugins/irc/irc-bar-item.c b/src/plugins/irc/irc-bar-item.c index f32935882..761c7c2d1 100644 --- a/src/plugins/irc/irc-bar-item.c +++ b/src/plugins/irc/irc-bar-item.c @@ -661,7 +661,8 @@ irc_bar_item_focus_buffer_nicklist (const void *pointer, void *data, ptr_nick = irc_nick_search (ptr_server, ptr_channel, nick); if (ptr_nick) { - snprintf (str_value, sizeof (str_value), "%p", ptr_nick); + snprintf (str_value, sizeof (str_value), + "0x%lx", (unsigned long)ptr_nick); weechat_hashtable_set (info, "irc_nick", str_value); if (ptr_nick->host) diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c index f9bb60149..6cbd5b00e 100644 --- a/src/plugins/irc/irc-info.c +++ b/src/plugins/irc/irc-info.c @@ -57,7 +57,7 @@ irc_info_create_string_with_pointer (char **string, void *pointer) *string = malloc (64); if (*string) { - snprintf (*string, 64, "%p", pointer); + snprintf (*string, 64, "0x%lx", (unsigned long)pointer); } } } diff --git a/src/plugins/irc/irc-typing.c b/src/plugins/irc/irc-typing.c index 296fc31bc..fcc1cf9eb 100644 --- a/src/plugins/irc/irc-typing.c +++ b/src/plugins/irc/irc-typing.c @@ -143,8 +143,8 @@ irc_typing_channel_set_nick (struct t_irc_channel *channel, const char *nick, char signal_data[1024]; snprintf (signal_data, sizeof (signal_data), - "%p;%s;%s", - channel->buffer, + "0x%lx;%s;%s", + (unsigned long)channel->buffer, (state == IRC_CHANNEL_TYPING_STATE_ACTIVE) ? "typing" : ((state == IRC_CHANNEL_TYPING_STATE_PAUSED) ? "paused" : "off"), nick); diff --git a/src/plugins/plugin-api-info.c b/src/plugins/plugin-api-info.c index 4c1606264..3f3c1eb5c 100644 --- a/src/plugins/plugin-api-info.c +++ b/src/plugins/plugin-api-info.c @@ -512,7 +512,7 @@ plugin_api_info_buffer_cb (const void *pointer, void *data, if (!ptr_buffer) return NULL; - snprintf (value, sizeof (value), "%p", ptr_buffer); + snprintf (value, sizeof (value), "0x%lx", (unsigned long)ptr_buffer); return strdup (value); } diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c index 809b9cd67..f6408a9a5 100644 --- a/src/plugins/plugin-script.c +++ b/src/plugins/plugin-script.c @@ -379,7 +379,7 @@ plugin_script_ptr2str (void *pointer) return str_pointer[index_pointer]; snprintf (str_pointer[index_pointer], sizeof (str_pointer[index_pointer]), - "%p", pointer); + "0x%lx", (unsigned long)pointer); return str_pointer[index_pointer]; } diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c index 79847cd5a..9fb08cb66 100644 --- a/src/plugins/relay/irc/relay-irc.c +++ b/src/plugins/relay/irc/relay-irc.c @@ -215,7 +215,8 @@ relay_irc_sendf (struct t_relay_client *client, const char *format, ...) hashtable_in = NULL; hashtable_out = NULL; - snprintf (modifier_data, sizeof (modifier_data), "%p", client); + snprintf (modifier_data, sizeof (modifier_data), + "0x%lx", (unsigned long)client); new_msg1 = weechat_hook_modifier_exec ("relay_client_irc_out1", modifier_data, vbuffer); @@ -1641,7 +1642,8 @@ relay_irc_recv (struct t_relay_client *client, const char *data) data); } - snprintf (modifier_data, sizeof (modifier_data), "%p", client); + snprintf (modifier_data, sizeof (modifier_data), + "0x%lx", (unsigned long)client); new_data = weechat_hook_modifier_exec ("relay_client_irc_in", modifier_data, data); diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index 5a9d85351..4264f13ba 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -872,7 +872,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name,short_name," "nicklist,title,local_variables," @@ -896,7 +897,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name,type"); relay_weechat_msg_send (ptr_client, msg); @@ -918,7 +920,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name," "prev_buffer,next_buffer"); @@ -942,7 +945,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name," "prev_buffer,next_buffer"); @@ -966,7 +970,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name," "prev_buffer,next_buffer"); @@ -1010,7 +1015,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name,short_name," "local_variables"); @@ -1033,7 +1039,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name,title"); relay_weechat_msg_send (ptr_client, msg); @@ -1055,7 +1062,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name,local_variables"); relay_weechat_msg_send (ptr_client, msg); @@ -1076,7 +1084,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name"); relay_weechat_msg_send (ptr_client, msg); @@ -1107,8 +1116,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, if (msg) { snprintf (cmd_hdata, sizeof (cmd_hdata), - "line_data:%p", - ptr_line_data); + "line_data:0x%lx", + (unsigned long)ptr_line_data); relay_weechat_msg_add_hdata ( msg, cmd_hdata, "buffer,date,date_usec,date_printed,date_usec_printed," @@ -1133,7 +1142,8 @@ relay_weechat_protocol_signal_buffer_cb (const void *pointer, void *data, msg = relay_weechat_msg_new (str_signal); if (msg) { - snprintf (cmd_hdata, sizeof (cmd_hdata), "buffer:%p", ptr_buffer); + snprintf (cmd_hdata, sizeof (cmd_hdata), + "buffer:0x%lx", (unsigned long)ptr_buffer); relay_weechat_msg_add_hdata (msg, cmd_hdata, "id,number,full_name"); relay_weechat_msg_send (ptr_client, msg); diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index 46daf56e6..fbbaee5f7 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -733,7 +733,10 @@ trigger_callback_signal_cb (const void *pointer, void *data, { str_data[0] = '\0'; if (signal_data) - snprintf (str_data, sizeof (str_data), "%p", signal_data); + { + snprintf (str_data, sizeof (str_data), + "0x%lx", (unsigned long)signal_data); + } ptr_signal_data = str_data; } weechat_hashtable_set (ctx.extra_vars, "tg_signal_data", ptr_signal_data);