New common function "startswith"

This commit introduces a new inline common function "startswith"
which takes two string arguments and returns nonzero if the first
string starts with the second.  It also updates the 295 places
where this logic was written out longhand to use the new function.

gdb/ChangeLog:

	* common/common-utils.h (startswith): New inline function.
	All places where this logic was used updated to use the above.
This commit is contained in:
Gary Benson 2015-03-06 09:42:06 +00:00
parent e80417caef
commit 61012eef84
77 changed files with 309 additions and 329 deletions

View file

@ -878,7 +878,7 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs,
this problem is fixed (no quirk needed). If the armcc
augmentation is missing, the quirk is needed. */
if (fde->cie->version == 3
&& (strncmp (fde->cie->augmentation, "armcc", 5) != 0
&& (!startswith (fde->cie->augmentation, "armcc")
|| strchr (fde->cie->augmentation + 5, '+') == NULL))
fs->armcc_cfa_offsets_reversed = 1;
@ -1935,7 +1935,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start,
/* Ignore armcc augmentations. We only use them for quirks,
and that doesn't happen until later. */
if (strncmp (augmentation, "armcc", 5) == 0)
if (startswith (augmentation, "armcc"))
augmentation += strlen (augmentation);
/* The GCC 2.x "eh" augmentation has a pointer immediately