Small cache_tree_write refactor.
[gitweb.git] / combine-diff.c
index cff9c5dc426cae9bd517614e00739edc4b40d635..fe5a2a1953a06204ad6f1c045bd06dd984d3acc6 100644 (file)
@@ -215,8 +215,7 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
        parent_file.ptr = grab_blob(parent, &sz);
        parent_file.size = sz;
        xpp.flags = XDF_NEED_MINIMAL;
-       xecfg.ctxlen = 0;
-       xecfg.flags = 0;
+       memset(&xecfg, 0, sizeof(xecfg));
        ecb.outf = xdiff_outf;
        ecb.priv = &state;
        memset(&state, 0, sizeof(state));
@@ -651,10 +650,7 @@ static void dump_quoted_path(const char *prefix, const char *path,
                             const char *c_meta, const char *c_reset)
 {
        printf("%s%s", c_meta, prefix);
-       if (quote_c_style(path, NULL, NULL, 0))
-               quote_c_style(path, NULL, stdout, 0);
-       else
-               printf("%s", path);
+       quote_c_style(path, NULL, stdout, 0);
        printf("%s\n", c_reset);
 }
 
@@ -714,7 +710,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
                        result_size = len;
                        result = xmalloc(len + 1);
                        while (sz < len) {
-                               int done = xread(fd, result+sz, len-sz);
+                               ssize_t done = xread(fd, result+sz, len-sz);
                                if (done == 0)
                                        break;
                                if (done < 0)
@@ -901,16 +897,7 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
                putchar(inter_name_termination);
        }
 
-       if (line_termination) {
-               if (quote_c_style(p->path, NULL, NULL, 0))
-                       quote_c_style(p->path, NULL, stdout, 0);
-               else
-                       printf("%s", p->path);
-               putchar(line_termination);
-       }
-       else {
-               printf("%s%c", p->path, line_termination);
-       }
+       write_name_quoted(p->path, stdout, line_termination);
 }
 
 void show_combined_diff(struct combine_diff_path *p,