[PATCH v2 12/18] ptpd: XMALLOC macro defined for RTEMS
Gabriel Moyano
gabriel.moyano at dlr.de
Mon Apr 17 07:59:25 UTC 2023
---
rtemsbsd/ptpd/src/ptpd.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/rtemsbsd/ptpd/src/ptpd.h b/rtemsbsd/ptpd/src/ptpd.h
index 08090317..387d6525 100644
--- a/rtemsbsd/ptpd/src/ptpd.h
+++ b/rtemsbsd/ptpd/src/ptpd.h
@@ -183,12 +183,21 @@
/* NOTE: this macro can be refactored into a function */
+#ifndef __rtems__
#define XMALLOC(ptr,size) \
if(!((ptr)=malloc(size))) { \
PERROR("failed to allocate memory"); \
ptpdShutdown(ptpClock); \
exit(1); \
}
+#else /* __rtems__ */
+#define XMALLOC(ptr,size) \
+ if(!((ptr)=rtems_malloc(size))) { \
+ PERROR("failed to allocate memory"); \
+ ptpdShutdown(ptpClock); \
+ exit(1); \
+ }
+#endif /* __rtems__ */
#define SAFE_FREE(pointer) \
if(pointer != NULL) { \
--
2.25.1
More information about the devel
mailing list