+2021-01-08 Timm Bäder <tbaeder@redhat.com>
+
+ * readelf.c (print_attributes): Lift left function to...
+ (left): ...here. New file scope function taking Elf_Data and char
+ pointers.
+
2021-01-08 Timm Bäder <tbaeder@redhat.com>
* readelf.c (handle_core_registers): Lift same_set function to...
}
}
+static inline size_t
+left (Elf_Data *data,
+ const unsigned char *p)
+{
+ return (const unsigned char *) data->d_buf + data->d_size - p;
+}
+
static void
print_attributes (Ebl *ebl, const GElf_Ehdr *ehdr)
{
fputs_unlocked (_(" Owner Size\n"), stdout);
- inline size_t left (void)
- {
- return (const unsigned char *) data->d_buf + data->d_size - p;
- }
-
/* Loop over the sections. */
- while (left () >= 4)
+ while (left (data, p) >= 4)
{
/* Section length. */
uint32_t len;
if (MY_ELFDATA != ehdr->e_ident[EI_DATA])
CONVERT (len);
- if (unlikely (len > left ()))
+ if (unlikely (len > left (data, p)))
break;
/* Section vendor name. */