summaryrefslogtreecommitdiff
path: root/gdb/probe.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-30 17:39:34 +0000
committerTom Tromey <tromey@redhat.com>2013-05-30 17:39:34 +0000
commit9a9a177185ba7001908265435d00f0eb2ebfe3cf (patch)
tree57ecea31fb37dae7b0623b371897f504219bb6dc /gdb/probe.c
parentc260d1c1076b7376edf5e78a35387e490a6a7c1b (diff)
downloadgdb-9a9a177185ba7001908265435d00f0eb2ebfe3cf.tar.gz
fix compile_rx_or_error
compile_rx_or_error looks like a constructor, but it can return NULL. This patch changes it to remove the NULL return, making it work like any other cleanup constructor. This is a stylistic patch but I think it is also better for code to follow the normal conventions. * probe.c (collect_probes): Check arguments for NULL before calling compile_rx_or_error. * utils.c (compile_rx_or_error): Require 'rx' to be non-NULL. Remove NULL return.
Diffstat (limited to 'gdb/probe.c')
-rw-r--r--gdb/probe.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/probe.c b/gdb/probe.c
index 05bdd1baef7..3086f4df35d 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -245,9 +245,12 @@ collect_probes (char *objname, char *provider, char *probe_name,
cleanup = make_cleanup (VEC_cleanup (probe_p), &result);
cleanup_temps = make_cleanup (null_cleanup, NULL);
- compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
- compile_rx_or_error (&probe_pat, probe_name, _("Invalid probe regexp"));
- compile_rx_or_error (&obj_pat, objname, _("Invalid object file regexp"));
+ if (provider != NULL)
+ compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
+ if (probe_name != NULL)
+ compile_rx_or_error (&probe_pat, probe_name, _("Invalid probe regexp"));
+ if (objname != NULL)
+ compile_rx_or_error (&obj_pat, objname, _("Invalid object file regexp"));
ALL_OBJFILES (objfile)
{