(plurize): Change variable name max_len to size to improve readability.

This commit is contained in:
Ron Koenderink 2005-11-14 19:01:36 +00:00
parent 58133fe575
commit 94a0f81f24

View file

@ -54,11 +54,11 @@ iesplur(int n)
/* /*
* Change suffix of BUF to English plural if N > 1. * Change suffix of BUF to English plural if N > 1.
* Best effort, not 100% accurate English. * Best effort, not 100% accurate English.
* Array BUF[MAX_LEN] contains a zero-terminated string. * Array BUF[SIZE] contains a zero-terminated string.
* If there's not enough space for changed suffix, it is truncated. * If there's not enough space for changed suffix, it is truncated.
*/ */
char * char *
plurize(char *buf, int max_len, int n) plurize(char *buf, int size, int n)
{ {
size_t len = strlen(buf); size_t len = strlen(buf);
@ -68,13 +68,13 @@ plurize(char *buf, int max_len, int n)
switch(buf[len - 1]) { switch(buf[len - 1]) {
case 'y': case 'y':
buf[len - 1] = '\0'; buf[len - 1] = '\0';
strncat(buf, "ies", max_len - len - 1); strncat(buf, "ies", size - len - 1);
break; break;
case 's': case 's':
strncat(buf, "es", max_len - len - 1); strncat(buf, "es", size - len - 1);
break; break;
default: default:
strncat(buf, "s", max_len - len - 1); strncat(buf, "s", size - len - 1);
} }
return buf; return buf;
} }