This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

pr14813 revisted


When HJ fixed PR14183 he chose to make bclose return a boolean, with
true denoting success.  That's fine except that the doco wasn't
updated.  Also, all the other iovec functions return an int with zero
meaning success.  Rather than update the documentation, this patch
changes the code back to returning zero for success.

	PR binutils/14813
	* bfdio.c (struct bfd_iovec <bclose>): Revert 2012-11-06.
	(memory_bclose): Likewise.  Return 0 on success.
	* cache.c (cache_bclose): Likewise.
	* opncls.c (opncls_bclose, bfd_close): Likewise.
	* vms-lib.c (vms_lib_bclose): Likewise.
	* libbfd.h: Regenerate.

Index: bfd/bfdio.c
===================================================================
RCS file: /cvs/src/src/bfd/bfdio.c,v
retrieving revision 1.34
diff -u -p -r1.34 bfdio.c
--- bfd/bfdio.c	7 Nov 2012 00:55:04 -0000	1.34
+++ bfd/bfdio.c	14 Jan 2013 06:22:05 -0000
@@ -154,7 +154,7 @@ DESCRIPTION
 .  {* For the following, on successful completion a value of 0 is returned.
 .     Otherwise, a value of -1 is returned (and  <<bfd_error>> is set).  *}
 .  int (*bseek) (struct bfd *abfd, file_ptr offset, int whence);
-.  bfd_boolean (*bclose) (struct bfd *abfd);
+.  int (*bclose) (struct bfd *abfd);
 .  int (*bflush) (struct bfd *abfd);
 .  int (*bstat) (struct bfd *abfd, struct stat *sb);
 .  {* Mmap a part of the files. ADDR, LEN, PROT, FLAGS and OFFSET are the usual
@@ -576,7 +576,7 @@ memory_bseek (bfd *abfd, file_ptr positi
   return 0;
 }
 
-static bfd_boolean
+static int
 memory_bclose (struct bfd *abfd)
 {
   struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
@@ -586,7 +586,7 @@ memory_bclose (struct bfd *abfd)
   free (bim);
   abfd->iostream = NULL;
 
-  return TRUE;
+  return 0;
 }
 
 static int
Index: bfd/cache.c
===================================================================
RCS file: /cvs/src/src/bfd/cache.c,v
retrieving revision 1.43
diff -u -p -r1.43 cache.c
--- bfd/cache.c	7 Nov 2012 00:55:04 -0000	1.43
+++ bfd/cache.c	14 Jan 2013 06:22:05 -0000
@@ -359,10 +359,10 @@ cache_bwrite (struct bfd *abfd, const vo
   return nwrite;
 }
 
-static bfd_boolean
+static int
 cache_bclose (struct bfd *abfd)
 {
-  return bfd_cache_close (abfd);
+  return bfd_cache_close (abfd) - 1;
 }
 
 static int
Index: bfd/opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.77
diff -u -p -r1.77 opncls.c
--- bfd/opncls.c	10 Jan 2013 20:03:54 -0000	1.77
+++ bfd/opncls.c	14 Jan 2013 06:22:07 -0000
@@ -508,7 +508,7 @@ opncls_bwrite (struct bfd *abfd ATTRIBUT
   return -1;
 }
 
-static bfd_boolean
+static int
 opncls_bclose (struct bfd *abfd)
 {
   struct opncls *vec = (struct opncls *) abfd->iostream;
@@ -518,7 +518,7 @@ opncls_bclose (struct bfd *abfd)
   if (vec->close != NULL)
     status = (vec->close) (abfd, vec->stream);
   abfd->iostream = NULL;
-  return status == 0;
+  return status;
 }
 
 static int
@@ -723,7 +723,7 @@ bfd_close (bfd *abfd)
   if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
     return FALSE;
 
-  ret = abfd->iovec->bclose (abfd);
+  ret = abfd->iovec->bclose (abfd) == 0;
 
   if (ret)
     _maybe_make_executable (abfd);
Index: bfd/vms-lib.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-lib.c,v
retrieving revision 1.26
diff -u -p -r1.26 vms-lib.c
--- bfd/vms-lib.c	9 Nov 2012 08:29:29 -0000	1.26
+++ bfd/vms-lib.c	14 Jan 2013 06:22:07 -0000
@@ -1174,11 +1174,11 @@ vms_lib_bwrite (struct bfd *abfd ATTRIBU
   return -1;
 }
 
-static bfd_boolean
+static int
 vms_lib_bclose (struct bfd *abfd)
 {
   abfd->iostream = NULL;
-  return TRUE;
+  return 0;
 }
 
 static int

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]