From 9f30d457c02f514d4d60112ba4ffeb367ce3bee6 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 26 Sep 2017 08:03:05 +0000 Subject: More factory code. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10714 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/oslib/include/chfactory.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'os/common/oslib/include') diff --git a/os/common/oslib/include/chfactory.h b/os/common/oslib/include/chfactory.h index d8cd20a22..2fe2765dd 100644 --- a/os/common/oslib/include/chfactory.h +++ b/os/common/oslib/include/chfactory.h @@ -131,7 +131,7 @@ typedef struct ch_dyn_object { /** * @brief List element of the dynamic object. */ - dyn_element_t list; + dyn_element_t element; /** * @brief Physical objects. * @note This requires C99. @@ -148,7 +148,7 @@ typedef struct ch_dyn_semaphore { /** * @brief List element of the dynamic semaphore. */ - dyn_element_t list; + dyn_element_t element; /** * @brief Physical semaphore. */ @@ -213,6 +213,22 @@ extern "C" { /* Module inline functions. */ /*===========================================================================*/ +/** + * @brief Duplicates an object reference. + * + * @param[in] dep pointer to the element field of the object + * + * @iclass + */ +static inline dyn_element_t *chFactoryDuplicateReferenceI(dyn_element_t *dep) { + + chDbgCheckClassI(); + + dep->refs++; + + return dep; +} + #endif /* CH_CFG_USE_FACTORY == TRUE */ #endif /* CHFACTORY_H */ -- cgit v1.2.3