This is an automated email from Gerrit.

Antonio Borneo (borneo.anto...@gmail.com) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/5096

-- gerrit

commit 2c98d20e96c4c4b42346b9ba65b7b860c7f84a4b
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sun Apr 7 12:18:05 2019 +0200

    helper/command: remove dead code in command_unknown()
    
    Commit 89fa493a3bc34d22eeca06fa4e78523ac3b766a8 removes the top
    level command "unknown" and adds in command_unknown() some unclear
    code that should detect a user-implemented "unknown" command.
    But, all the commands that trigger the execution of the function
    command_unknown() are registered in register_command_handler() and
    have the command name prefixed with "ocd_".
    Due to such "ocd_" prefix in cmd_name, the condition
        if (strcmp(cmd_name, "unknown") == 0) { ... }
    is always false.
    Nobody complained for almost 10 years so we can proceed to remove
    this dead code, before merging any change that obsoletes the
    prefix "ocd_" and potentially makes the condition true.
    
    Remove the dead code guarded by the condition above.
    
    Change-Id: Icf11a956bb2d68fc84e6eb5779edf8e35db8fa53
    Fixes: 89fa493a3bc3 ("remove unknown handler")
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/helper/command.c b/src/helper/command.c
index ec66c2d..c4db838 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -999,12 +999,6 @@ static int command_unknown_find(unsigned argc, Jim_Obj 
*const *argv,
 static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 {
        const char *cmd_name = Jim_GetString(argv[0], NULL);
-       if (strcmp(cmd_name, "unknown") == 0) {
-               if (argc == 1)
-                       return JIM_OK;
-               argc--;
-               argv++;
-       }
        script_debug(interp, cmd_name, argc, argv);
 
        struct command_context *cmd_ctx = current_command_context(interp);

-- 


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to