# HG changeset patch # User John W. Eaton # Date 1325860876 18000 # Node ID 06aa17228706cf39cf84d3cfbc15588e87628c91 # Parent 933bf1b4ab29afd7a860583e25374500771200f2 use gnulib::fopen * oct-md5.cc (oct_md5_file): Use gnulib::fopen. * kpse.cc: Don't play #define tricks with fopen. (fopen): Delete. (xfopen): Use gnulib::fopen. * oct-parse.yy (get_help_from_file): Use gnulib::fopen. diff -r 933bf1b4ab29 -r 06aa17228706 liboctave/kpse.cc --- a/liboctave/kpse.cc Fri Jan 06 08:29:11 2012 -0500 +++ b/liboctave/kpse.cc Fri Jan 06 09:41:16 2012 -0500 @@ -225,10 +225,6 @@ #define DEBUGF4(str, e1, e2, e3, e4) \ DEBUGF_START (); gnulib::fprintf (stderr, str, e1, e2, e3, e4); DEBUGF_END () -#undef fopen -#define fopen kpse_fopen_trace -static FILE *fopen (const char *filename, const char *mode); - #endif /* not NO_DEBUG */ #ifdef KPSE_DEBUG @@ -362,11 +358,15 @@ assert (! filename.empty () && mode); - f = fopen (filename.c_str (), mode); + f = gnulib::fopen (filename.c_str (), mode); if (! f) FATAL_PERROR (filename.c_str ()); + if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN)) + DEBUGF3 ("fopen (%s, %s) => 0x%lx\n", filename.c_str (), mode, + reinterpret_cast (f)); + return f; } @@ -2446,28 +2446,6 @@ } #endif -/* Help the user discover what's going on. */ - -#ifdef KPSE_DEBUG - -/* If the real definitions of fopen or fclose are macros, we lose -- the - #undef won't restore them. */ - -static FILE * -fopen (const char *filename, const char *mode) -{ -#undef fopen - FILE *ret = fopen (filename, mode); - - if (KPSE_DEBUG_P (KPSE_DEBUG_FOPEN)) - DEBUGF3 ("fopen (%s, %s) => 0x%lx\n", filename, mode, - reinterpret_cast (ret)); - - return ret; -} - -#endif - /* Implementation of a linked list of strings. */ /* Add the new string STR to the end of the list L. */ diff -r 933bf1b4ab29 -r 06aa17228706 liboctave/oct-md5.cc --- a/liboctave/oct-md5.cc Fri Jan 06 08:29:11 2012 -0500 +++ b/liboctave/oct-md5.cc Fri Jan 06 09:41:16 2012 -0500 @@ -62,7 +62,7 @@ { std::string retval; - FILE *ifile = fopen (file.c_str (), "rb"); + FILE *ifile = gnulib::fopen (file.c_str (), "rb"); if (ifile) { diff -r 933bf1b4ab29 -r 06aa17228706 src/oct-parse.yy --- a/src/oct-parse.yy Fri Jan 06 08:29:11 2012 -0500 +++ b/src/oct-parse.yy Fri Jan 06 09:41:16 2012 -0500 @@ -3612,7 +3612,7 @@ { symbol_found = true; - FILE *fptr = fopen (file.c_str (), "r"); + FILE *fptr = gnulib::fopen (file.c_str (), "r"); if (fptr) {