[netcf-devel] [PATCH 1/5] don't redefine DATADIR

Laine Stump laine at laine.org
Mon Mar 16 15:03:14 UTC 2015


A long time ago netcf #defined DATADIR as the base directory for data
files (usually "/usr/share") in datadir.h which was autogenerated by a
Makefile rule, but this conflicted with a different use of DATADIR
somewhere within WIN32 config files, so when the basic (incomplete /
never finished) WIN32 port was added, that #define was renamed to
NETCF_DATADIR to avoid the conflict, and for some reason (which I
cannot discern), DATADIR was redefined to NETCF_DATADIR at the same
time (in internal.h):

  #ifndef WIN32
  #define DATADIR NETCF_DATADIR
  #endif

This redefinition is pointless, because "DATADIR" is never once used
anywhere in the netcf source files.

At a much later date (commit 271944 at the beginning of 2014), we
began using gnulib configmake so that the location of libexecdir could
be modified at configure time, so "DATADIR" is now also #defined in
the automatically generated file gnulib/lib/configmake.h, resulting in
a warning every time drv_redhat.c is compiled:

  In file included from drv_redhat.c:35:0:
  ../gnulib/lib/configmake.h:8:0: warning: "DATADIR" redefined
   #define DATADIR "/usr/share"
   ^
  In file included from drv_redhat.c:24:0:
  ./internal.h:37:0: note: this is the location of the previous definition
   #define DATADIR NETCF_DATADIR
   ^

To eliminate the warnings, all we need to do is remove the pointless

This does point out that our Makefile rule to generate datadir.h is
essentially open-coding the same thing that can now be accomplished by
looking at DATADIR in gnulib configmake.h. (and that, in turn, points
out that the win32 port very likely no longer compiles, due to the
conflict between DATADIR in configmake.h and the DATADIR in the win32
headers. Since the win32 port was never finished, this isn't a big
issue though.) That is a mess to clean up another day...
---
 src/internal.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/internal.h b/src/internal.h
index 0354fb7..8783262 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -1,7 +1,7 @@
 /*
  * internal.h: importantdefinitions used through netcf
  *
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009-2011, 2015 Red Hat Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -84,9 +84,6 @@
 #define ATTRIBUTE_NOINLINE
 #endif                                   /* __GNUC__ */
 
-#ifndef WIN32
-#define DATADIR NETCF_DATADIR
-#endif
 /* This needs ATTRIBUTE_RETURN_CHECK */
 #include "ref.h"
 
-- 
2.1.0



More information about the netcf-devel mailing list