aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2007-08-13 23:06:34 +0000
committerMichael Snyder <msnyder@vmware.com>2007-08-13 23:06:34 +0000
commit81b7c67a8b67ee7dd6b1f7287ae61dce08207d90 (patch)
treedb51ae1ae659db09b2cdb07a414b6aa31e8b1a59 /gdb/tui
parentf5b73fbba3bdceaefcd4ab1cc7c6427cac362835 (diff)
downloadgdb-81b7c67a8b67ee7dd6b1f7287ae61dce08207d90.zip
gdb-81b7c67a8b67ee7dd6b1f7287ae61dce08207d90.tar.gz
gdb-81b7c67a8b67ee7dd6b1f7287ae61dce08207d90.tar.bz2
2007-08-13 Michael Snyder <msnyder@access-company.com>
* tui/tui-winsource.c (tui_alloc_source_buffer): Clean up allocation.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-winsource.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 4431001..2aed4c3 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -569,45 +569,40 @@ tui_alloc_source_buffer (struct tui_win_info *win_info)
{
char *src_line_buf;
int i, line_width, max_lines;
- enum tui_status ret = TUI_FAILURE;
max_lines = win_info->generic.height; /* less the highlight box */
line_width = win_info->generic.width - 1;
/*
- ** Allocate the buffer for the source lines. Do this only once since they
- ** will be re-used for all source displays. The only other time this will
- ** be done is when a window's size changes.
+ * Allocate the buffer for the source lines. Do this only once
+ * since they will be re-used for all source displays. The only
+ * other time this will be done is when a window's size changes.
*/
if (win_info->generic.content == NULL)
{
- src_line_buf = (char *) xmalloc ((max_lines * line_width) * sizeof (char));
+ src_line_buf = (char *)
+ xmalloc ((max_lines * line_width) * sizeof (char));
if (src_line_buf == (char *) NULL)
- fputs_unfiltered (
- "Unable to Allocate Memory for Source or Disassembly Display.\n",
- gdb_stderr);
- else
{
- /* allocate the content list */
- if ((win_info->generic.content =
- (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL)
- {
- xfree (src_line_buf);
- src_line_buf = (char *) NULL;
- fputs_unfiltered (
- "Unable to Allocate Memory for Source or Disassembly Display.\n",
- gdb_stderr);
- }
+ fputs_unfiltered ("Unable to Allocate Memory for Source or Disassembly Display.\n",
+ gdb_stderr);
+ return TUI_FAILURE;
+ }
+ /* allocate the content list */
+ if ((win_info->generic.content =
+ (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL)
+ {
+ xfree (src_line_buf);
+ fputs_unfiltered ("Unable to Allocate Memory for Source or Disassembly Display.\n",
+ gdb_stderr);
+ return TUI_FAILURE;
}
for (i = 0; i < max_lines; i++)
((struct tui_win_element *)
win_info->generic.content[i])->which_element.source.line =
src_line_buf + (line_width * i);
- ret = TUI_SUCCESS;
}
- else
- ret = TUI_SUCCESS;
- return ret;
+ return TUI_SUCCESS;
}