This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: *printf_r and reentrancy
Jeff Johnston <jjohnstn <at> redhat.com> writes:
> >>> 2007-03-13 Eric Blake <ebb9 <at> byu.net>
> >>>
> >>> * libc/stdio/local.h (cantwrite, FREEUB, FREELB): Make reentrant.
> > ...
> >
> > Any word on whether this patch will be applied?
> >
>
> Done.
Oops, it looks like my patch missed a file, even though the ChangeLog called it
out, because it was in a different directory than where I did the diff.
Without this bit, cygwin compilation fails.
* libc/stdio64/fseeko64.c (_fseeko64_r): Fix reentrancy.
Index: libc/stdio64/fseeko64.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio64/fseeko64.c,v
retrieving revision 1.8
diff -u -r1.8 fseeko64.c
--- libc/stdio64/fseeko64.c 26 Sep 2006 21:22:19 -0000 1.8
+++ libc/stdio64/fseeko64.c 16 Mar 2007 15:51:08 -0000
@@ -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
@@ -197,7 +197,7 @@
*/
if (fp->_bf._base == NULL)
- __smakebuf (fp);
+ __smakebuf_r (ptr, fp);
if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
goto dumb;
if ((fp->_flags & __SOPT) == 0)
@@ -283,7 +283,7 @@
fp->_p = fp->_bf._base + o;
fp->_r = n - o;
if (HASUB (fp))
- FREEUB (fp);
+ FREEUB (ptr, fp);
fp->_flags &= ~__SEOF;
_funlockfile(fp);
return 0;
@@ -304,7 +304,7 @@
fp->_r = 0;
fp->_p = fp->_bf._base;
if (HASUB (fp))
- FREEUB (fp);
+ FREEUB (ptr, fp);
fp->_flags &= ~__SEOF;
n = target - curoff;
if (n)
@@ -330,7 +330,7 @@
}
/* success: clear EOF indicator and discard ungetc() data */
if (HASUB (fp))
- FREEUB (fp);
+ FREEUB (ptr, fp);
fp->_p = fp->_bf._base;
fp->_r = 0;
/* fp->_w = 0; *//* unnecessary (I think...) */