gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / srec.c
index 5ca4f36ae5944ae34cb7c9d7146f03e626efc453..ef7eb43995902693aaf410373e327da178973b6b 100644 (file)
@@ -493,8 +493,7 @@ srec_scan (bfd *abfd)
 
            if (bytes * 2 > bufsize)
              {
-               if (buf != NULL)
-                 free (buf);
+               free (buf);
                buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
                if (buf == NULL)
                  goto error_return;
@@ -618,9 +617,7 @@ srec_scan (bfd *abfd)
                    goto error_return;
                  }
 
-               if (buf != NULL)
-                 free (buf);
-
+               free (buf);
                return TRUE;
              }
          }
@@ -631,16 +628,12 @@ srec_scan (bfd *abfd)
   if (error)
     goto error_return;
 
-  if (buf != NULL)
-    free (buf);
-
+  free (buf);
   return TRUE;
 
  error_return:
-  if (symbuf != NULL)
-    free (symbuf);
-  if (buf != NULL)
-    free (buf);
+  free (symbuf);
+  free (buf);
   return FALSE;
 }
 
@@ -751,8 +744,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
 
       if (bytes * 2 > bufsize)
        {
-         if (buf != NULL)
-           free (buf);
+         free (buf);
          buf = (bfd_byte *) bfd_malloc ((bfd_size_type) bytes * 2);
          if (buf == NULL)
            goto error_return;
@@ -768,8 +760,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
        {
        default:
          BFD_ASSERT (sofar == section->size);
-         if (buf != NULL)
-           free (buf);
+         free (buf);
          return TRUE;
 
        case '3':
@@ -793,8 +784,7 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
            {
              /* We've come to the end of this section.  */
              BFD_ASSERT (sofar == section->size);
-             if (buf != NULL)
-               free (buf);
+             free (buf);
              return TRUE;
            }
 
@@ -817,14 +807,11 @@ srec_read_section (bfd *abfd, asection *section, bfd_byte *contents)
 
   BFD_ASSERT (sofar == section->size);
 
-  if (buf != NULL)
-    free (buf);
-
+  free (buf);
   return TRUE;
 
  error_return:
-  if (buf != NULL)
-    free (buf);
+  free (buf);
   return FALSE;
 }
 
@@ -1015,15 +1002,15 @@ srec_write_record (bfd *abfd,
 static bfd_boolean
 srec_write_header (bfd *abfd)
 {
-  unsigned int len = strlen (abfd->filename);
+  unsigned int len = strlen (bfd_get_filename (abfd));
 
   /* I'll put an arbitrary 40 char limit on header size.  */
   if (len > 40)
     len = 40;
 
   return srec_write_record (abfd, 0, (bfd_vma) 0,
-                           (bfd_byte *) abfd->filename,
-                           (bfd_byte *) abfd->filename + len);
+                           (bfd_byte *) bfd_get_filename (abfd),
+                           (bfd_byte *) bfd_get_filename (abfd) + len);
 }
 
 static bfd_boolean
@@ -1089,9 +1076,9 @@ srec_write_symbols (bfd *abfd)
       bfd_size_type len;
       asymbol **table = bfd_get_outsymbols (abfd);
 
-      len = strlen (abfd->filename);
+      len = strlen (bfd_get_filename (abfd));
       if (bfd_bwrite ("$$ ", (bfd_size_type) 3, abfd) != 3
-         || bfd_bwrite (abfd->filename, len, abfd) != len
+         || bfd_bwrite (bfd_get_filename (abfd), len, abfd) != len
          || bfd_bwrite ("\r\n", (bfd_size_type) 2, abfd) != 2)
        return FALSE;
 
This page took 0.026956 seconds and 4 git commands to generate.