From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19541 invoked by alias); 1 Aug 2007 08:01:01 -0000 Received: (qmail 19526 invoked by uid 22791); 1 Aug 2007 08:01:00 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Aug 2007 08:00:57 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0) with ESMTP id l7180TBp005134 for ; Wed, 1 Aug 2007 10:00:29 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0/Submit) id l717wwTK030258; Wed, 1 Aug 2007 09:58:59 +0200 (CEST) Date: Wed, 01 Aug 2007 08:01:00 -0000 Message-Id: <200708010758.l717wwTK030258@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: msnyder@sonic.net CC: gdb-patches@sourceware.org In-reply-to: <15296.12.7.175.2.1185925512.squirrel@webmail.sonic.net> (msnyder@sonic.net) Subject: Re: [PATCH] tui, clean up long lines and xmallocs References: <15296.12.7.175.2.1185925512.squirrel@webmail.sonic.net> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00006.txt.bz2 > Date: Tue, 31 Jul 2007 16:45:12 -0700 (PDT) > From: msnyder@sonic.net > 2007-07-31 Michael Snyder > > * tui/tui-data.c (tui_alloc_content): Move assign out of if, > clean up long lines. > (tui_alloc_generic_win_info): Tidy by using XMALLOC macro. > (tui_alloc_win_info): Ditto. > (tui_add_content_elements): Ditto. > * tui/tui-file.c (tui_file_magic): Ditto. Looks ok to me, but: > Index: tui-data.c > =================================================================== > RCS file: /cvs/src/src/gdb/tui/tui-data.c,v > retrieving revision 1.15 > diff -p -r1.15 tui-data.c > *** tui-data.c 28 Jul 2007 01:16:39 -0000 1.15 > --- tui-data.c 31 Jul 2007 23:40:21 -0000 > *************** tui_alloc_win_info (enum tui_win_type ty > *** 570,577 **** > { > struct tui_win_info * win_info = (struct tui_win_info *) NULL; > > ! win_info = (struct tui_win_info *) xmalloc (sizeof (struct tui_win_info)); > ! if ((win_info != NULL)) > { > win_info->generic.type = type; > init_win_info (win_info); > --- 569,576 ---- > { > struct tui_win_info * win_info = (struct tui_win_info *) NULL; > > ! win_info = XMALLOC (struct tui_win_info); > ! if (win_info != NULL) > { > win_info->generic.type = type; > init_win_info (win_info); While you're there, you might as well remove that redundant initialization on the line above. > *************** tui_alloc_content (int num_elements, enu > *** 589,605 **** > char *element_block_ptr = (char *) NULL; > int i; > > ! if ((content = (tui_win_content) > ! xmalloc (sizeof (struct tui_win_element *) * num_elements)) != (tui_win_content) NULL) > ! { /* > ! ** All windows, except the data window, can allocate the elements > ! ** in a chunk. The data window cannot because items can be > ! ** added/removed from the data display by the user at any time. > ! */ > if (type != DATA_WIN) > { > ! if ((element_block_ptr = (char *) > ! xmalloc (sizeof (struct tui_win_element) * num_elements)) != (char *) NULL) > { > for (i = 0; i < num_elements; i++) > { > --- 588,607 ---- > char *element_block_ptr = (char *) NULL; > int i; > > ! content = xmalloc (sizeof (struct tui_win_element *) * num_elements); Similar here.