diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2023-05-27 14:51:46 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2023-05-27 14:52:17 +0200 |
commit | 9225f9684fedd5c997fc729fee29f8ac402b8db9 (patch) | |
tree | e3a39b09ee58143d0a86660f11760797d5b52c61 | |
parent | 6d9427420bab4ef756444fc8800dbf56d7dacf7d (diff) | |
download | busybox-w32-9225f9684fedd5c997fc729fee29f8ac402b8db9.tar.gz busybox-w32-9225f9684fedd5c997fc729fee29f8ac402b8db9.tar.bz2 busybox-w32-9225f9684fedd5c997fc729fee29f8ac402b8db9.zip |
libbb/dump: make xxd_displayoff member conditional on xxd
With xxd not selected:
function old new delta
display 1459 1444 -15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/dump.h | 8 | ||||
-rw-r--r-- | 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 { | |||
33 | int dump_length; /* max bytes to read */ | 33 | int dump_length; /* max bytes to read */ |
34 | smallint dump_vflag; /*enum dump_vflag_t*/ | 34 | smallint dump_vflag; /*enum dump_vflag_t*/ |
35 | FS *fshead; | 35 | FS *fshead; |
36 | #if ENABLE_XXD | ||
37 | const char *xxd_eofstring; | ||
38 | #endif | ||
39 | #if ENABLE_OD | 36 | #if ENABLE_OD |
40 | const char *od_eofstring; | 37 | const char *od_eofstring; |
41 | #endif | 38 | #endif |
42 | off_t address; /* address/offset in stream */ | 39 | #if ENABLE_XXD |
40 | const char *xxd_eofstring; | ||
43 | long long xxd_displayoff; | 41 | long long xxd_displayoff; |
42 | #endif | ||
43 | off_t address; /* address/offset in stream */ | ||
44 | } dumper_t; | 44 | } dumper_t; |
45 | 45 | ||
46 | dumper_t* alloc_dumper(void) FAST_FUNC; | 46 | 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) | |||
590 | } | 590 | } |
591 | switch (pr->flags) { | 591 | switch (pr->flags) { |
592 | case F_ADDRESS: | 592 | case F_ADDRESS: |
593 | printf(pr->fmt, (unsigned long long) dumper->pub.address + dumper->pub.xxd_displayoff); | 593 | printf(pr->fmt, (unsigned long long) dumper->pub.address |
594 | #if ENABLE_XXD | ||
595 | + dumper->pub.xxd_displayoff | ||
596 | #endif | ||
597 | ); | ||
594 | break; | 598 | break; |
595 | case F_BPAD: | 599 | case F_BPAD: |
596 | printf(pr->fmt, ""); | 600 | printf(pr->fmt, ""); |
@@ -699,7 +703,11 @@ static NOINLINE void display(priv_dumper_t* dumper) | |||
699 | for (pr = dumper->endfu->nextpr; pr; pr = pr->nextpr) { | 703 | for (pr = dumper->endfu->nextpr; pr; pr = pr->nextpr) { |
700 | switch (pr->flags) { | 704 | switch (pr->flags) { |
701 | case F_ADDRESS: | 705 | case F_ADDRESS: |
702 | printf(pr->fmt, (unsigned long long) dumper->eaddress + dumper->pub.xxd_displayoff); | 706 | printf(pr->fmt, (unsigned long long) dumper->eaddress |
707 | #if ENABLE_XXD | ||
708 | + dumper->pub.xxd_displayoff | ||
709 | #endif | ||
710 | ); | ||
703 | break; | 711 | break; |
704 | case F_TEXT: | 712 | case F_TEXT: |
705 | fputs_stdout(pr->fmt); | 713 | fputs_stdout(pr->fmt); |