This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: *printf_r and reentrancy


Eric Blake wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I noticed that various *printf_r routines all get bundled through
_vfprintf_r, which in turn calls __swsetup (via the macro cantwrite),
which in turn can call __smakebuf and _malloc_r(_REENT).  But isn't this
design broken, if an alternate reentrancy object (rather than _REENT) was
originally passed to the *printf_r routine?  In other words, should
cantwrite, __swsetup, and __smakebuf all be converted to pass a reentrancy
argument around?


Yes, you are right for non-dynamic-reent configurations. An error on the allocation will cause the errno to be set for _REENT which is incorrect except in the case of dynamic reent. This needs to be fixed. It's a bit of a can of worms. Do you want to make the changes or would you prefer I do it?


-- Jeff J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]