libzfs: diff: simplify superfluous stdio

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12829
This commit is contained in:
наб 2021-12-09 23:50:41 +01:00 committed by Brian Behlendorf
parent 9bdf0c592b
commit b7ef2340c2
1 changed files with 9 additions and 13 deletions

View File

@ -51,9 +51,9 @@
#define ZDIFF_PREFIX "zfs-diff-%d"
#define ZDIFF_ADDED '+'
#define ZDIFF_MODIFIED 'M'
#define ZDIFF_MODIFIED "M"
#define ZDIFF_REMOVED '-'
#define ZDIFF_RENAMED 'R'
#define ZDIFF_RENAMED "R"
/*
@ -180,16 +180,13 @@ print_rename(FILE *fp, differ_info_t *di, const char *old, const char *new,
(void) fprintf(fp, "%10lld.%09lld\t",
(longlong_t)isb->zs_ctime[0],
(longlong_t)isb->zs_ctime[1]);
(void) fprintf(fp, "%c\t", ZDIFF_RENAMED);
(void) fputs(ZDIFF_RENAMED "\t", fp);
if (di->classify)
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
print_cmn(fp, di, old);
if (di->scripted)
(void) fprintf(fp, "\t");
else
(void) fprintf(fp, " -> ");
(void) fputs(di->scripted ? "\t" : " -> ", fp);
print_cmn(fp, di, new);
(void) fprintf(fp, "\n");
(void) fputc('\n', fp);
}
static void
@ -200,12 +197,11 @@ print_link_change(FILE *fp, differ_info_t *di, int delta, const char *file,
(void) fprintf(fp, "%10lld.%09lld\t",
(longlong_t)isb->zs_ctime[0],
(longlong_t)isb->zs_ctime[1]);
(void) fprintf(fp, "%c\t", ZDIFF_MODIFIED);
(void) fputs(ZDIFF_MODIFIED "\t", fp);
if (di->classify)
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
print_cmn(fp, di, file);
(void) fprintf(fp, "\t(%+d)", delta);
(void) fprintf(fp, "\n");
(void) fprintf(fp, "\t(%+d)\n", delta);
}
static void
@ -220,7 +216,7 @@ print_file(FILE *fp, differ_info_t *di, char type, const char *file,
if (di->classify)
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
print_cmn(fp, di, file);
(void) fprintf(fp, "\n");
(void) fputc('\n', fp);
}
static int
@ -313,7 +309,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj)
print_link_change(fp, di, change,
change > 0 ? fobjname : tobjname, &tsb);
} else if (strcmp(fobjname, tobjname) == 0) {
print_file(fp, di, ZDIFF_MODIFIED, fobjname, &tsb);
print_file(fp, di, *ZDIFF_MODIFIED, fobjname, &tsb);
} else {
print_rename(fp, di, fobjname, tobjname, &tsb);
}