This is the mail archive of the cygwin-patches mailing list for the Cygwin 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: [patch] inline __getreent in newlib


CC'd to newlib: I've checked in the attached change to
libc/reent/getreent.c as obvious, please let me know if it breaks
anything.

Christopher Faylor wrote:

> So, I guess I'll come down on the side of speed over clarity.  I'm sure
> that Jeff won't mind your checking in the undef in newlib.  So, please
> check in everything but, again, document heavily what you're doing with
> the reent macro.

Done.  I added the following comment to config.h to hopefully clarify
the situation:

/* The following provides an inline version of __getreent() for newlib,
   which will be used throughout the library whereever there is a _r
   version of a function that takes _REENT.  This saves the overhead
   of a function call for what amounts to a simple computation.
   
   The definition below is essentially equivalent to the one in cygtls.h
   (&_my_tls.local_clib) however it uses a fixed precomputed
   offset rather than dereferencing a field of a structure.
   
   Including tlsoffets.h here in order to get this constant offset
   tls_local_clib is a bit of a hack, but the alternative would require
   dragging the entire definition of struct _cygtls (a large and complex
   Cygwin internal data structure) into newlib.  The machinery to
   compute these offsets already exists for the sake of gendef so
   we might as well just use it here.  */

Brian
2007-09-06  Brian Dessent  <brian@dessent.net>

	* libc/reent/getreent.c: Allow for case where __getreent is
	defined as a macro.

Index: libc/reent/getreent.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v
retrieving revision 1.1
diff -u -p -r1.1 getreent.c
--- libc/reent/getreent.c	17 May 2002 23:39:37 -0000	1.1
+++ libc/reent/getreent.c	6 Sep 2007 23:13:10 -0000
@@ -3,6 +3,10 @@
 #include <_ansi.h>
 #include <reent.h>
 
+#ifdef __getreent
+#undef __getreent
+#endif
+
 struct _reent *
 _DEFUN_VOID(__getreent)
 {

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