diff options
Diffstat (limited to 'newlib/libc/stdio/local.h')
-rw-r--r-- | newlib/libc/stdio/local.h | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index f7093b697..8b55503c8 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -23,38 +23,36 @@ */ #include <_ansi.h> -#include <reent.h> #include <stdarg.h> #include <reent.h> -#include <stdlib.h> #include <unistd.h> extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); -extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); extern FILE *_EXFUN(__sfp,(struct _reent *)); extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); extern int _EXFUN(__srefill,(FILE *)); -extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(_PTR, char *, int)); -extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(_PTR, char _CONST *, int)); -extern _fpos_t _EXFUN(__sseek,(_PTR, _fpos_t, int)); -extern int _EXFUN(__sclose,(_PTR)); +extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int)); +extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int)); +extern fpos_t _EXFUN(__sseek,(void *, fpos_t, int)); +extern int _EXFUN(__sclose,(void *)); extern int _EXFUN(__stextmode,(int)); -extern _VOID _EXFUN(__sinit,(struct _reent *)); -extern _VOID _EXFUN(_cleanup_r,(struct _reent *)); -extern _VOID _EXFUN(__smakebuf,(FILE *)); +extern void _EXFUN(__sinit,(struct _reent *)); +extern void _EXFUN(_cleanup_r,(struct _reent *)); +extern void _EXFUN(__smakebuf,(FILE *)); extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *))); -extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *))); struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); extern int _EXFUN(__srefill,(FILE *fp)); /* Called by the main entry point fns to ensure stdio has been initialized. */ -#define CHECK_INIT(ptr) \ - do \ - { \ - if ((ptr) && !(ptr)->__sdidinit) \ - __sinit (ptr); \ - } \ +#define CHECK_INIT(fp) \ + do \ + { \ + if ((fp)->_data == 0) \ + (fp)->_data = _REENT; \ + if (!(fp)->_data->__sdidinit) \ + __sinit ((fp)->_data); \ + } \ while (0) /* Return true iff the given FILE cannot be written now. */ @@ -69,14 +67,14 @@ extern int _EXFUN(__srefill,(FILE *fp)); #define HASUB(fp) ((fp)->_ub._base != NULL) #define FREEUB(fp) { \ if ((fp)->_ub._base != (fp)->_ubuf) \ - _free_r(_REENT, (char *)(fp)->_ub._base); \ + _free_r(fp->_data, (char *)(fp)->_ub._base); \ (fp)->_ub._base = NULL; \ } /* Test for an fgetline() buffer. */ #define HASLB(fp) ((fp)->_lb._base != NULL) -#define FREELB(fp) { _free_r(_REENT,(char *)(fp)->_lb._base); (fp)->_lb._base = NULL; } +#define FREELB(fp) { _free_r(fp->_data,(char *)(fp)->_lb._base); (fp)->_lb._base = NULL; } /* WARNING: _dcvt is defined in the stdlib directory, not here! */ @@ -91,15 +89,3 @@ char *_EXFUN(_llicvt,(char *, long long, char)); #define CVT_BUF_SIZE 128 #define NDYNAMIC 4 /* add four more whenever necessary */ - -#ifdef __SINGLE_THREAD__ -#define __sfp_lock_acquire() -#define __sfp_lock_release() -#define __sinit_lock_acquire() -#define __sinit_lock_release() -#else -_VOID _EXFUN(__sfp_lock_acquire,(_VOID)); -_VOID _EXFUN(__sfp_lock_release,(_VOID)); -_VOID _EXFUN(__sinit_lock_acquire,(_VOID)); -_VOID _EXFUN(__sinit_lock_release,(_VOID)); -#endif |