tweaks: adjust a couple of comments

This commit is contained in:
Benno Schulenberg 2016-05-29 21:45:52 +02:00
parent 4172268bd2
commit b42887fe14

View File

@ -401,15 +401,14 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
/* Get the number of bytes in the multibyte character. */ /* Get the number of bytes in the multibyte character. */
buf_mb_len = mblen(buf, MB_CUR_MAX); buf_mb_len = mblen(buf, MB_CUR_MAX);
/* If buf contains an invalid multibyte character, only /* When the multibyte sequence is invalid, only take the first byte. */
* interpret buf's first byte. */
if (buf_mb_len < 0) { if (buf_mb_len < 0) {
IGNORE_CALL_RESULT(mblen(NULL, 0)); IGNORE_CALL_RESULT(mblen(NULL, 0));
buf_mb_len = 1; buf_mb_len = 1;
} else if (buf_mb_len == 0) } else if (buf_mb_len == 0)
buf_mb_len++; buf_mb_len++;
/* Save the multibyte character in chr. */ /* When requested, store the multibyte character in chr. */
if (chr != NULL) { if (chr != NULL) {
int i; int i;
@ -417,7 +416,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
chr[i] = buf[i]; chr[i] = buf[i];
} }
/* Save the column width of the wide character in col. */ /* When requested, store the width of the wide character in col. */
if (col != NULL) { if (col != NULL) {
/* If we have a tab, get its width in columns using the /* If we have a tab, get its width in columns using the
* current value of col. */ * current value of col. */
@ -435,13 +434,14 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
} else } else
#endif #endif
{ {
/* Get the number of bytes in the byte character. */ /* A byte character is one byte long. */
buf_mb_len = 1; buf_mb_len = 1;
/* Save the byte character in chr. */ /* When requested, store the byte character in chr. */
if (chr != NULL) if (chr != NULL)
*chr = *buf; *chr = *buf;
/* When requested, store the width of the wide character in col. */
if (col != NULL) { if (col != NULL) {
/* If we have a tab, get its width in columns using the /* If we have a tab, get its width in columns using the
* current value of col. */ * current value of col. */