COVESA/dlt-daemon

dlt-convert.c has a function get_filename_ext() conflicts with same name function in dlt_common.c

Closed this issue · 2 comments

pffang commented

#545 add a new function get_filename_ext in dlt-convert.c

char *get_filename_ext(const char *filename)
{
    if (filename == NULL)
            fprintf(stderr, "ERROR: %s: invalid arguments\n", __FUNCTION__);

    char *dot = strrchr(filename, '.');
    if(!dot || dot == filename)
        return "";
    return dot + 1;
}

And we already have a function with the same name in dlt_common.c

char *get_filename_ext(const char *filename)
{
    if (filename == NULL) {
        fprintf(stderr, "ERROR: %s: invalid arguments\n", __FUNCTION__);
        return NULL;
    }

    char *dot = strrchr(filename, '.');
    return (!dot || dot == filename) ? NULL : dot;
}

Add these two functions have different implementations.

This conflict makes we cannot statically link for the console tool dlt-convert,

ld: ../lib/libdlt.a(dlt_common.c.o): in function get_filename_ext': /*/dlt-daemon/src/shared/dlt_common.c:4410: multiple definition of get_filename_ext'; CMakeFiles/dlt-convert.dir/dlt-convert.c.o:/*/dlt-daemon/src/console/dlt-convert.c:130: first defined here

pffang commented

I think #483 is good, and we can fix this issue after that, add get_filename_ext as a common function.

Fix is uploaded in #578