This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: RFA: Patch to ser-unix.c (When infinite equals 32K seconds)


Andrew Cagney wrote:
> 
> Fernando Nasser wrote:
> >
> > This patch prevents the infinite read block to terminate after 32K seconds...
> >
> > 2000-09-12  Fernando Nasser  <fnasser@cygnus.com>
> >
> >         * ser-unix.c (do_unix_readchar): Prevent infinite read wait to be
> >         interrupted after 32K seconds.
> >
> > --
> > Fernando Nasser
> > Red Hat - Toronto                       E-Mail:  fnasser@cygnus.com
> > 2323 Yonge Street, Suite #300           Tel:  416-482-2661 ext. 311
> > Toronto, Ontario   M4P 2C9              Fax:  416-482-6299
> >
> > Index: ser-unix.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/ser-unix.c,v
> > retrieving revision 1.5
> > diff -c -p -r1.5 ser-unix.c
> > *** ser-unix.c  2000/07/30 01:48:27     1.5
> > --- ser-unix.c  2000/09/12 15:57:11
> > *************** do_unix_readchar (serial_t scb, int time
> > *** 927,933 ****
> >         }
> >
> >         status = ser_unix_wait_for (scb, delta);
> > !       timeout -= delta;
> >
> >         /* If we got a character or an error back from wait_for, then we can
> >            break from the loop before the timeout is completed. */
> > --- 927,933 ----
> >         }
> >
> >         status = ser_unix_wait_for (scb, delta);
> > !       timeout = (timeout <= 0) ? timeout : (timeout - delta);
> 
> Can it be written as:
> 
>         if (timeout > 0)
>           timeout -= delta;
> 
> (correct?) it is easier to read than that ``?'' expression :-).
> Otherwize approved.
> 
>         Andrew

Sure.  I will make the change and commit.

P.S.: (I copied this line from a previous version of the file almost verbatim;
       should have rewritten it.)

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

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