)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"8ab5721a69273d3dcc3dd76aaafcc9d4e403618a","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"33084195_0c191d35","updated":"2025-12-14 11:45:11.000000000","message":"I have put this series on hold to rethink on it.\nHaving the `command_print()` returning error only because of a the low probability event of memory allocation failure risks to add complexity to the whole OpenOCD code.\nI reconsidering the suggestion from Evgeniy in 9076: store the allocation error during `command_print()` and use it to return error at the end of `exec_command()`.","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"d2375691ee1a77227d4456cad730b67aa5c477b0","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"89fc6bc2_a882ac53","updated":"2025-08-26 12:07:13.000000000","message":"One minor suggestion","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"}],"src/helper/command.c":[{"author":{"_account_id":1000160,"name":"Paul Fertser","email":"fercerpav@gmail.com","username":"pfertser"},"change_message_id":"be0a56170494b5e3f2b4738662b4a56ba8b2971b","unresolved":true,"context_lines":[{"line_number":352,"context_line":"static int command_vprint(struct command_invocation *cmd,"},{"line_number":353,"context_line":"\t\tva_list ap, const char *format, bool add_lf)"},{"line_number":354,"context_line":"{"},{"line_number":355,"context_line":"\t/*"},{"line_number":356,"context_line":"\t * FIXME: Why this check on !cmd ?"},{"line_number":357,"context_line":"\t * Commit 7f260f5009a7 that introduces it, does not explain why!"},{"line_number":358,"context_line":"\t * Was author not confident on the code change?"},{"line_number":359,"context_line":"\t */"},{"line_number":360,"context_line":"\tif (!cmd)"},{"line_number":361,"context_line":"\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d3891d0f_a5147051","line":358,"range":{"start_line":355,"start_character":3,"end_line":358,"end_character":48},"updated":"2025-08-20 13:45:28.000000000","message":"I got curious and did some archeology to try to understand my motivation back then. The original version https://review.openocd.org/c/openocd/+/1815/1 is from 2013 (oh my!) and its parent was \t * 30fb9dd4 . Back then there were ten instances of `command_print[_sameline](NULL,` in src/target/target.c in jim_handler callbacks (hence lacking command/context). Since then (around 2019) you converted all the spots to either become proper full \"handler\" or to use LOG_* functions where appropriate so the check is indeed redundant now. But back then I was confident and correct (in this detail) ;)","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"cdadf09a05833456efc30f8faa7fb3f3f3c1aab7","unresolved":false,"context_lines":[{"line_number":352,"context_line":"static int command_vprint(struct command_invocation *cmd,"},{"line_number":353,"context_line":"\t\tva_list ap, const char *format, bool add_lf)"},{"line_number":354,"context_line":"{"},{"line_number":355,"context_line":"\t/*"},{"line_number":356,"context_line":"\t * FIXME: Why this check on !cmd ?"},{"line_number":357,"context_line":"\t * Commit 7f260f5009a7 that introduces it, does not explain why!"},{"line_number":358,"context_line":"\t * Was author not confident on the code change?"},{"line_number":359,"context_line":"\t */"},{"line_number":360,"context_line":"\tif (!cmd)"},{"line_number":361,"context_line":"\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"6b1fdd72_9f9f48b7","line":358,"range":{"start_line":355,"start_character":3,"end_line":358,"end_character":48},"in_reply_to":"2061f2a7_65652aa7","updated":"2026-01-11 18:14:50.000000000","message":"fixed in next patch","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"bd197e4ccc8269b259c6624716d5a241d2b93a58","unresolved":true,"context_lines":[{"line_number":352,"context_line":"static int command_vprint(struct command_invocation *cmd,"},{"line_number":353,"context_line":"\t\tva_list ap, const char *format, bool add_lf)"},{"line_number":354,"context_line":"{"},{"line_number":355,"context_line":"\t/*"},{"line_number":356,"context_line":"\t * FIXME: Why this check on !cmd ?"},{"line_number":357,"context_line":"\t * Commit 7f260f5009a7 that introduces it, does not explain why!"},{"line_number":358,"context_line":"\t * Was author not confident on the code change?"},{"line_number":359,"context_line":"\t */"},{"line_number":360,"context_line":"\tif (!cmd)"},{"line_number":361,"context_line":"\t\treturn ERROR_OK;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"2061f2a7_65652aa7","line":358,"range":{"start_line":355,"start_character":3,"end_line":358,"end_character":48},"in_reply_to":"d3891d0f_a5147051","updated":"2025-08-20 13:49:40.000000000","message":"Thanks for the archeological research!\nI remembered such odd cases, but I\u0027m not 100% sure we have dropper them all.\nThe assert() in this case should work to detect and fix the last ones","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"d2375691ee1a77227d4456cad730b67aa5c477b0","unresolved":true,"context_lines":[{"line_number":371,"context_line":"\t\tstrcat(string, \"\\n\");"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"\tchar *output \u003d cmd-\u003eoutput ? cmd-\u003eoutput : \"\";"},{"line_number":374,"context_line":"\toutput \u003d alloc_printf(\"%s%s\", output, string);"},{"line_number":375,"context_line":"\tfree(string);"},{"line_number":376,"context_line":"\tif (!output) {"},{"line_number":377,"context_line":"\t\tLOG_ERROR(\"Out of memory\");"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d8e75bea_f8442bb6","line":374,"updated":"2025-08-26 12:07:13.000000000","message":"Maybe\n```\noutput \u003d alloc_printf(\"%s%s%s\", output, string, add_lf ? \"\\n\" : \"\");\n```\n\nThis will no longer rely on the hack with one extra allocated char.","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"a286c679d6a1d42ee4022a215ef8ed577cdcd75b","unresolved":false,"context_lines":[{"line_number":371,"context_line":"\t\tstrcat(string, \"\\n\");"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"\tchar *output \u003d cmd-\u003eoutput ? cmd-\u003eoutput : \"\";"},{"line_number":374,"context_line":"\toutput \u003d alloc_printf(\"%s%s\", output, string);"},{"line_number":375,"context_line":"\tfree(string);"},{"line_number":376,"context_line":"\tif (!output) {"},{"line_number":377,"context_line":"\t\tLOG_ERROR(\"Out of memory\");"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"b819f853_d45b4cc9","line":374,"in_reply_to":"53056ac8_a12f889a","updated":"2025-10-27 14:12:54.000000000","message":"Ack","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"ef629b2643bd48403057c109a7400d2e8db85f43","unresolved":true,"context_lines":[{"line_number":371,"context_line":"\t\tstrcat(string, \"\\n\");"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"\tchar *output \u003d cmd-\u003eoutput ? cmd-\u003eoutput : \"\";"},{"line_number":374,"context_line":"\toutput \u003d alloc_printf(\"%s%s\", output, string);"},{"line_number":375,"context_line":"\tfree(string);"},{"line_number":376,"context_line":"\tif (!output) {"},{"line_number":377,"context_line":"\t\tLOG_ERROR(\"Out of memory\");"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"53056ac8_a12f889a","line":374,"in_reply_to":"d8e75bea_f8442bb6","updated":"2025-10-18 08:45:52.000000000","message":"I prefer to do it in a separate patch. I want to check if we can drop this hack completely.","commit_id":"6330906ff8f9ca8a1cf1832636476fddfad659a9"}]}
