git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 1/4] Refactor skipping DOS drive prefixes

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 24, 2016, 10:56 UTC
Message-ID
<alpine.DEB.2.20.1601241152060.2964@virtualbox>
In-Reply-To
<56A3CE34.20808@kdbg.org>
Hi Hannes,
On Sat, 23 Jan 2016, Johannes Sixt wrote:
Show 59 quoted lines
> Am 23.01.2016 um 09:25 schrieb Johannes Schindelin:
>
> > On Fri, 22 Jan 2016, Junio C Hamano wrote:
> >
> > > Johannes Sixt <j6t@kdbg.org> writes:
> > >
> > > > I suggest to move the function definition out of line:
> > > >
> > > > diff --git a/compat/mingw.c b/compat/mingw.c
> > > > index 10a51c0..0cebb61 100644
> > > > --- a/compat/mingw.c
> > > > +++ b/compat/mingw.c
> > > > @@ -1915,6 +1915,13 @@ pid_t waitpid(pid_t pid, int *status, int
> > > > options)
> > > >   	return -1;
> > > >   }
> > > >
> > > > +int mingw_skip_dos_drive_prefix(char **path)
> > > > +{
> > > > +	int ret = has_dos_drive_prefix(*path);
> > > > +	*path += ret;
> > > > +	return ret;
> > > > +}
> > > > +
> > > >   int mingw_offset_1st_component(const char *path)
> > > >   {
> > > >   	char *pos = (char *)path;
> > > > diff --git a/compat/mingw.h b/compat/mingw.h
> > > > index 9b5db4e..2099b79 100644
> > > > --- a/compat/mingw.h
> > > > +++ b/compat/mingw.h
> > > > @@ -360,12 +360,7 @@ HANDLE winansi_get_osfhandle(int fd);
> > > >
> > > >   #define has_dos_drive_prefix(path) \
> > > >   	(isalpha(*(path)) && (path)[1] == ':' ? 2 : 0)
> > > > -static inline int mingw_skip_dos_drive_prefix(char **path)
> > > > -{
> > > > -	int ret = has_dos_drive_prefix(*path);
> > > > -	*path += ret;
> > > > -	return ret;
> > > > -}
> > > > +int mingw_skip_dos_drive_prefix(char **path);
> > > >   #define skip_dos_drive_prefix mingw_skip_dos_drive_prefix
> > > >   #define is_dir_sep(c) ((c) == '/' || (c) == '\\')
> > > >   static inline char *mingw_find_last_dir_sep(const char *path)
> > >
> > > This sounds good to me.  Dscho?
> >
> > Yep, sounds good to me, too.
> >
> > Personally, I have no inclination to add compatibility with the
> > now-safely-obsolete MSys to my responsibilities, but if Hannes wants to do
> > it, who am I to stand in his way? Especially when the fix is as trivial as
> > here.
> 
> This is not a matter of compatibility. I am VERY curious why you do not see
> an error (or warning) without my proposed fixup. As I mentioned, isalpha() is
> defined much later than the definition of mingw_skip_dos_drive_prefix().
> Where does your build get a declaration of isalpha() from?

$ grep -w isalpha /mingw32/i686-w64-mingw32/include/*.h /mingw32/i686-w64-mingw32/include/ctype.h: _CRTIMP int __cdecl isalpha(int _C); /mingw32/i686-w64-mingw32/include/ctype.h:#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_'))

I guess that definition gets pulled in somehow.

Ciao, Dscho

Previous: Johannes SixtNext: Johannes Sixt
Message 39 of 63 in “Provide a dirname() function when NO_LIBGEN_H=YesPlease”
  1. Provide a dirname() function when NO_LIBGEN_H=YesPleaseJohannes Schindelin, Sep 30, 2015
  2. Junio C HamanoSep 30, 2015
  3. Johannes SchindelinJan 8, 2016
  4. Ramsay JonesSep 30, 2015
  5. Johannes SchindelinJan 8, 2016
  6. 0/4 Ensure that we can build without libgen.hJohannes Schindelin, Jan 8, 2016
  7. 1/4 Refactor skipping DOS drive prefixesJohannes Schindelin, Jan 8, 2016
  8. Eric SunshineJan 8, 2016
  9. Junio C HamanoJan 8, 2016
  10. Johannes SchindelinJan 11, 2016
  11. Junio C HamanoJan 11, 2016
  12. 2/4 compat/basename: make basename() conform to POSIXJohannes Schindelin, Jan 8, 2016
  13. Junio C HamanoJan 8, 2016
  14. Johannes SchindelinJan 9, 2016
  15. Junio C HamanoJan 11, 2016
  16. 3/4 Provide a dirname() function when NO_LIBGEN_H=YesPleaseJohannes Schindelin, Jan 8, 2016
  17. Junio C HamanoJan 8, 2016
  18. 4/4 t0060: verify that basename() and dirname() work as expectedJohannes Schindelin, Jan 8, 2016
  19. Eric SunshineJan 10, 2016
  20. Johannes SchindelinJan 11, 2016
  21. Michael BlumeJan 13, 2016
  22. Junio C HamanoJan 13, 2016
  23. Johannes SchindelinJan 14, 2016
  24. 0/4 Ensure that we can build without libgen.hJohannes Schindelin, Jan 11, 2016
  25. 1/4 Refactor skipping DOS drive prefixesJohannes Schindelin, Jan 11, 2016
  26. 2/4 compat/basename: make basename() conform to POSIXJohannes Schindelin, Jan 11, 2016
  27. 3/4 Provide a dirname() function when NO_LIBGEN_H=YesPleaseJohannes Schindelin, Jan 11, 2016
  28. Eric SunshineJan 11, 2016
  29. Junio C HamanoJan 11, 2016
  30. Johannes SchindelinJan 12, 2016
  31. 4/4 t0060: verify that basename() and dirname() work as expectedJohannes Schindelin, Jan 11, 2016
  32. Junio C HamanoJan 11, 2016
  33. 0/4 Ensure that we can build without libgen.hJohannes Schindelin, Jan 12, 2016
  34. 1/4 Refactor skipping DOS drive prefixesJohannes Schindelin, Jan 12, 2016
  35. Johannes SixtJan 22, 2016
  36. Junio C HamanoJan 22, 2016
  37. Johannes SchindelinJan 23, 2016
  38. Johannes SixtJan 23, 2016
  39. Johannes SchindelinJan 24, 2016
  40. Johannes SixtJan 24, 2016
  41. Junio C HamanoJan 24, 2016
  42. mingw: avoid linking to the C library's isalpha()Johannes Sixt, Jan 25, 2016
  43. Junio C HamanoJan 25, 2016
  44. 2/4 compat/basename: make basename() conform to POSIXJohannes Schindelin, Jan 12, 2016
  45. Ramsay JonesJan 13, 2016
  46. Johannes SchindelinJan 13, 2016
  47. 3/4 Provide a dirname() function when NO_LIBGEN_H=YesPleaseJohannes Schindelin, Jan 12, 2016
  48. Ramsay JonesJan 13, 2016
  49. Johannes SchindelinJan 13, 2016
  50. Ramsay JonesJan 13, 2016
  51. 4/4 t0060: verify that basename() and dirname() work as expectedJohannes Schindelin, Jan 12, 2016
  52. Ramsay JonesJan 13, 2016
  53. Johannes SchindelinJan 13, 2016
  54. Ramsay JonesJan 13, 2016
  55. Junio C HamanoJan 13, 2016
  56. Torsten BögershausenJan 13, 2016
  57. Johannes SchindelinJan 13, 2016
  58. Johannes SchindelinJan 13, 2016
  59. Johannes SchindelinJan 13, 2016
  60. Ramsay JonesJan 13, 2016
  61. Ramsay JonesJan 13, 2016
  62. Junio C HamanoJan 13, 2016
  63. Johannes SchindelinJan 13, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.