* bfd-in.h (CONST_STRNCPY) : Delete.
(LITSTRCPY) : New. (LITMEMCPY) : New. * bfd-in2.h : Regenerate. * elflink.c (bfd_elf_gc_sections) : Use LITMEMCPY. Don't manually calculate string lengths. * nlmcode.h (nlm_swap_auxiliary_headers_in) : Use LITMEMCPY. * nlmconv.c (main) : Use LITMEMCPY. * prdbg.c (tg_class_static_member) : Use LITSTRCPY.
This commit is contained in:
parent
2642de2a6c
commit
ea9986ff00
8 changed files with 56 additions and 30 deletions
|
@ -59,7 +59,12 @@ extern "C" {
|
|||
|
||||
Note - these macros do NOT work if STR2 is not a constant string. */
|
||||
#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
|
||||
#define CONST_STRNCPY(STR1,STR2) strncpy ((STR1), (STR2), sizeof (STR2) - 1)
|
||||
/* strcpy() can have a similar problem, but since we know we are
|
||||
copying a constant string, we can use memcpy which will be faster
|
||||
since there is no need to check for a NUL byte inside STR. We
|
||||
can also save time if we do not need to copy the terminating NUL. */
|
||||
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
|
||||
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
|
||||
|
||||
|
||||
/* The word size used by BFD on the host. This may be 64 with a 32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue