tabbing: rename four variables, snipping a redundant part

master
Benno Schulenberg 2016-04-16 11:32:37 +02:00
parent 0ccdaff960
commit 4c075f3771
1 changed files with 11 additions and 12 deletions

View File

@ -2833,31 +2833,30 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
char *mzero; char *mzero;
const char *lastslash = revstrstr(buf, "/", buf + *place); const char *lastslash = revstrstr(buf, "/", buf + *place);
size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1; size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1;
char *match1_mb = charalloc(mb_cur_max()); char *match1 = charalloc(mb_cur_max());
char *match2_mb = charalloc(mb_cur_max()); char *match2 = charalloc(mb_cur_max());
int match1_mb_len, match2_mb_len; int match1_len, match2_len;
/* Get the number of characters that all matches have in common. */ /* Get the number of characters that all matches have in common. */
while (TRUE) { while (TRUE) {
match1_mb_len = parse_mbchar(matches[0] + common_len, match1_len = parse_mbchar(matches[0] + common_len, match1, NULL);
match1_mb, NULL);
for (match = 1; match < num_matches; match++) { for (match = 1; match < num_matches; match++) {
match2_mb_len = parse_mbchar(matches[match] + match2_len = parse_mbchar(matches[match] + common_len,
common_len, match2_mb, NULL); match2, NULL);
if (match1_mb_len != match2_mb_len || if (match1_len != match2_len ||
strncmp(match1_mb, match2_mb, match2_mb_len) != 0) strncmp(match1, match2, match2_len) != 0)
break; break;
} }
if (match < num_matches || matches[0][common_len] == '\0') if (match < num_matches || matches[0][common_len] == '\0')
break; break;
common_len += match1_mb_len; common_len += match1_len;
} }
free(match1_mb); free(match1);
free(match2_mb); free(match2);
mzero = charalloc(lastslash_len + common_len + 1); mzero = charalloc(lastslash_len + common_len + 1);