commit 3158133edd83fee0f81d9b29c8577e24319e32e3
parent acf50ae26d2ca679f73360fafa1e22ea883220e8
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 3 Oct 2019 10:12:30 +0200
tweaks: rename three variables, for contrast and more sense
Diffstat:
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/chars.c b/src/chars.c
@@ -222,32 +222,32 @@ int mbwidth(const char *c)
return 1;
}
-/* Convert the Unicode value in chr to a multibyte character, if possible.
+/* Convert the Unicode value in code to a multibyte character, if possible.
* If the conversion succeeds, return the (dynamically allocated) multibyte
* character and its length. Otherwise, return an undefined (dynamically
* allocated) multibyte character and a length of zero. */
-char *make_mbchar(long chr, int *chr_mb_len)
+char *make_mbchar(long code, int *length)
{
- char *chr_mb;
+ char *mb_char;
#ifdef ENABLE_UTF8
if (use_utf8) {
- chr_mb = charalloc(MAXCHARLEN);
- *chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
+ mb_char = charalloc(MAXCHARLEN);
+ *length = wctomb(mb_char, (wchar_t)code);
/* Reject invalid Unicode characters. */
- if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
+ if (*length < 0 || !is_valid_unicode((wchar_t)code)) {
IGNORE_CALL_RESULT(wctomb(NULL, 0));
- *chr_mb_len = 0;
+ *length = 0;
}
} else
#endif
{
- *chr_mb_len = 1;
- chr_mb = mallocstrncpy(NULL, (char *)&chr, 1);
+ mb_char = mallocstrncpy(NULL, (char *)&code, 1);
+ *length = 1;
}
- return chr_mb;
+ return mb_char;
}
/* Return the length (in bytes) of the character located at *pointer. */