diff options
author | Nick Clifton <nickc@redhat.com> | 2006-09-16 18:12:17 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2006-09-16 18:12:17 +0000 |
commit | 0112cd268b205d8176b8b4d00988a334822956cf (patch) | |
tree | 67d11340ff93c7dbc29c8917bc03d9d24555f43d /bfd/nlmcode.h | |
parent | 4fa3602bd53183badf1d259128a5f951f32db8cb (diff) | |
download | gdb-0112cd268b205d8176b8b4d00988a334822956cf.zip gdb-0112cd268b205d8176b8b4d00988a334822956cf.tar.gz gdb-0112cd268b205d8176b8b4d00988a334822956cf.tar.bz2 |
* bfd-in.h (STRING_AND_COMMA): New macro. Takes one constant string as its
argument and emits the string followed by a comma and then the length of
the string.
(CONST_STRNEQ): New macro. Checks to see if a variable string has a constant
string as its initial characters.
(CONST_STRNCPY): New macro. Copies a constant string to the start of a
variable string.
* bfd-in2.h: Regenerate.
* <remainign files>: Make use of the new macros.
Diffstat (limited to 'bfd/nlmcode.h')
-rw-r--r-- | bfd/nlmcode.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h index a7d3985..30e6f47 100644 --- a/bfd/nlmcode.h +++ b/bfd/nlmcode.h @@ -174,7 +174,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd) return FALSE; if (bfd_seek (abfd, position, SEEK_SET) != 0) return FALSE; - if (strncmp (tempstr, "VeRsIoN#", 8) == 0) + if (CONST_STRNEQ (tempstr, "VeRsIoN#")) { Nlm_External_Version_Header thdr; @@ -196,7 +196,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd) nlm_version_header (abfd)->day = get_word (abfd, (bfd_byte *) thdr.day); } - else if (strncmp (tempstr, "MeSsAgEs", 8) == 0) + else if (CONST_STRNEQ (tempstr, "MeSsAgEs")) { Nlm_External_Extended_Header thdr; @@ -264,7 +264,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd) nlm_extended_header (abfd)->reserved5 = get_word (abfd, (bfd_byte *) thdr.reserved5); } - else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0) + else if (CONST_STRNEQ (tempstr, "CoPyRiGhT=")) { amt = sizeof (nlm_copyright_header (abfd)->stamp); if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp, @@ -280,7 +280,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd) amt, abfd) != amt) return FALSE; } - else if (strncmp (tempstr, "CuStHeAd", 8) == 0) + else if (CONST_STRNEQ (tempstr, "CuStHeAd")) { Nlm_External_Custom_Header thdr; bfd_size_type hdrLength; @@ -345,7 +345,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd) /* If we have found a Cygnus header, process it. Otherwise, just save the associated data without trying to interpret it. */ - if (strncmp (dataStamp, "CyGnUsEx", 8) == 0) + if (CONST_STRNEQ (dataStamp, "CyGnUsEx")) { file_ptr pos; bfd_byte *contents; @@ -364,7 +364,7 @@ nlm_swap_auxiliary_headers_in (bfd *abfd) if (bfd_seek (abfd, pos, SEEK_SET) != 0) return FALSE; - memcpy (nlm_cygnus_ext_header (abfd), "CyGnUsEx", 8); + memcpy (nlm_cygnus_ext_header (abfd), STRING_COMMA_LEN ("CyGnUsEx")); nlm_cygnus_ext_header (abfd)->offset = dataOffset; nlm_cygnus_ext_header (abfd)->length = dataLength; @@ -645,7 +645,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd) { Nlm_External_Version_Header thdr; - memcpy (thdr.stamp, "VeRsIoN#", 8); + memcpy (thdr.stamp, STRING_COMMA_LEN ("VeRsIoN#")); put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion, (bfd_byte *) thdr.majorVersion); put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion, @@ -672,7 +672,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd) { Nlm_External_Copyright_Header thdr; - memcpy (thdr.stamp, "CoPyRiGhT=", 10); + memcpy (thdr.stamp, STRING_COMMA_LEN ("CoPyRiGhT=")); amt = sizeof (thdr.stamp); if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt) return FALSE; @@ -694,7 +694,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd) { Nlm_External_Extended_Header thdr; - memcpy (thdr.stamp, "MeSsAgEs", 8); + memcpy (thdr.stamp, STRING_COMMA_LEN ("MeSsAgEs")); put_word (abfd, (bfd_vma) nlm_extended_header (abfd)->languageID, (bfd_byte *) thdr.languageID); @@ -797,7 +797,7 @@ nlm_swap_auxiliary_headers_out (bfd *abfd) ds = find_nonzero (nlm_custom_header (abfd)->dataStamp, sizeof (nlm_custom_header (abfd)->dataStamp)); - memcpy (thdr.stamp, "CuStHeAd", 8); + memcpy (thdr.stamp, STRING_COMMA_LEN ("CuStHeAd")); hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0) + nlm_custom_header (abfd)->hdrLength); put_word (abfd, hdrLength, thdr.length); @@ -831,14 +831,14 @@ nlm_swap_auxiliary_headers_out (bfd *abfd) { Nlm_External_Custom_Header thdr; - memcpy (thdr.stamp, "CuStHeAd", 8); + memcpy (thdr.stamp, STRING_COMMA_LEN ("CuStHeAd")); put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8, (bfd_byte *) thdr.length); put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset, (bfd_byte *) thdr.dataOffset); put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length, (bfd_byte *) thdr.dataLength); - memcpy (thdr.dataStamp, "CyGnUsEx", 8); + memcpy (thdr.dataStamp, STRING_COMMA_LEN ("CyGnUsEx")); amt = sizeof (thdr); if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt) return FALSE; |