]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/linespec.c: simplify condition
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 3 Dec 2021 21:35:37 +0000 (16:35 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 7 Dec 2021 20:58:54 +0000 (15:58 -0500)
We can remove the empty check: if the vector has size 1, it is obviously
not empty.  This code ended up like this because the empty check used to
be a NULL check.

Change-Id: I1571bd0228818ca93f6a6b444e9b010dc2da4c08

gdb/linespec.c

index 56bfaede9d9a120b5ed5c621982cfdd5960500d8..44134665ac7cdf28f45ccbd50fbf47b33159d5a5 100644 (file)
@@ -2085,8 +2085,7 @@ canonicalize_linespec (struct linespec_state *state, const linespec *ls)
       if (explicit_loc->function_name == NULL)
        {
          /* No function was specified, so add the symbol name.  */
-         gdb_assert (!ls->labels.function_symbols->empty ()
-                     && (ls->labels.function_symbols->size () == 1));
+         gdb_assert (ls->labels.function_symbols->size () == 1);
          block_symbol s = ls->labels.function_symbols->front ();
          explicit_loc->function_name = xstrdup (s.symbol->natural_name ());
        }