/* UI_FILE - a generic STDIO like output stream.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+ Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
#include "ui-file.h"
#include "gdb_string.h"
-#undef XMALLOC
-#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
-
static ui_file_isatty_ftype null_file_isatty;
static ui_file_write_ftype null_file_write;
static ui_file_fputs_ftype null_file_fputs;
ui_file_data (struct ui_file *file)
{
if (file->magic != &ui_file_magic)
- internal_error ("ui_file_data: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "ui_file_data: bad magic number");
return file->to_data;
}
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
- internal_error ("mem_file_delete: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "mem_file_delete: bad magic number");
if (stream->buffer != NULL)
xfree (stream->buffer);
xfree (stream);
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
- internal_error ("mem_file_rewind: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "mem_file_rewind: bad magic number");
stream->length_buffer = 0;
}
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
- internal_error ("mem_file_put: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "mem_file_put: bad magic number");
if (stream->length_buffer > 0)
write (dest, stream->buffer, stream->length_buffer);
}
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
- internal_error ("mem_file_write: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "mem_file_write: bad magic number");
if (stream->buffer == NULL)
{
stream->length_buffer = length_buffer;
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
- internal_error ("stdio_file_delete: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "stdio_file_delete: bad magic number");
if (stdio->close_p)
{
fclose (stdio->file);
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
- internal_error ("stdio_file_flush: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "stdio_file_flush: bad magic number");
fflush (stdio->file);
}
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
- internal_error ("stdio_file_write: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "stdio_file_write: bad magic number");
fwrite (buf, length_buf, 1, stdio->file);
}
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
- internal_error ("stdio_file_fputs: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "stdio_file_fputs: bad magic number");
fputs (linebuffer, stdio->file);
}
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
- internal_error ("stdio_file_isatty: bad magic number");
+ internal_error (__FILE__, __LINE__,
+ "stdio_file_isatty: bad magic number");
return (isatty (fileno (stdio->file)));
}