From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: msnyder@sonic.net
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] tui, clean up long lines and xmallocs
Date: Wed, 01 Aug 2007 08:01:00 -0000 [thread overview]
Message-ID: <200708010758.l717wwTK030258@brahms.sibelius.xs4all.nl> (raw)
In-Reply-To: <15296.12.7.175.2.1185925512.squirrel@webmail.sonic.net> (msnyder@sonic.net)
> Date: Tue, 31 Jul 2007 16:45:12 -0700 (PDT)
> From: msnyder@sonic.net
> 2007-07-31 Michael Snyder <msnyder@svkmacdonelllnx>
>
> * 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.
next parent reply other threads:[~2007-08-01 8:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <15296.12.7.175.2.1185925512.squirrel@webmail.sonic.net>
2007-08-01 8:01 ` Mark Kettenis [this message]
2007-08-01 20:21 ` msnyder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200708010758.l717wwTK030258@brahms.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@sonic.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox