[PATCH 12/20] rtems: Move _Partition_Is_buffer_size_aligned()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Nov 20 16:28:39 UTC 2020


On 20/11/2020 17:15, Gedare Bloom wrote:

>> +static bool _Partition_Is_buffer_size_aligned( size_t buffer_size )
> Nit: I never saw this before, but this isn't what "aligned" means.
> Aligned means you start something at a specific multiple. This is
> checking if the buffer_size is a multiple of the pointer size. Anyway,
> it is just used here so it's fine, but maybe just a one-line comment
> that buffer sizes are required to be a multiple of the pointer size.
>
I think in this case we should review the documentation. If the function 
name is irritating, then we should remove it. It is only called in one 
place. So change

   if ( !_Partition_Is_buffer_size_aligned( buffer_size ) )
     return RTEMS_INVALID_SIZE;

to


   if ( ( buffer_size % CPU_SIZEOF_POINTER ) != 0 )
     return RTEMS_INVALID_SIZE;

-- 
embedded brains GmbH
Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
Phone: +49-89-18 94 741 - 16
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

embedded brains GmbH
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list