[PATCH] remove nested functions from elf/dl-load.c

Roland McGrath roland@hack.frob.com
Wed Oct 1 23:16:00 GMT 2014


>         * elf/dl-load.c
>         (add_path): New function broken out of _dl_rtld_di_serinfo.
>         (_dl_rtld_di_serinfo): Remove a nested function. Update call sites.

Two spaces between sentences.  Say "remove that" instead of "remove a".

> +struct add_path_args

This is not the arguments to the function so much as it's the state
relevant to the function.  So add_path_state seems like a better name.

>  {
> +  struct add_path_args p;
>    if (counting)
>      {
>        si->dls_cnt = 0;
>        si->dls_size = 0;
>      }
> +  p.counting = counting;
> +  p.idx = 0;
> +  p.allocptr = (char *) &si->dls_serpath[si->dls_cnt];
> +  p.si = si;

Use an initializing definition, and put that exactly where the previous
definitions of the shared locals were.  That is, after the if block and a
blank line.

The change is OK with those fixes.


Thanks,
Roland



More information about the Libc-alpha mailing list