tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Small patch


From: Domingo Alvarez Duarte
Subject: Re: [Tinycc-devel] Small patch
Date: Thu, 31 Jan 2013 12:41:01 +0000




On Thu, Jan 31, 2013 at 12:19 PM, grischka <address@hidden> wrote:


-            h = elf_hash(name) % nbuckets;
+            h = name ? elf_hash(name) % nbuckets : 0;

This is counterproductive IMO because when you read this you get
the wrong impression that there are cases where "name" is NULL.
But in fact there is no such case.  So the naive reader is misled,
while the knowledgeable reader must conclude that the writer didn't
know what s/he was doing.

I totally agree with you !
But look some lines above on this same function !!!!!

/* return the symbol number */
ST_FUNC int put_elf_sym(Section *s, uplong value, unsigned long size,
    int info, int other, int shndx, const char *name)
{
    int name_offset, sym_index;
    int nbuckets, h;
    ElfW(Sym) *sym;
    Section *hs;
   
    sym = section_ptr_add(s, sizeof(ElfW(Sym)));
    if (name) /////////////////////////////////////////////////////////////<<<< This mean name can be null ?????????
        name_offset = put_elf_str(s->link, name);
    else
        name_offset = 0;
    /* XXX: endianness */
 


reply via email to

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