/* UI_FILE - a generic STDIO like output stream.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2016 Free Software Foundation, Inc.
This file is part of GDB.
struct ui_file *
ui_file_new (void)
{
- struct ui_file *file = xmalloc (sizeof (struct ui_file));
+ struct ui_file *file = XNEW (struct ui_file);
file->magic = &ui_file_magic;
set_ui_file_data (file, NULL, null_file_delete);
void
ui_file_write_for_put (void *data, const char *buffer, long length_buffer)
{
- ui_file_write (data, buffer, length_buffer);
+ ui_file_write ((struct ui_file *) data, buffer, length_buffer);
}
void
static void
do_ui_file_xstrdup (void *context, const char *buffer, long length)
{
- struct accumulated_ui_file *acc = context;
+ struct accumulated_ui_file *acc = (struct accumulated_ui_file *) context;
if (acc->buffer == NULL)
- acc->buffer = xmalloc (length + 1);
+ acc->buffer = (char *) xmalloc (length + 1);
else
- acc->buffer = xrealloc (acc->buffer, acc->length + length + 1);
+ acc->buffer = (char *) xrealloc (acc->buffer, acc->length + length + 1);
memcpy (acc->buffer + acc->length, buffer, length);
acc->length += length;
acc->buffer[acc->length] = '\0';
ui_file_put (file, do_ui_file_obsavestring, obstack);
*length = obstack_object_size (obstack);
obstack_1grow (obstack, '\0');
- return obstack_finish (obstack);
+ return (char *) obstack_finish (obstack);
}
\f
/* A pure memory based ``struct ui_file'' that can be used an output
static void
mem_file_delete (struct ui_file *file)
{
- struct mem_file *stream = ui_file_data (file);
+ struct mem_file *stream = (struct mem_file *) ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
static void
mem_file_rewind (struct ui_file *file)
{
- struct mem_file *stream = ui_file_data (file);
+ struct mem_file *stream = (struct mem_file *) ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
ui_file_put_method_ftype *write,
void *dest)
{
- struct mem_file *stream = ui_file_data (file);
+ struct mem_file *stream = (struct mem_file *) ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
const char *buffer,
long length_buffer)
{
- struct mem_file *stream = ui_file_data (file);
+ struct mem_file *stream = (struct mem_file *) ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
{
stream->length_buffer = length_buffer;
stream->sizeof_buffer = length_buffer;
- stream->buffer = xmalloc (stream->sizeof_buffer);
+ stream->buffer = (char *) xmalloc (stream->sizeof_buffer);
memcpy (stream->buffer, buffer, length_buffer);
}
else
if (new_length >= stream->sizeof_buffer)
{
stream->sizeof_buffer = new_length;
- stream->buffer = xrealloc (stream->buffer, stream->sizeof_buffer);
+ stream->buffer
+ = (char *) xrealloc (stream->buffer, stream->sizeof_buffer);
}
memcpy (stream->buffer + stream->length_buffer, buffer, length_buffer);
stream->length_buffer = new_length;
stdio_file_new (FILE *file, int close_p)
{
struct ui_file *ui_file = ui_file_new ();
- struct stdio_file *stdio = xmalloc (sizeof (struct stdio_file));
+ struct stdio_file *stdio = XNEW (struct stdio_file);
stdio->magic = &stdio_file_magic;
stdio->file = file;
static void
stdio_file_delete (struct ui_file *file)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
static void
stdio_file_flush (struct ui_file *file)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
static long
stdio_file_read (struct ui_file *file, char *buf, long length_buf)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
static void
stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
stdio_file_write_async_safe (struct ui_file *file,
const char *buf, long length_buf)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
{
static void
stdio_file_fputs (const char *linebuffer, struct ui_file *file)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
static int
stdio_file_isatty (struct ui_file *file)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
static int
stdio_file_fseek (struct ui_file *file, long offset, int whence)
{
- struct stdio_file *stdio = ui_file_data (file);
+ struct stdio_file *stdio = (struct stdio_file *) ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
struct ui_file *two, int close_two)
{
struct ui_file *ui_file = ui_file_new ();
- struct tee_file *tee = xmalloc (sizeof (struct tee_file));
+ struct tee_file *tee = XNEW (struct tee_file);
tee->magic = &tee_file_magic;
tee->one = one;
static void
tee_file_delete (struct ui_file *file)
{
- struct tee_file *tee = ui_file_data (file);
+ struct tee_file *tee = (struct tee_file *) ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
static void
tee_file_flush (struct ui_file *file)
{
- struct tee_file *tee = ui_file_data (file);
+ struct tee_file *tee = (struct tee_file *) ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
static void
tee_file_write (struct ui_file *file, const char *buf, long length_buf)
{
- struct tee_file *tee = ui_file_data (file);
+ struct tee_file *tee = (struct tee_file *) ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
static void
tee_file_fputs (const char *linebuffer, struct ui_file *file)
{
- struct tee_file *tee = ui_file_data (file);
+ struct tee_file *tee = (struct tee_file *) ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
static int
tee_file_isatty (struct ui_file *file)
{
- struct tee_file *tee = ui_file_data (file);
+ struct tee_file *tee = (struct tee_file *) ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,