public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove dead code in function dwz
@ 2021-03-02 10:10 Tom de Vries
  2021-03-03 22:14 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2021-03-02 10:10 UTC (permalink / raw)
  To: dwz, jakub, mark

Hi,

Function dwz contains this code:
...
  free (dso);
  if (ret == 0 && !low_mem)
    res->res = 0;
...

The value of low_mem will always be false here.  At that point, cleanup has
been called, which resets multifile_mode back to 0.

Fix this by removing the "&& !low_mem".

Any comments?

Thanks,
- Tom

Remove dead code in function dwz

2021-03-02  Tom de Vries  <tdevries@suse.de>

	* dwz.c (dwz): Remove dead code.

---
 dwz.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dwz.c b/dwz.c
index d5fe7b1..1d7d815 100644
--- a/dwz.c
+++ b/dwz.c
@@ -15595,7 +15595,7 @@ dwz (const char *file, const char *outfile, struct file_result *res,
   close (fd);
 
   free (dso);
-  if (ret == 0 && !low_mem)
+  if (ret == 0)
     res->res = 0;
   if (ret == 3)
     {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove dead code in function dwz
  2021-03-02 10:10 [PATCH] Remove dead code in function dwz Tom de Vries
@ 2021-03-03 22:14 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2021-03-03 22:14 UTC (permalink / raw)
  To: Tom de Vries; +Cc: dwz, jakub

Hi Tom,

On Tue, Mar 02, 2021 at 11:10:09AM +0100, Tom de Vries wrote:
> Function dwz contains this code:
> ...
>   free (dso);
>   if (ret == 0 && !low_mem)
>     res->res = 0;
> ...
> 
> The value of low_mem will always be false here.  At that point, cleanup has
> been called, which resets multifile_mode back to 0.
> 
> Fix this by removing the "&& !low_mem".
>
> Any comments?

You are right.when we get here cleanup () has been called and resets
multifile_mode to zero. low_mem is defined as (multifile_mode &
MULTIFILE_MODE_LOW_MEM) . So at this point low_mem is always false.

I don't know why this condition was there to begin with.  It seems it
never was correct. So I agree that removing it seems like a good
thing.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-03 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 10:10 [PATCH] Remove dead code in function dwz Tom de Vries
2021-03-03 22:14 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).