octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glob and fnmatch functions from gnulib


From: Judd Storrs
Subject: Re: glob and fnmatch functions from gnulib
Date: Wed, 16 Dec 2009 18:37:27 -0500

On Wed, Dec 16, 2009 at 5:00 PM, John W. Eaton <address@hidden> wrote:
> Oh, I think I see the problem.  The gnulib glob.h file does
>
>  #define glob rpl_glob
>
> to replace the system glob function with the one from gnulib.  So I
> would guess that you end up with glob_match::rpl_glob.


Ok, this isn't elegant, but it fixes the build for me. The actual real
glob only seems to be used once inside glob-match.cc. I previously
tried adding #include <glob.h> to glob-match.h but that ultimately
doesn't work because the define messes up src/dirfns.cc.

Does using gnulib always result in replacement of glob by rpl_glob? If
so, it could probably be simplified to #undef glob instead of the #if
block. I don't know how to actually test the non-replacement case...


--judd


diff -r a5a05b2ebb9d liboctave/glob-match.cc
--- a/liboctave/glob-match.cc   Wed Dec 16 07:38:52 2009 +0100
+++ b/liboctave/glob-match.cc   Wed Dec 16 18:27:30 2009 -0500
@@ -30,6 +30,14 @@
 #include <iostream>
 #include <string>

+// Workaround for gnulib <glob.h> #define glob rpl_glob
+// The define modifies the method name otherwise
+#ifdef rpl_glob
+#  undef glob
+#else
+#  define rpl_glob glob
+#endif
+
 #include "file-stat.h"
 #include "glob-match.h"
 #include "str-vec.h"
@@ -97,7 +105,7 @@
        {
          glob_t glob_info;

-         int err = ::glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info);
+         int err = ::rpl_glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info);

          if (! err)
            {


reply via email to

[Prev in Thread] Current Thread [Next in Thread]