On Tue, 7 Jan 2025 at 19:30, Steven Rostedt <[email protected]> wrote:
>
> +
> +static int (*compare_extable)(const void *a, const void *b);
> +static uint64_t (*ehdr_shoff)(Elf_Ehdr *ehdr);
> +static uint16_t (*ehdr_shstrndx)(Elf_Ehdr *ehdr);
...

Side note - and independently of the pure code movement - wouldn't it
be nice to just make this a structure of function pointers, and then
instead of this:

>         case ELFCLASS32:
> +               compare_extable         = compare_extable_32;
> +               ehdr_shoff              = ehdr32_shoff;
> +               ehdr_shentsize          = ehdr32_shentsize;
> +               ehdr_shstrndx           = ehdr32_shstrndx;
> +               ehdr_shnum              = ehdr32_shnum;
...

>         case ELFCLASS64:
> -               {
> +               compare_extable         = compare_extable_64;
> +               ehdr_shoff              = ehdr64_shoff;
> +               ehdr_shentsize          = ehdr64_shentsize;
> +               ehdr_shstrndx           = ehdr64_shstrndx;
> +               ehdr_shnum              = ehdr64_shnum;
...

just pick one of two static structure pointers with these things.

            Linus

Reply via email to