summaryrefslogtreecommitdiff
path: root/ui-ssdiff.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ssdiff.c')
-rw-r--r--ui-ssdiff.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index 7f261ed..e520b95 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -118,7 +118,6 @@ static char *replace_tabs(char *line)
int n_tabs = 0;
int i;
char *result;
- char *spaces = " ";
if (linelen == 0) {
result = xmalloc(1);
@@ -138,8 +137,17 @@ static char *replace_tabs(char *line)
strcat(result, prev_buf);
break;
} else {
+ char *p;
+ int n;
+
strncat(result, prev_buf, cur_buf - prev_buf);
- strncat(result, spaces, 8 - (strlen(result) % 8));
+
+ n = strlen(result);
+ p = result + n;
+ n = 8 - (n % 8);
+ while (n--)
+ *p++ = ' ';
+ *p = '\0';
}
prev_buf = cur_buf + 1;
}