[PATCH 5/5] readelf: Pull advance_pc() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way Signed-off-by: Timm Bäder --- src/readelf.c | 39 +++ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index e0163891..9758d338 100644 --- a/src/readelf.c +++

[PATCH 4/5] readelf: Pull regname() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/readelf.c | 42 -- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 99e90c34..e0163891 100644 --- a/src/readelf.c

[PATCH 3/5] readelf: Pull left() info file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/readelf.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 0157f8a2..99e90c34 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -357

[PATCH 2/5] readelf: Pull same_set() info file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way Signed-off-by: Timm Bäder --- src/readelf.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index a95fc0aa..0157f8a2 100644 --- a/src/readelf.c +++ b/src/readelf.

[PATCH 1/5] readelf: Pull add_dump_section() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/readelf.c | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 829a418d..a95fc0aa 100644 --- a/src/readelf.c +++ b/s

Remove nested functions from readelf.c

2021-01-08 Thread Timm Bäder via Elfutils-devel
Hi, here another round for src/readelf.c. I think they are simple, but I'm not happy with the advance_pc() commit. I'm open for suggestions here but I can't come up with something better right now. I'll keep looking in to that in the meantime. - Timm

[PATCH 4/4] arlib-argp: Pull text_for_default() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/arlib-argp.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/arlib-argp.c b/src/arlib-argp.c index c07d9299..a3c12e4d 100644 --- a/src/arlib-argp.c +++ b/sr

[PATCH 3/4] ar: Pull should_truncate_fname() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/ar.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ar.c b/src/ar.c index 2a17d0d3..7d0298dd 100644 --- a/src/ar.c +++ b/src/ar.c @@ -436,6 +4

[PATCH 2/4] zstrptr: Pull print_string() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- tests/zstrptr.c | 43 ++- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tests/zstrptr.c b/tests/zstrptr.c index 6d8e19f7..9fb42e28 100644 --- a/tests/

[PATCH 1/4] addr2line: Pull show_note() and show_int() in file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of the nested functions Signed-off-by: Timm Bäder --- src/addr2line.c | 47 ++- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/addr2line.c b/src/addr2line.c index ea01c1be..34945046 100644 --- a/src/addr2

Misc single nested function removals

2021-01-08 Thread Timm Bäder via Elfutils-devel
Hi, here a few patches to remove single nested functions from - addr2line.c - tests/zstrptr.c - ar.c - arlib-argp.c I think they are pretty straight-forward again. - Timm

[PATCH 2/2] elf-from-memory: Refactor to get rid of nested function

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Try to unify the 32/64 bit code paths and get rid of the nested handle_segment() this way. Signed-off-by: Timm Bäder --- libdwfl/elf-from-memory.c | 115 +- 1 file changed, 50 insertions(+), 65 deletions(-) diff --git a/libdwfl/elf-from-mem

[PATCH 1/2] elf-from-memory: Restructure code to get rid of nested handle_segment()

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Use one loop for both 32 and 64 bit case. This allows for only one call site of the old handle_segment(), which we can then inline into the for loop. Signed-off-by: Timm Bäder --- libdwfl/elf-from-memory.c | 81 --- 1 file changed, 34 inser

Remove nested functions from elf-from-memory.c

2021-01-08 Thread Timm Bäder via Elfutils-devel
Hey, these are relatively straight-forward I think. Let me know if that's not the case. :) - Timm

[PATCH 4/4] strip: Remove no_symtab_updates() function

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder The no_symtab_updates() function was being called at the beginning of all case labels in this switch, so we can just call it once before the switch. Then it only has one call-site, so inline this short function there. Signed-off-by: Timm Bäder --- src/strip.c | 152 +++

[PATCH 3/4] strip: Pull update_section_size() into file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Get rid of a nested function this way. Signed-off-by: Timm Bäder --- src/strip.c | 51 --- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/strip.c b/src/strip.c index 71913fac..e608dc5e 100644 --- a/src/strip.

[PATCH 2/4] strip: Pull relocate() info file scope

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Pull relocate() info file scope and get rid of a nested function this way. Refactor remove_debug_relocations() to minimize the parameters we need to pass to relocate(). Signed-off-by: Timm Bäder --- src/strip.c | 347 1 file

[PATCH 1/4] strip: Replace nested check_preserved function with loop

2021-01-08 Thread Timm Bäder via Elfutils-devel
From: Timm Bäder Signed-off-by: Timm Bäder --- src/strip.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/strip.c b/src/strip.c index 7ce14ab8..c971b6c2 100644 --- a/src/strip.c +++ b/src/strip.c @@ -1535,25 +1535,30 @@ handle_elf

Remove nested functions from src/strip.c

2021-01-08 Thread Timm Bäder via Elfutils-devel
Hi, here a couple of patches to remove the nested functions from src/strip.c. I tried to keep the resulting code clean but had to do some refactorings to get that done. I hope the result is worth considering. Otherwise, I'm open for suggestions. - Timm