Add startswith function and use it instead of CONST_STRNEQ.
[deliverable/binutils-gdb.git] / binutils / emul_aix.c
index c54e1083e5d5e91a6e74dcb5b6e4fdde45e502ef..c11c28bd030dec952d96def3d1bf9af9983c8a92 100644 (file)
@@ -1,5 +1,5 @@
 /* Binutils emulation layer.
-   Copyright (C) 2002-2020 Free Software Foundation, Inc.
+   Copyright (C) 2002-2021 Free Software Foundation, Inc.
    Written by Tom Rix, Red Hat Inc.
 
    This file is part of GNU Binutils.
@@ -67,30 +67,20 @@ check_aix (bfd *try_bfd)
 }
 
 static bfd_boolean
-ar_emul_aix_append (bfd **after_bfd, char *file_name, const char *target,
+ar_emul_aix_append (bfd **after_bfd, bfd *new_bfd,
                    bfd_boolean verbose, bfd_boolean flatten)
 {
-  bfd *new_bfd;
-
-  new_bfd = bfd_openr (file_name, target);
-  AR_EMUL_ELEMENT_CHECK (new_bfd, file_name);
-
   return do_ar_emul_append (after_bfd, new_bfd, verbose, flatten, check_aix);
 }
 
 static bfd_boolean
-ar_emul_aix_replace (bfd **after_bfd, char *file_name, const char *target,
+ar_emul_aix_replace (bfd **after_bfd, bfd *new_bfd,
                     bfd_boolean verbose)
 {
-  bfd *new_bfd;
-
-  new_bfd = bfd_openr (file_name, target);
-  AR_EMUL_ELEMENT_CHECK (new_bfd, file_name);
-
   if (!check_aix (new_bfd))
     return FALSE;
 
-  AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name);
+  AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, bfd_get_filename (new_bfd));
 
   new_bfd->archive_next = *after_bfd;
   *after_bfd = new_bfd;
@@ -101,25 +91,25 @@ ar_emul_aix_replace (bfd **after_bfd, char *file_name, const char *target,
 static bfd_boolean
 ar_emul_aix_parse_arg (char *arg)
 {
-  if (CONST_STRNEQ (arg, "-X32_64"))
+  if (startswith (arg, "-X32_64"))
     {
       big_archive = TRUE;
       X32 = TRUE;
       X64 = TRUE;
     }
-  else if (CONST_STRNEQ (arg, "-X32"))
+  else if (startswith (arg, "-X32"))
     {
       big_archive = TRUE;
       X32 = TRUE;
       X64 = FALSE;
     }
-  else if (CONST_STRNEQ (arg, "-X64"))
+  else if (startswith (arg, "-X64"))
     {
       big_archive = TRUE;
       X32 = FALSE;
       X64 = TRUE;
     }
-  else if (CONST_STRNEQ (arg, "-g"))
+  else if (startswith (arg, "-g"))
     {
       big_archive = FALSE;
       X32 = TRUE;
This page took 0.023895 seconds and 4 git commands to generate.