aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-02-19 07:50:21 -0700
committerTom Tromey <tromey@adacore.com>2020-02-19 07:50:21 -0700
commitd3c22fa82e2f9098ad5a0158a73f07db12426fff (patch)
treef0908d443aa596a4f73b0a7203dd885bf6748e4c /gdb/python
parenta7e12755d57879884c523cae1cf009efc9da933c (diff)
downloadgdb-d3c22fa82e2f9098ad5a0158a73f07db12426fff.zip
gdb-d3c22fa82e2f9098ad5a0158a73f07db12426fff.tar.gz
gdb-d3c22fa82e2f9098ad5a0158a73f07db12426fff.tar.bz2
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.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/python.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 27d6042..fbbc159 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1679,12 +1679,7 @@ do_start_initialization ()
std::string oldloc = setlocale (LC_ALL, NULL);
setlocale (LC_ALL, "");
progsize = strlen (progname.get ());
- progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t));
- if (!progname_copy)
- {
- fprintf (stderr, "out of memory\n");
- return false;
- }
+ progname_copy = XNEWVEC (wchar_t, progsize + 1);
count = mbstowcs (progname_copy, progname.get (), progsize + 1);
if (count == (size_t) -1)
{