crtdll

Dimitrie O. Paun dpaun at rogers.com
Fri Dec 13 00:38:21 CST 2002


Mixing msvcrt and libc requires some gymnastics that are
best kept within msvcrt. The crtdll_main.c is the only
file outside msvcrt that needs to include msvcrt files,
and for little reason. In the near future you can no longer
easily include msvcrt header (include "msvcrt/xxx.h").

For all these reasons, I think it's more explicit, and
clearer if we duplicate the few types we need here, and
avoid all this circus. There is virtually 0 chance of
these changing in the future anyway, so I don't think we
are at risk. Moreover, it's more clear what the code is
doing anyways.

BTW, it is probably better if I rename _stat to msvcrt_stat, no?

ChangeLog
  Remove dependency on the msvcrt headers for crtdll.

Index: dlls/crtdll/crtdll_main.c
===================================================================
RCS file: /var/cvs/wine/dlls/crtdll/crtdll_main.c,v
retrieving revision 1.48
diff -u -r1.48 crtdll_main.c
--- dlls/crtdll/crtdll_main.c	4 Nov 2002 23:53:46 -0000	1.48
+++ dlls/crtdll/crtdll_main.c	12 Dec 2002 22:40:08 -0000
@@ -21,8 +21,6 @@
 #include "config.h"
 #include "windef.h"
 #include "winbase.h"
-#define USE_MSVCRT_PREFIX
-#include "msvcrt/sys/stat.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(crtdll);
@@ -44,19 +42,39 @@
 /* dev_t is a short in crtdll but an unsigned int in msvcrt */
 typedef short crtdll_dev_t;
 
+/* avoid including the msvcrt headers for these */
+typedef unsigned short msvcrt_ino_t;
+typedef unsigned int   msvcrt_dev_t;
+typedef int  msvcrt_off_t;
+typedef long msvcrt_time_t;
+
+struct _stat {
+  msvcrt_dev_t   st_dev;
+  msvcrt_ino_t   st_ino;
+  unsigned short st_mode;
+  short          st_nlink;
+  short          st_uid;
+  short          st_gid;
+  msvcrt_dev_t   st_rdev;
+  msvcrt_off_t   st_size;
+  msvcrt_time_t  st_atime;
+  msvcrt_time_t  st_mtime;
+  msvcrt_time_t st_ctime;
+};
+
 struct crtdll_stat
 {
   crtdll_dev_t   st_dev;
-  _ino_t         st_ino;
+  msvcrt_ino_t   st_ino;
   unsigned short st_mode;
   short          st_nlink;
   short          st_uid;
   short          st_gid;
   crtdll_dev_t   st_rdev;
-  MSVCRT(_off_t) st_size;
-  MSVCRT(time_t) st_atime;
-  MSVCRT(time_t) st_mtime;
-  MSVCRT(time_t) st_ctime;
+  msvcrt_off_t   st_size;
+  msvcrt_time_t  st_atime;
+  msvcrt_time_t  st_mtime;
+  msvcrt_time_t  st_ctime;
 };
 
 /* convert struct _stat from crtdll format to msvcrt format */


-- 
Dimi.




More information about the wine-patches mailing list