This is Refactoring / code cleanup.
See:
* https://refactoring.com/catalog/extractMethod.html
* https://en.wikipedia.org/wiki/Code_refactoring
* https://www.refactoring.com/
* https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/
Some small optimisations may have slipped in as well.
perror("input is too long");
exit(1);
}
- if (!strrchr(input_filename, '.'))
+ char *const extc = strrchr(input_filename, '.');
+ if (!extc)
{
sprintf(data_filename, "%s.dat", input_filename);
}
else
{
strcpy(data_filename, input_filename);
- char *extc = strrchr(input_filename, '.');
*extc = '\0';
}
if (*++av)