[En-Nut-Discussion] nutcomponent Code duplication?

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Mon Sep 22 18:22:04 CEST 2014


Hello,

is there any reason for the code duplication of
tools/nutconf/src/nutcomponent and tools/qnutconf/src/nutcomponent?

With some small changes, I could factor out 
tools/common/nutcomponent/[c.h]
and compile both trees with common nutcomponent.
 However for some issues like

+#include "dirent.h"
 #define mkdir(P, M) _mkdir(P)
 #define access _access
-#define strcasecmp stricmp
-#define strncasecmp strnicmp
+#define strcasecmp _stricmp
+#define strncasecmp _strnicmp
+#define strdup _strdup
+#define unlink _unlink
 
or

         if ((cp = strrchr(repo->nr_dir, '/')) != NULL) {
             *cp++ = 0;
-            repo->nr_name = cp;
+            repo->nr_name = strdup(cp);
         } else {
-            repo->nr_dir[0] = 0;
+            repo->nr_name = repo->nr_dir;
+            repo->nr_dir = strdup(".");
         }
 
I don't know which of the both solutions is right.

- Should we try to have common nutcomponent files?

Thanks
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list