[PATCH 3/4] Filesystem: Use rtems_libio_iop_to_descriptor()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 2 14:50:42 UTC 2015


On 02/02/15 15:37, Joel Sherrill wrote:
> On 2/2/2015 8:25 AM, Sebastian Huber wrote:
>> >Drop parameter check from previously unused
>> >rtems_libio_iop_to_descriptor().
>> >---
>> >  cpukit/libcsupport/include/rtems/libio_.h  | 2 +-
>> >  cpukit/libcsupport/src/fcntl.c             | 2 +-
>> >  cpukit/libcsupport/src/open.c              | 2 +-
>> >  cpukit/libnetworking/rtems/rtems_syscall.c | 2 +-
>> >  4 files changed, 4 insertions(+), 4 deletions(-)
>> >
>> >diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h
>> >index d021c1b..1300d39 100644
>> >--- a/cpukit/libcsupport/include/rtems/libio_.h
>> >+++ b/cpukit/libcsupport/include/rtems/libio_.h
>> >@@ -107,7 +107,7 @@ extern rtems_filesystem_global_location_t rtems_filesystem_global_location_null;
>> >   */
>> >  
>> >  #define rtems_libio_iop_to_descriptor(_iop) \
>> >-   ((!(_iop)) ? -1 : (_iop - rtems_libio_iops))
>> >+  ((_iop) - &rtems_libio_iops[0])
> You dropped a NULL check. What is the rationale? Should it be
> a debug assert?

This macro was unused before. All the new users didn't check for NULL. I 
don't think we should plaster the source code with NULL pointer checks.

-- 
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