get_readahead; remove duplicate

Brian Ford Brian.Ford@flightsafety.com
Thu Jul 27 03:18:00 GMT 2006


One more tiny one.

2006-07-26  Brian ford  <Brian.Ford@FlightSafety.com>

	* fhandler.cc (fhandler_base::read): Call
	get_readahead_into_buffer instead of duplicating it.

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...
-------------- next part --------------
Index: fhandler.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v
retrieving revision 1.257
diff -u -p -r1.257 fhandler.cc
--- fhandler.cc	25 Jul 2006 19:23:23 -0000	1.257
+++ fhandler.cc	27 Jul 2006 03:13:52 -0000
@@ -716,17 +716,7 @@ void
 fhandler_base::read (void *in_ptr, size_t& len)
 {
   char *ptr = (char *) in_ptr;
-  ssize_t copied_chars = 0;
-  int c;
-
-  while (len)
-    if ((c = get_readahead ()) < 0)
-      break;
-    else
-      {
-	ptr[copied_chars++] = (unsigned char) (c & 0xff);
-	len--;
-      }
+  ssize_t copied_chars = get_readahead_into_buffer (ptr, len);
 
   if (copied_chars && is_slow ())
     {
@@ -734,6 +724,7 @@ fhandler_base::read (void *in_ptr, size_
       goto out;
     }
 
+  len -= copied_chars;
   if (!len)
     {
       len = (size_t) copied_chars;


More information about the Cygwin-patches mailing list