)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"08645a7f7c36177d59db0496118175e9ccc21fbe","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"e53725c5_c3bb7dab","updated":"2025-08-13 12:36:08.000000000","message":"Thanks for the work on decoupling from JimTCL!\nPlease, take a look at my suggestions. While non-critical, I believe they would be an improvement.","commit_id":"4c4af22066e97617fab6e53648bee4fc9a81c9f2"}],"src/helper/command.c":[{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"08645a7f7c36177d59db0496118175e9ccc21fbe","unresolved":true,"context_lines":[{"line_number":370,"context_line":"\tva_end(ap);"},{"line_number":371,"context_line":"}"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"void command_print(struct command_invocation *cmd, const char *format, ...)"},{"line_number":374,"context_line":"{"},{"line_number":375,"context_line":"\tchar *string;"},{"line_number":376,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"899b2d4c_2b0aeff7","line":373,"updated":"2025-08-13 12:36:08.000000000","message":"Since the performance is not a concern, I\u0027d suggest creating a `static void command_vprintf_sameline(...)` and reusing it here like:\n```\nvoid command_print(struct command_invocation *cmd, const char *format, ...)\n{\n\tva_list ap;\n\tva_start(ap, format);\n\n\tcommand_vprintf_sameline(cmd, format, ap);\n\n\tva_end(ap);\n\t\n\tcommand_print_sameline(cmd, \"\\n\");\n}\n```","commit_id":"4c4af22066e97617fab6e53648bee4fc9a81c9f2"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"7889b4ae992599ffec1d10d85cb452d776426d6c","unresolved":false,"context_lines":[{"line_number":370,"context_line":"\tva_end(ap);"},{"line_number":371,"context_line":"}"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"void command_print(struct command_invocation *cmd, const char *format, ...)"},{"line_number":374,"context_line":"{"},{"line_number":375,"context_line":"\tchar *string;"},{"line_number":376,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"3dbc7964_61fc61d8","line":373,"in_reply_to":"899b2d4c_2b0aeff7","updated":"2025-10-27 14:14:08.000000000","message":"Done in https://review.openocd.org/c/openocd/+/9090","commit_id":"4c4af22066e97617fab6e53648bee4fc9a81c9f2"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"08645a7f7c36177d59db0496118175e9ccc21fbe","unresolved":true,"context_lines":[{"line_number":448,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":449,"context_line":"\t\t\tLOG_DEBUG(\"Command \u0027%s\u0027 failed with error code %d\","},{"line_number":450,"context_line":"\t\t\t\t\t\twords[0], retval);"},{"line_number":451,"context_line":"\t\tif (cmd.output) {"},{"line_number":452,"context_line":"\t\t\t/*"},{"line_number":453,"context_line":"\t\t\t * Use the command output as the Tcl result."},{"line_number":454,"context_line":"\t\t\t * Drop last \u0027\\n\u0027 to allow command output concatenation"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"7ba7e7cf_134653ea","line":451,"updated":"2025-08-13 12:36:08.000000000","message":"I\u0027d suggest:\n\n1. `cmd.output` is initialized to a dynamically allocated empty string.\n2. `!strcmp(cmd.output, \"\")` indicates no output while `!cmd.output` indicates that output is lost due to allocation failure.\n3. `command_print*` early-exit in case `cmd.output` is `NULL`.\n4. In case `!cmd.output` an error code is returned.","commit_id":"4c4af22066e97617fab6e53648bee4fc9a81c9f2"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"e925f8f5dab11869cc4f5cb86ff017620a6adcfa","unresolved":true,"context_lines":[{"line_number":448,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":449,"context_line":"\t\t\tLOG_DEBUG(\"Command \u0027%s\u0027 failed with error code %d\","},{"line_number":450,"context_line":"\t\t\t\t\t\twords[0], retval);"},{"line_number":451,"context_line":"\t\tif (cmd.output) {"},{"line_number":452,"context_line":"\t\t\t/*"},{"line_number":453,"context_line":"\t\t\t * Use the command output as the Tcl result."},{"line_number":454,"context_line":"\t\t\t * Drop last \u0027\\n\u0027 to allow command output concatenation"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"b80dce2c_59fe48e6","line":451,"in_reply_to":"7ba7e7cf_134653ea","updated":"2025-08-20 12:58:55.000000000","message":"I don\u0027t like this deferred error code, even if I have to admit that it allows to easily propagate the error.\nThe way OpenOCD is coded is by having each function returning it\u0027s own error, so I have implemented it in https://review.openocd.org/c/openocd/+/9090\nBut, I don\u0027t expect to change all the calls to command_print(); the event of out-of-memory has to be handled but it\u0027s supposed to be very odd. I\u0027m even not sure the LOG_ERROR() would work in such case.","commit_id":"4c4af22066e97617fab6e53648bee4fc9a81c9f2"},{"author":{"_account_id":1002047,"name":"Evgeniy Naydanov","email":"eugnay@gmail.com","username":"en-sc"},"change_message_id":"7889b4ae992599ffec1d10d85cb452d776426d6c","unresolved":false,"context_lines":[{"line_number":448,"context_line":"\t\tif (retval !\u003d ERROR_OK)"},{"line_number":449,"context_line":"\t\t\tLOG_DEBUG(\"Command \u0027%s\u0027 failed with error code %d\","},{"line_number":450,"context_line":"\t\t\t\t\t\twords[0], retval);"},{"line_number":451,"context_line":"\t\tif (cmd.output) {"},{"line_number":452,"context_line":"\t\t\t/*"},{"line_number":453,"context_line":"\t\t\t * Use the command output as the Tcl result."},{"line_number":454,"context_line":"\t\t\t * Drop last \u0027\\n\u0027 to allow command output concatenation"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"d6813c5b_0beadbd7","line":451,"in_reply_to":"b80dce2c_59fe48e6","updated":"2025-10-27 14:14:08.000000000","message":"Ack","commit_id":"4c4af22066e97617fab6e53648bee4fc9a81c9f2"}]}
