[PATCH 12/18] ptpd: XMALLOC macro defined for RTEMS

Gabriel Moyano gabriel.moyano at dlr.de
Wed Apr 12 13:54:16 UTC 2023


---
 freebsd/contrib/ptpd/src/ptpd.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/freebsd/contrib/ptpd/src/ptpd.h b/freebsd/contrib/ptpd/src/ptpd.h
index 08090317..387d6525 100644
--- a/freebsd/contrib/ptpd/src/ptpd.h
+++ b/freebsd/contrib/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