2007-08-01 Michael Snyder <msnyder@access-company.com>
authorMichael Snyder <msnyder@vmware.com>
Wed, 1 Aug 2007 20:15:36 +0000 (20:15 +0000)
committerMichael Snyder <msnyder@vmware.com>
Wed, 1 Aug 2007 20:15:36 +0000 (20:15 +0000)
* 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.

gdb/ChangeLog
gdb/tui/tui-data.c
gdb/tui/tui-file.c

index 2c178b1100f6fd9a4df924944d462af5b86d819d..b6ec94ae2b060dfc713bc0d3a5584a90d6825050 100644 (file)
@@ -1,3 +1,12 @@
+2007-08-01  Michael Snyder  <msnyder@access-company.com>
+
+       * 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.
+
 2007-07-31  Michael Snyder  <msnyder@access-company.com>
 
        * breakpoint.c (breakpoint_init_inferior): Add 'else' to 'if'.
index 40726c5d82c55d77a210df4efb811267ff0c9214..ddb59ba4dd8c38193c851a4c256a425038ab5ebb 100644 (file)
@@ -449,8 +449,7 @@ tui_alloc_generic_win_info (void)
 {
   struct tui_gen_win_info * win;
 
-  if ((win = (struct tui_gen_win_info *) xmalloc (
-                    sizeof (struct tui_gen_win_info))) != (struct tui_gen_win_info *) NULL)
+  if ((win = XMALLOC (struct tui_gen_win_info)) != NULL)
     tui_init_generic_part (win);
 
   return win;
@@ -568,10 +567,10 @@ init_win_info (struct tui_win_info * win_info)
 struct tui_win_info *
 tui_alloc_win_info (enum tui_win_type type)
 {
-  struct tui_win_info * win_info = (struct tui_win_info *) NULL;
+  struct tui_win_info * win_info;
 
-  win_info = (struct tui_win_info *) xmalloc (sizeof (struct tui_win_info));
-  if ((win_info != NULL))
+  win_info = XMALLOC (struct tui_win_info);
+  if (win_info != NULL)
     {
       win_info->generic.type = type;
       init_win_info (win_info);
@@ -585,21 +584,24 @@ tui_alloc_win_info (enum tui_win_type type)
 tui_win_content
 tui_alloc_content (int num_elements, enum tui_win_type type)
 {
-  tui_win_content content = (tui_win_content) NULL;
-  char *element_block_ptr = (char *) NULL;
+  tui_win_content content;
+  char *element_block_ptr;
   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.
-                                */
+  content = xmalloc (sizeof (struct tui_win_element *) * num_elements);
+  if (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)
+         element_block_ptr =
+           xmalloc (sizeof (struct tui_win_element) * num_elements);
+         if (element_block_ptr != NULL)
            {
              for (i = 0; i < num_elements; i++)
                {
@@ -642,14 +644,13 @@ tui_add_content_elements (struct tui_gen_win_info * win_info, int num_elements)
     {
       for (i = index_start; (i < num_elements + index_start); i++)
        {
-         if ((element_ptr = (struct tui_win_element *)
-              xmalloc (sizeof (struct tui_win_element))) != (struct tui_win_element *) NULL)
+         if ((element_ptr = XMALLOC (struct tui_win_element)) != NULL)
            {
              win_info->content[i] = (void *) element_ptr;
              init_content_element (element_ptr, win_info->type);
              win_info->content_size++;
            }
-         else                  /* things must be really hosed now! We ran out of memory!? */
+         else  /* Things must be really hosed now!  We ran out of memory!? */
            return (-1);
        }
     }
index f3e8f0395ed0f914374f609c1f9267025599f552..e8eaef8849ba8459fa22cb433ca63059b19c86c5 100644 (file)
@@ -59,7 +59,7 @@ static int tui_file_magic;
 static struct ui_file *
 tui_file_new (void)
 {
-  struct tui_stream *tui = xmalloc (sizeof (struct tui_stream));
+  struct tui_stream *tui = XMALLOC (struct tui_stream);
   struct ui_file *file = ui_file_new ();
   set_ui_file_data (file, tui, tui_file_delete);
   set_ui_file_flush (file, tui_file_flush);
This page took 0.030941 seconds and 4 git commands to generate.