From 298f437a6b0631636cd55d72b8d98d862fc8c51e Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Tue, 22 Feb 2011 18:45:05 +0000 Subject: [PATCH] 2011-02-22 Michael Snyder * cli/cli-utils.c (number_is_in_list): Check for zero return. --- gdb/ChangeLog | 4 ++++ gdb/cli/cli-utils.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1859bf0ffc7..2451004a505 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2011-02-22 Michael Snyder + + * cli/cli-utils.c (number_is_in_list): Check for zero return. + 2011-02-22 Pedro Alves * frame-unwind.h: Fix comment to mention the this frame, not the diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c index 8a7e5d40d31..34c368be9c5 100644 --- a/gdb/cli/cli-utils.c +++ b/gdb/cli/cli-utils.c @@ -175,10 +175,15 @@ number_is_in_list (char *list, int number) if (list == NULL || *list == '\0') return 1; - while (list != NULL && *list != '\0') - if (get_number_or_range (&list) == number) - return 1; + while (*list != '\0') + { + int gotnum = get_number_or_range (&list); + if (gotnum == 0) + error (_("Args must be numbers or '$' variables.")); + if (gotnum == number) + return 1; + } return 0; } -- 2.30.2