This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Isn't A_uto_F_ilter_E_ntry_T_ype self documenting? :)
* pe-dll.c (AFET): New macro.
The name "AFET" is a little bit obscure. I would have thought a more self-documenting name would be better, eg AUTOFILTER_ENTRY or STRING_AND_LEN.
Also I think that it would be a great idea if this macro were placed in a header file (eg bfd.h via bfd-in.h) so that it could be used elsewhere in the binutils code (eg bfd/elf.c, bfd/archive.c, binutils/readelf.c). In this case I think that a more generic name for the macro would be appropriate (eg STRING_COMMA_LEN).
#define const_strcmp(DST, ORG) \ strncmp (DST, ORG "", sizeof (ORG) - 1)
#define STR_STRLEN_ASSERT(COND, MSG) \ sizeof (struct { char MSG[ !(COND) ? -1 : 1 ]; })
#define check_strncmp(DST, SRC, N) \ ( STR_STRLEN_ASSERT ((sizeof (SRC "") - 1) == (N), \ check_strncmp_length_mismatch), \ strncmp (DST, SRC, N) )
bfd/cofflink.c:235 - && !strncmp (name,"__imp_", 6)) + && !const_strncmp (name,"__imp_"))
bfd/archive.c:916 - if (!strncmp (nextname, "__.SYMDEF ", 16) + if (!check_strncmp (nextname, "__.SYMDEF ", 16)
Maybe a better name for these macros would have 'prefix' in it? const_strprefixcmp ? check_strprefixcmp ?
I can prepare a patch with these macros and with STRING_COMMA_LEN if there is interest, or just with STRING_COMMA_LEN.
Of course I would fold STR_STRLEN_ASSERT into check_strncmp to minimize the namespace clutter.
Cheers, Pedro Alves
Attachment:
strstrlen.tar.gz
Description: GNU Zip compressed data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |