diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2007-03-15 18:40:48 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2007-03-15 18:40:48 +0000 |
commit | 14ba5e14d9226cb4dd1b2a72781ee02e9f2bf8a2 (patch) | |
tree | 2bd8d4251eebbf9db5443c0bba034650fb5c15ad /newlib/libc/stdio/local.h | |
parent | e96d068ed3c85f138e368c399a728eb6e9a65751 (diff) | |
download | cygnal-14ba5e14d9226cb4dd1b2a72781ee02e9f2bf8a2.tar.gz cygnal-14ba5e14d9226cb4dd1b2a72781ee02e9f2bf8a2.tar.bz2 cygnal-14ba5e14d9226cb4dd1b2a72781ee02e9f2bf8a2.zip |
2007-03-15 Eric Blake <ebb9@byu.net>
* libc/stdio/local.h (cantwrite, FREEUB, FREELB): Make reentrant.
(__smakebuf): Rename...
(__smakebuf_r): to this.
* libc/stdio/fvwrite.h (__swsetup_r): Rename, from __swsetup.
* libc/stdio/makebuf.c (__smakebuf): Detect failed asprint
allocation, then rename...
(__smakebuf_r): ...to this and fix reentrancy.
* libc/stdio/wsetup.c (__swsetup): Detect failed asprintf
allocation, then rename...
(__swsetup_r): ...to this and fix reentrancy.
* libc/stdio/fseek.c (_fseek_r): Fix reentrancy.
* libc/stdio/refill.c (__srefill_r): Likewise.
* libc/stdio/fclose.c (_fclose_r): Likewise.
* libc/stdio/fread.c (_fread_r): Likewise.
* libc/stdio/freopen.c (_freopen_r): Likewise.
* libc/stdio/wbuf.c (__swbuf_r): Likewise.
* libc/stdio64/fseeko64.c (_fseeko64_r): Likewise.
* libc/stdio/fvwrite.c (__sfvwrite_r): Set errno properly on
failed asprintf allocation, and fix reentrancy.
* libc/stdio/snprintf.c (snprintf, _snprintf_r): Report overflow,
as required by POSIX.
* libc/stdio/sniprintf.c (sniprintf, _sniprintf_r): Likewise.
* libc/stdio/vsnprintf.c (vsnprintf, _vsnprintf_r): Likewise.
* libc/stdio/vsniprintf.c (vsniprintf, _vsniprintf_r): Likewise.
Diffstat (limited to 'newlib/libc/stdio/local.h')
-rw-r--r-- | newlib/libc/stdio/local.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 9ae9b4046..704b6be03 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1990, 2007 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms are permitted @@ -41,7 +41,7 @@ extern int _EXFUN(__sclose,(_PTR)); 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(__smakebuf_r,(struct _reent *, 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)); @@ -82,24 +82,25 @@ struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); /* Return true iff the given FILE cannot be written now. */ -#define cantwrite(fp) \ +#define cantwrite(ptr, fp) \ ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ - __swsetup(fp)) + __swsetup_r(ptr, fp)) /* Test whether the given stdio file has an active ungetc buffer; release such a buffer, without restoring ordinary unread data. */ #define HASUB(fp) ((fp)->_ub._base != NULL) -#define FREEUB(fp) { \ +#define FREEUB(ptr, fp) { \ if ((fp)->_ub._base != (fp)->_ubuf) \ - _free_r(_REENT, (char *)(fp)->_ub._base); \ + _free_r(ptr, (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(ptr, fp) { _free_r(ptr,(char *)(fp)->_lb._base); \ + (fp)->_lb._base = NULL; } /* WARNING: _dcvt is defined in the stdlib directory, not here! */ |