[git commit] libbb/dump: make xxd_displayoff member conditional on xxd
Denys Vlasenko
vda.linux at googlemail.com
Sat May 27 12:52:17 UTC 2023
commit: https://git.busybox.net/busybox/commit/?id=9225f9684fedd5c997fc729fee29f8ac402b8db9
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
With xxd not selected:
function old new delta
display 1459 1444 -15
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
include/dump.h | 8 ++++----
libbb/dump.c | 12 ++++++++++--
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/include/dump.h b/include/dump.h
index 8fb92f07b..c6763a64d 100644
--- a/include/dump.h
+++ b/include/dump.h
@@ -33,14 +33,14 @@ typedef struct dumper_t {
int dump_length; /* max bytes to read */
smallint dump_vflag; /*enum dump_vflag_t*/
FS *fshead;
-#if ENABLE_XXD
- const char *xxd_eofstring;
-#endif
#if ENABLE_OD
const char *od_eofstring;
#endif
- off_t address; /* address/offset in stream */
+#if ENABLE_XXD
+ const char *xxd_eofstring;
long long xxd_displayoff;
+#endif
+ off_t address; /* address/offset in stream */
} dumper_t;
dumper_t* alloc_dumper(void) FAST_FUNC;
diff --git a/libbb/dump.c b/libbb/dump.c
index 49340b5a5..70f15c9bd 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -590,7 +590,11 @@ static NOINLINE void display(priv_dumper_t* dumper)
}
switch (pr->flags) {
case F_ADDRESS:
- printf(pr->fmt, (unsigned long long) dumper->pub.address + dumper->pub.xxd_displayoff);
+ printf(pr->fmt, (unsigned long long) dumper->pub.address
+#if ENABLE_XXD
+ + dumper->pub.xxd_displayoff
+#endif
+ );
break;
case F_BPAD:
printf(pr->fmt, "");
@@ -699,7 +703,11 @@ static NOINLINE void display(priv_dumper_t* dumper)
for (pr = dumper->endfu->nextpr; pr; pr = pr->nextpr) {
switch (pr->flags) {
case F_ADDRESS:
- printf(pr->fmt, (unsigned long long) dumper->eaddress + dumper->pub.xxd_displayoff);
+ printf(pr->fmt, (unsigned long long) dumper->eaddress
+#if ENABLE_XXD
+ + dumper->pub.xxd_displayoff
+#endif
+ );
break;
case F_TEXT:
fputs_stdout(pr->fmt);
More information about the busybox-cvs
mailing list