This is the mail archive of the cygwin-patches@cygwin.com 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]

Re: [PATCH] Move path_prefix_p declaration from cygheap.h to path.h


Just a thought to add to the mix:

For objects with derived classes, if the derived classes are in the main
class header, then anything operating on the main class or generic
derived classes will need all the headers needed by all the derived
classes.

Splitting the derived classes into separate headers fixes this
particular cause for multiple-inclusion.

I.e. to take a case in point, fhandler_base needs very few headers, but
with the addition of (say) socket support more headers are needed to use
manipulate fhandler_base classes.

Rob

----- Original Message -----
From: "Christopher Faylor" <cgf@redhat.com>
To: <cygwin-patches@cygwin.com>
Sent: Tuesday, October 16, 2001 9:37 AM
Subject: Re: [PATCH] Move path_prefix_p declaration from cygheap.h to
path.h


> There is a reason why that was a FIXME.
>
> If you notice, with a few exceptions, I try not to have include files
> including include files.  I'm not sure that this is the correct
approach
> but it is the current approach that we use in Cygwin.
>
> Also, for the most none of the header files are multiple-inclusion
> protected since the current approach should not use it.
>
> The FIXME was really hiding a larger issue of what to do about header
> file use in cygwin.  So, just having cygheap.h include path.h is not
> a real solution for this problem.
>
> I "cleaned up" header file usage a while ago by eliminating a
monolithic
> winsup.h but, in the process, I just ended up with nearly every source
> file requiring nearly every header file -- which was no real
improvement.
>
> So, header file layout needs to be addressed again at some point when
we
> have the luxury of not thinking about bug fixes.
>
> cgf
>
> On Mon, Oct 15, 2001 at 03:20:36AM -0500, Gary R. Van Sickle wrote:
> >Mon Oct 15 03:14:00 2001  Gary R. Van Sickle
> >
> > * cygheap.h (path_prefix_p): Move declaration to path.h.
> > (#include "path.h"): Add #include to get the needed decl.
> > (_WINSUP_CYGWIN_CYGHEAP_H_): Add multiple-include protection.
> >
> > * path.h (path_prefix_p): Move declaration from cygheap.h
> > to here.
> > {_WINSUP_CYGWIN_PATH_H_): Add multiple-include protection.
> >
> >
> >Index: winsup/cygwin/cygheap.h
> >===================================================================
> >RCS file: /cvs/src/src/winsup/cygwin/cygheap.h,v
> >retrieving revision 1.26
> >diff -p -u -b -r1.26 cygheap.h
> >--- cygheap.h 2001/09/14 00:49:00 1.26
> >+++ cygheap.h 2001/10/15 07:53:01
> >@@ -1,3 +1,6 @@
> >+#ifndef _WINSUP_CYGWIN_CYGHEAP_H_
> >+#define _WINSUP_CYGWIN_CYGHEAP_H_
> >+
> > /* cygheap.h: Cygwin heap manager.
> >
> >    Copyright 2000, 2001 Red Hat, Inc.
> >@@ -8,6 +11,8 @@ This software is a copyrighted work lice
> > Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
> > details. */
> >
> >+#include "path.h"
> >+
> > #undef cfree
> >
> > enum cygheap_types
> >@@ -46,9 +51,6 @@ struct cygheap_root_mount_info
> >   unsigned native_pathlen;
> > };
> >
> >-/* CGF: FIXME This doesn't belong here */
> >-
> >-int path_prefix_p (const char *path1, const char *path2, int len1)
> >__attribute__ ((regparm (3)));
> > class cygheap_root
> > {
> >   /* Root directory information.
> >@@ -189,3 +191,5 @@ char *__stdcall cstrdup (const char *) _
> > char *__stdcall cstrdup1 (const char *) __attribute__
((regparm(1)));
> > void __stdcall cygheap_init ();
> > }
> >+
> >+#endif /* _WINSUP_CYGWIN_CYGHEAP_H_ */
> >Index: winsup/cygwin/path.h
> >===================================================================
> >RCS file: /cvs/src/src/winsup/cygwin/path.h,v
> >retrieving revision 1.34
> >diff -p -u -b -r1.34 path.h
> >--- path.h 2001/10/04 02:34:20 1.34
> >+++ path.h 2001/10/15 07:53:02
> >@@ -1,3 +1,6 @@
> >+#ifndef _WINSUP_CYGWIN_PATH_H_
> >+#define _WINSUP_CYGWIN_PATH_H_
> >+
> > /* path.h: path data structures
> >
> >    Copyright 1996, 1997, 1998, 2000 Red Hat, Inc.
> >@@ -167,3 +170,6 @@ has_exec_chars (const char *buf, int len
> >
> > int pathmatch (const char *path1, const char *path2) __attribute__
> >((regparm (2)));
> > int pathnmatch (const char *path1, const char *path2, int len)
> >__attribute__ ((regparm (2)));
> >+int path_prefix_p (const char *path1, const char *path2, int len1)
> >__attribute__ ((regparm (3)));
> >+
> >+#endif /* _WINSUP_CYGWIN_PATH_H_ */
>
> --
> cgf@cygnus.com                        Red Hat, Inc.
> http://sources.redhat.com/            http://www.redhat.com/
>


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