OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [stdio/] [vdiprintf.c] - Diff between revs 207 and 520

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 520
/* Copyright 2005, 2007 Shaun Jackman
/* Copyright 2005, 2007 Shaun Jackman
 * Permission to use, copy, modify, and distribute this software
 * Permission to use, copy, modify, and distribute this software
 * is freely granted, provided that this notice is preserved.
 * is freely granted, provided that this notice is preserved.
 */
 */
/* doc in diprintf.c */
/* doc in diprintf.c */
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <reent.h>
#include <reent.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include <stdarg.h>
#include <stdarg.h>
#include "local.h"
#include "local.h"
 
 
int
int
_DEFUN(_vdiprintf_r, (ptr, fd, format, ap),
_DEFUN(_vdiprintf_r, (ptr, fd, format, ap),
       struct _reent *ptr _AND
       struct _reent *ptr _AND
       int fd _AND
       int fd _AND
       const char *format _AND
       const char *format _AND
       va_list ap)
       va_list ap)
{
{
  char *p;
  char *p;
  char buf[512];
  char buf[512];
  size_t n = sizeof buf;
  size_t n = sizeof buf;
 
 
  _REENT_SMALL_CHECK_INIT (ptr);
  _REENT_SMALL_CHECK_INIT (ptr);
  p = _vasniprintf_r (ptr, buf, &n, format, ap);
  p = _vasniprintf_r (ptr, buf, &n, format, ap);
  if (!p)
  if (!p)
    return -1;
    return -1;
  n = _write_r (ptr, fd, p, n);
  n = _write_r (ptr, fd, p, n);
  if (p != buf)
  if (p != buf)
    _free_r (ptr, p);
    _free_r (ptr, p);
  return n;
  return n;
}
}
 
 
#ifndef _REENT_ONLY
#ifndef _REENT_ONLY
 
 
int
int
_DEFUN(vdiprintf, (fd, format, ap),
_DEFUN(vdiprintf, (fd, format, ap),
       int fd _AND
       int fd _AND
       const char *format _AND
       const char *format _AND
       va_list ap)
       va_list ap)
{
{
  return _vdiprintf_r (_REENT, fd, format, ap);
  return _vdiprintf_r (_REENT, fd, format, ap);
}
}
 
 
#endif /* ! _REENT_ONLY */
#endif /* ! _REENT_ONLY */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.