I am not willing to look too deeply into this bloated code in url.c.
But from a peephole point of view, what do you think of a codechange like
this:
max_length = get_max_length (fnres.base, fnres.tail, _PC_NAME_MAX);
if (max_length > CHOMP_BUFFER)
max_length -= CHOMP_BUFFER;
else
max_length = 0;
if (max_length > 0 && strlen (temp_fnres.base) > max_length)
{
logprintf (LOG_NOTQUIET, "The name is too long, %lu chars total.\n",
(unsigned long) strlen (temp_fnres.base));
logprintf (LOG_NOTQUIET, "Trying to shorten...\n");
/* Shorten the file name. */
temp_fnres.base[max_length] = '\0';
temp_fnres.tail = max_length;
logprintf (LOG_NOTQUIET, "New name is %s.\n", temp_fnres.base);
}
Regards
Tim Rühsen