X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Finterps.c;h=61db7f4bdf1724fff5b560482fa7fd0ca6596021;hb=f67c0c9171508672167b6868c67211571421a1c6;hp=b177a8969eba7e0b851963d852b4d6ab5527ef80;hpb=4c2287b0bdfbed95d37d09222fc253f4c5086ada;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/interps.c b/gdb/interps.c index b177a8969e..61db7f4bdf 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -1,6 +1,6 @@ /* Manages interpreters for GDB, the GNU debugger. - Copyright (C) 2000-2017 Free Software Foundation, Inc. + Copyright (C) 2000-2018 Free Software Foundation, Inc. Written by Jim Ingham of Apple Computer, Inc. @@ -439,24 +439,8 @@ interpreter_completer (struct cmd_list_element *ignore, { if (strncmp (interp.name, text, textlen) == 0) { - char *match; - - match = (char *) xmalloc (strlen (word) + strlen (interp.name) + 1); - if (word == text) - strcpy (match, interp.name); - else if (word > text) - { - /* Return some portion of interp->name. */ - strcpy (match, interp.name + (word - text)); - } - else - { - /* Return some of text plus interp->name. */ - strncpy (match, word, text - word); - match[text - word] = '\0'; - strcat (match, interp.name); - } - tracker.add_completion (gdb::unique_xmalloc_ptr (match)); + tracker.add_completion + (make_completion_match_str (interp.name, text, word)); } } }