[committed] Make main more readable

Jakub Jelinek jakub@redhat.com
Wed Mar 17 13:18:02 GMT 2021


On Wed, Mar 17, 2021 at 02:14:45PM +0100, Tom de Vries wrote:
> @@ -17048,10 +17050,12 @@ main (int argc, char *argv[])
>    outfile = NULL;
>    hardlink = false;
>    parse_args (argc, argv, &hardlink, &outfile);
> +  nr_files = argc - optind;
> +  files = (const char **)&argv[optind];
>  
> -  if (optind == argc || optind + 1 == argc)
> +  if (nr_files <= 1)
>      {
> -      const char *file = optind == argc ? "a.out" : argv[optind];
> +      const char *file = nr_files == 0 ? "a.out" : files[0];

Isn't that aliasing violation?

	Jakub



More information about the Dwz mailing list