[PATCH] rtems_termios_puts: Copy and write more than one char at once
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Aug 14 14:13:31 UTC 2014
On 14/08/14 15:58, Kolja Waschk wrote:
> Hi Sebastian,
>
>>> + int nToSend;
>> Integer type is wrong.
>
> Yes, just what the original refill_transmitter uses and expects: nToSend is
> passed as return value to rtems_refill_transmitter, which also returns it to
> its caller as an int...
Ok, rtems_termios_refill_transmitter() and rtems_termios_dequeue_characters()
use the wrong types as well. This termios.c is a real mess. Originally only
ints where used, but someone introduced size_t and ssize_t to match the POSIX
API. Apparently this was done a bit sloppy.
In this function nToSend is computed from unsigned ints, so its type should be
unsigned int.
>
>>> + (void)rtems_termios_start_xmit (tty, tty->rawOutBuf.Tail, false);
>> Please don't use this (void).
>
> Only one of the two callers (rtems_refill_transmitter) is interested in that
> information. Is it preferred to omit the "(void)" in the other or rather do not
> pass the info as a return value, but e.g. into a variable pointed to by a
> further argument?
>
> http://stackoverflow.com/questions/11888594/ignoring-return-values-in-c
If you use this warning, then it makes sense to use this cast, but its not done
in many places in RTEMS and not in termios.c in particular.
>
> Thanks,
> Kolja
>
> --
> mr.k.waschk - ixo.de - hamburg, germany
>
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list