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:
parent
e9897e542d
commit
0e72f5fb83
|
@ -51,9 +51,9 @@
|
||||||
#define ZDIFF_PREFIX "zfs-diff-%d"
|
#define ZDIFF_PREFIX "zfs-diff-%d"
|
||||||
|
|
||||||
#define ZDIFF_ADDED '+'
|
#define ZDIFF_ADDED '+'
|
||||||
#define ZDIFF_MODIFIED 'M'
|
#define ZDIFF_MODIFIED "M"
|
||||||
#define ZDIFF_REMOVED '-'
|
#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",
|
(void) fprintf(fp, "%10lld.%09lld\t",
|
||||||
(longlong_t)isb->zs_ctime[0],
|
(longlong_t)isb->zs_ctime[0],
|
||||||
(longlong_t)isb->zs_ctime[1]);
|
(longlong_t)isb->zs_ctime[1]);
|
||||||
(void) fprintf(fp, "%c\t", ZDIFF_RENAMED);
|
(void) fputs(ZDIFF_RENAMED "\t", fp);
|
||||||
if (di->classify)
|
if (di->classify)
|
||||||
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
|
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
|
||||||
print_cmn(fp, di, old);
|
print_cmn(fp, di, old);
|
||||||
if (di->scripted)
|
(void) fputs(di->scripted ? "\t" : " -> ", fp);
|
||||||
(void) fprintf(fp, "\t");
|
|
||||||
else
|
|
||||||
(void) fprintf(fp, " -> ");
|
|
||||||
print_cmn(fp, di, new);
|
print_cmn(fp, di, new);
|
||||||
(void) fprintf(fp, "\n");
|
(void) fputc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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",
|
(void) fprintf(fp, "%10lld.%09lld\t",
|
||||||
(longlong_t)isb->zs_ctime[0],
|
(longlong_t)isb->zs_ctime[0],
|
||||||
(longlong_t)isb->zs_ctime[1]);
|
(longlong_t)isb->zs_ctime[1]);
|
||||||
(void) fprintf(fp, "%c\t", ZDIFF_MODIFIED);
|
(void) fputs(ZDIFF_MODIFIED "\t", fp);
|
||||||
if (di->classify)
|
if (di->classify)
|
||||||
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
|
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
|
||||||
print_cmn(fp, di, file);
|
print_cmn(fp, di, file);
|
||||||
(void) fprintf(fp, "\t(%+d)", delta);
|
(void) fprintf(fp, "\t(%+d)\n", delta);
|
||||||
(void) fprintf(fp, "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -220,7 +216,7 @@ print_file(FILE *fp, differ_info_t *di, char type, const char *file,
|
||||||
if (di->classify)
|
if (di->classify)
|
||||||
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
|
(void) fprintf(fp, "%c\t", get_what(isb->zs_mode));
|
||||||
print_cmn(fp, di, file);
|
print_cmn(fp, di, file);
|
||||||
(void) fprintf(fp, "\n");
|
(void) fputc('\n', fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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,
|
print_link_change(fp, di, change,
|
||||||
change > 0 ? fobjname : tobjname, &tsb);
|
change > 0 ? fobjname : tobjname, &tsb);
|
||||||
} else if (strcmp(fobjname, tobjname) == 0) {
|
} else if (strcmp(fobjname, tobjname) == 0) {
|
||||||
print_file(fp, di, ZDIFF_MODIFIED, fobjname, &tsb);
|
print_file(fp, di, *ZDIFF_MODIFIED, fobjname, &tsb);
|
||||||
} else {
|
} else {
|
||||||
print_rename(fp, di, fobjname, tobjname, &tsb);
|
print_rename(fp, di, fobjname, tobjname, &tsb);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue