forked from Imagelibrary/binutils-gdb
gdb/
Code cleanup. * cli/cli-cmds.c (source_script_from_stream): Never fclose STREAM. Update the function comment for it. (source_script_with_search): Call make_cleanup_fclose for STREAM. * cli/cli-script.c (script_from_file): Do not call make_cleanup_fclose for STREAM.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
2012-01-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Code cleanup.
|
||||||
|
* cli/cli-cmds.c (source_script_from_stream): Never fclose STREAM.
|
||||||
|
Update the function comment for it.
|
||||||
|
(source_script_with_search): Call make_cleanup_fclose for STREAM.
|
||||||
|
* cli/cli-script.c (script_from_file): Do not call make_cleanup_fclose
|
||||||
|
for STREAM.
|
||||||
|
|
||||||
2012-01-24 Pedro Alves <palves@redhat.com>
|
2012-01-24 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* breakpoint.c (bpstat_stop_status): Moving clearing print_it
|
* breakpoint.c (bpstat_stop_status): Moving clearing print_it
|
||||||
|
|||||||
@@ -527,8 +527,7 @@ find_and_open_script (const char *script_file, int search_path,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load script FILE, which has already been opened as STREAM.
|
/* Load script FILE, which has already been opened as STREAM. */
|
||||||
STREAM is closed before we return. */
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
source_script_from_stream (FILE *stream, const char *file)
|
source_script_from_stream (FILE *stream, const char *file)
|
||||||
@@ -556,12 +555,9 @@ source_script_from_stream (FILE *stream, const char *file)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Nope, just punt. */
|
/* Nope, just punt. */
|
||||||
fclose (stream);
|
|
||||||
throw_exception (e);
|
throw_exception (e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
fclose (stream);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
script_from_file (stream, file);
|
script_from_file (stream, file);
|
||||||
@@ -595,6 +591,7 @@ source_script_with_search (const char *file, int from_tty, int search_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
old_cleanups = make_cleanup (xfree, full_path);
|
old_cleanups = make_cleanup (xfree, full_path);
|
||||||
|
make_cleanup_fclose (stream);
|
||||||
/* The python support reopens the file, so we need to pass full_path here
|
/* The python support reopens the file, so we need to pass full_path here
|
||||||
in case the file was found on the search path. It's useful to do this
|
in case the file was found on the search path. It's useful to do this
|
||||||
anyway so that error messages show the actual file used. But only do
|
anyway so that error messages show the actual file used. But only do
|
||||||
|
|||||||
@@ -1614,11 +1614,9 @@ script_from_file (FILE *stream, const char *file)
|
|||||||
if (stream == NULL)
|
if (stream == NULL)
|
||||||
internal_error (__FILE__, __LINE__, _("called with NULL file pointer!"));
|
internal_error (__FILE__, __LINE__, _("called with NULL file pointer!"));
|
||||||
|
|
||||||
old_cleanups = make_cleanup_fclose (stream);
|
|
||||||
|
|
||||||
old_lines.old_line = source_line_number;
|
old_lines.old_line = source_line_number;
|
||||||
old_lines.old_file = source_file_name;
|
old_lines.old_file = source_file_name;
|
||||||
make_cleanup (source_cleanup_lines, &old_lines);
|
old_cleanups = make_cleanup (source_cleanup_lines, &old_lines);
|
||||||
source_line_number = 0;
|
source_line_number = 0;
|
||||||
source_file_name = file;
|
source_file_name = file;
|
||||||
/* This will get set every time we read a line. So it won't stay ""
|
/* This will get set every time we read a line. So it won't stay ""
|
||||||
|
|||||||
Reference in New Issue
Block a user