Remove useless NULL check in python.c
I noticed that do_start_initialization, in python.c, checks the result of xmalloc. However, xmalloc cannot fail, so this check is useless. This patch also changes the code to use XNEWVEC. gdb/ChangeLog 2020-02-19 Tom Tromey <tromey@adacore.com> * python/python.c (do_start_initialization): Use XNEWVEC. Remove NULL check.
This commit is contained in:
parent
a7e12755d5
commit
d3c22fa82e
2 changed files with 6 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2020-02-19 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* python/python.c (do_start_initialization): Use XNEWVEC. Remove
|
||||||
|
NULL check.
|
||||||
|
|
||||||
2020-02-19 Maciej W. Rozycki <macro@wdc.com>
|
2020-02-19 Maciej W. Rozycki <macro@wdc.com>
|
||||||
|
|
||||||
* NEWS: Mention RISC-V GNU/Linux GDBserver support.
|
* NEWS: Mention RISC-V GNU/Linux GDBserver support.
|
||||||
|
|
|
@ -1679,12 +1679,7 @@ do_start_initialization ()
|
||||||
std::string oldloc = setlocale (LC_ALL, NULL);
|
std::string oldloc = setlocale (LC_ALL, NULL);
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
progsize = strlen (progname.get ());
|
progsize = strlen (progname.get ());
|
||||||
progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t));
|
progname_copy = XNEWVEC (wchar_t, progsize + 1);
|
||||||
if (!progname_copy)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "out of memory\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
count = mbstowcs (progname_copy, progname.get (), progsize + 1);
|
count = mbstowcs (progname_copy, progname.get (), progsize + 1);
|
||||||
if (count == (size_t) -1)
|
if (count == (size_t) -1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue