| List: | Commits | « Previous MessageNext Message » | |
| From: | Joerg Bruehe | Date: | June 4 2008 3:51pm |
| Subject: | Re: commit into mysql-6.0-wtf:mysql-6.0-wtf branch (vvaintroub:2653) Bug#24509, WL#3049 | ||
| View as plain text | |||
Hi Vlad, all ! Vladislav Vaintroub wrote: > Hi all, > what Davi describes is a sane approach, that if consistently applied can > result into high quality library, like Apache Portable Runtime. Hence , it > is not applicable for us ;) > Seriously, we do need a top-level mapper functions. The reason is that many > mysys IO functions include large chunks of code shared on all OS (error > handling, messing up with my_file_info array) and it does not make sense to > replicate those chunks for every OS. What could make sense for Windows is to > create win_file_io.c with ANSI/Posix wrappers. Then, use these wrappers in > the mysys function. > > To illustrate, this approach would make piece of code like this > > #ifndef __WIN__ > fd = fdopen(Filedes, type); > #else > { > /* Convert OS file handle to CRT file descriptor and then call fdopen*/ > int crt_fd = _open_osfhandle((intptr_t)my_get_osfhandle(Filedes), 0); > if(crt_fd < 0) > fd = 0; > else > fd = fdopen(crt_fd, type); > } > #endif > > less cluttered (still with #ifdefs though) > > #ifndef __WIN__ > fd = fdopen(Filedes, type); > #else > fd = my_win_fdopen(Filedes, type); > #endif I am perfectly ok with this style. It means that there will be only one place where "my_open()" is implemented (using conditional compiling around pieces of code which are quite small, so remain easily readable), and it would (on Windows) call "my_win_fdopen()". In the same file, you could then have #ifdef __WIN__ static inline int my_win_fdopen(...) { ... } #endif which is not interrupted by conditional compiling, and thus reading and maintaining the code is easy. If you put that into a different file, it is "extern", but that should not matter much. (IMNSHO, any system call will be so expensive that we need not worry too much about one more function call in the chain.) Jörg > > > Vlad > PS. Sorry to ignore Netware, I've absolutely clueless about it. > > >> -----Original Message----- >> From: Joerg Bruehe [mailto:joerg@stripped] >> Sent: Wednesday, June 04, 2008 11:00 AM >> To: Davi Arnaut >> Cc: Vladislav Vaintroub; commits@stripped >> Subject: Re: commit into mysql-6.0-wtf:mysql-6.0-wtf branch >> (vvaintroub:2653) Bug#24509, WL#3049 >> >> [[...]] -- Joerg Bruehe, MySQL Build Team, joerg@stripped (+49 30) 417 01 487 Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer Vorsitzender des Aufsichtsrates: Martin Haering Muenchen: HRB161028
