Re: [PATCH v2] scripts/sorttable: Move code from sorttable.h into sorttable.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 7 Jan 2025 at 19:30, Steven Rostedt <rostedt@xxxxxxxxxxx> 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux