diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-03-06 10:13:59 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-03-06 10:13:59 +0000 |
commit | a380d9ad03f2fcf950dad0f08652a03b738dc0e8 (patch) | |
tree | 78dfbd7a271ba17cbb8cd7383a5c7edcb87f448b /os/rt/src/chmemcore.c | |
parent | b53489d0e4252aafe5ada7466e0b3b7c4ad5aaaf (diff) | |
download | ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.tar.gz ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.tar.bz2 ChibiOS-a380d9ad03f2fcf950dad0f08652a03b738dc0e8.zip |
More MISRA.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7716 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/src/chmemcore.c')
-rw-r--r-- | os/rt/src/chmemcore.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/os/rt/src/chmemcore.c b/os/rt/src/chmemcore.c index 95c8d2682..1529fc2cf 100644 --- a/os/rt/src/chmemcore.c +++ b/os/rt/src/chmemcore.c @@ -45,7 +45,7 @@ #include "ch.h"
-#if CH_CFG_USE_MEMCORE || defined(__DOXYGEN__)
+#if (CH_CFG_USE_MEMCORE == TRUE) || defined(__DOXYGEN__)
/*===========================================================================*/
/* Module exported variables. */
@@ -83,10 +83,12 @@ void _core_init(void) { nextmem = (uint8_t *)MEM_ALIGN_NEXT(__heap_base__);
endmem = (uint8_t *)MEM_ALIGN_PREV(__heap_end__);
#else
- static stkalign_t buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE)/MEM_ALIGN_SIZE];
+ static stkalign_t buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE) /
+ MEM_ALIGN_SIZE];
nextmem = (uint8_t *)&buffer[0];
- endmem = (uint8_t *)&buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE)/MEM_ALIGN_SIZE];
+ endmem = (uint8_t *)&buffer[MEM_ALIGN_NEXT(CH_CFG_MEMCORE_SIZE) /
+ MEM_ALIGN_SIZE];
#endif
}
@@ -130,7 +132,10 @@ void *chCoreAllocI(size_t size) { chDbgCheckClassI();
size = MEM_ALIGN_NEXT(size);
+ /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
+ is safe.*/
if ((size_t)(endmem - nextmem) < size) {
+ /*lint -restore*/
return NULL;
}
p = nextmem;
@@ -148,8 +153,11 @@ void *chCoreAllocI(size_t size) { */
size_t chCoreGetStatusX(void) {
+ /*lint -save -e946 -e947 [18.2, 18.3] Normal pointers arithmetic, it
+ is safe.*/
return (size_t)(endmem - nextmem);
+ /*lint -restore*/
}
-#endif /* CH_CFG_USE_MEMCORE */
+#endif /* CH_CFG_USE_MEMCORE == TRUE */
/** @} */
|