git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Remove useless if-before-free tests.

From
JHJean-Luc Herren <jlh@gmx.ch>
Date
Feb 18, 2008, 14:27 UTC
Message-ID
<47B995CC.2000809@gmx.ch>
In-Reply-To
<871w7bz1ly.fsf@rho.meyering.net>
Jim Meyering wrote:
Show 9 quoted lines
> This change removes all useless if-before-free tests.
> E.g., it replace code like this
> 
> 	if (some_expression)
> 		free (some_expression);
> 
> with the now-equivalent
> 
> 	free (some_expression);
While you're at it, you might want to add this to your patch:
diff --git a/imap-send.c b/imap-send.c
index 9025d9a..3b27bca 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -472,7 +472,7 @@ v_issue_imap_cmd( imap_store_t *ctx, struct imap_cmd_cb *cb,
        if (socket_write( &imap->buf.sock, buf, bufl ) != bufl) {
                free( cmd->cmd );
                free( cmd );
-               if (cb && cb->data)
+               if (cb)
                        free( cb->data );
                return NULL;
        }

jlh
Previous: Jim MeyeringNext: Jim Meyering
Message 7 of 18 in “Remove useless if-before-free tests.”
  1. Remove useless if-before-free tests.Jim Meyering, Feb 17, 2008
  2. David SymondsFeb 17, 2008
  3. Jim MeyeringFeb 18, 2008
  4. Junio C HamanoFeb 18, 2008
  5. Johannes SchindelinFeb 17, 2008
  6. Jim MeyeringFeb 18, 2008
  7. Jean-Luc HerrenFeb 18, 2008
  8. Jim MeyeringFeb 20, 2008
  9. Junio C HamanoFeb 22, 2008
  10. Jim MeyeringFeb 22, 2008
  11. Junio C HamanoFeb 22, 2008
  12. Jim MeyeringFeb 22, 2008
  13. Junio C HamanoFeb 22, 2008
  14. Jim MeyeringFeb 24, 2008
  15. Mike RalphsonFeb 26, 2009
  16. Uwe Kleine-KönigFeb 26, 2008
  17. Morten WelinderFeb 23, 2008
  18. Johannes SchindelinFeb 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.