[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Several patchs from Debian packaging

From: grischka
Subject: Re: [Tinycc-devel] Several patchs from Debian packaging
Date: Sun, 18 Apr 2010 22:31:29 +0200
User-agent: Thunderbird (Windows/20090812)

Thomas Preud'homme wrote:
"libname" should be const (because it is "input only").

You mean filename in that case, and libname for libname_to_filename I guess.


   *(--ext) = '\0';
   strcpy(libname, filename);
   *ext = '.';

That's ugly.

Ok, I changed to:

        if (libprefix && (!strncmp(ext, ".so", 2))) {
            size_t len = ext - filename - 3;
            strncpy(libname, filename + 3, len);
            *(libname + len) = '\0';
            return 1;

I'd propose to write a function such as:

char *tcc_strcpy_part(char *out, const char *in, size_t num)
    memcpy(out, in, num);
    out[num] = 0;
    return out;

Such your code will be shorter and the new function can be used
elsewhere too (e.g. in tok_alloc_new)

for the 3 tests (minus the - 3 for the ".def" comparison when TCC_TARGET_PE is defined).

I also wonder wether is strncmp is a good idea here as it could match .sowtf

I don't understand ".sowtf" but strncmp is almost never a good idea ;)

[P|e9406c0] Complain for static fct declared w/o file scope
Error out on static function without file scope and give an explaination
to the user
Probably too correct.  It's not an error with GCC and also breaks
compilation of some older code I use for testing.
Could you provide me an example where this is the case ? (Cf my previous answer)

Appears it was not an error in GCC 3.x but is one in GCC 4.x.  Maybe
we could make it just a warning for now.  Do what you want ;)

--- grischka

reply via email to

[Prev in Thread] Current Thread [Next in Thread]