[En-Nut-Discussion] nutcomponent Code duplication?

Harald Kipp harald.kipp at egnite.de
Tue Sep 23 15:41:12 CEST 2014


Hi Uwe,

On 22.09.2014 18:22, Uwe Bonnes wrote:

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

Yes, laziness.


>  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

This is what I've heard about file system functions: Some libraries
(most notably MSC) require to prepend an underscore to Posix functions
for ISO C++ conformity.

For the string functions: MSC doesn't know about str*case*(). Again,
later versions require the leading underscore.

So, the underscored thing looks more up to date to me, but last time I
tried, both versions built fine with MS Visual Studio 2010.


>          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(".");
>          }

This is patch r4344. Probably I applied this to the wxWidgets version
only, because that was the one I had been using at that time. The Qt
version had several issues.

> - Should we try to have common nutcomponent files?

Do we still need 2 different Configurators? Some months ago the Qt
version didn't work for me, and I was too busy to fix it. So I was happy
to have a fallback with the wxWidget variant.

Lately I saw several patches to the Qt version from Thiago and it looks
to me, that he fixed all known issues. I'd vote for finally removing the
wxWidget version.

Regards,

Harald



More information about the En-Nut-Discussion mailing list