diff options
author | Nick Clifton <nickc@redhat.com> | 2006-09-28 12:59:25 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2006-09-28 12:59:25 +0000 |
commit | ea9986ff0085095cd23ec95dc0e42177c062e117 (patch) | |
tree | 82db9fd23cc38c85fa029aaf30bbf5196b9ed5e1 /bfd/bfd-in2.h | |
parent | 2642de2a6c63f6a5710395e0ab502d6929d2ffd6 (diff) | |
download | gdb-ea9986ff0085095cd23ec95dc0e42177c062e117.zip gdb-ea9986ff0085095cd23ec95dc0e42177c062e117.tar.gz gdb-ea9986ff0085095cd23ec95dc0e42177c062e117.tar.bz2 |
* 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.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r-- | bfd/bfd-in2.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index a2c8ff8..0fc6232 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -66,7 +66,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 |