Skip to content

Commit

Permalink
Add wrapper for os_free in order to solve the problem of the optional…
Browse files Browse the repository at this point in the history
… semicolon
  • Loading branch information
TheSomeMan committed Dec 8, 2021
1 parent 0cb87a3 commit 57c75ea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions include/os_malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ os_free_internal(void *ptr);
* @brief os_free - is a wrap for 'free' which automatically sets pointer to NULL after the memory freeing.
*/
#define os_free(ptr) \
if (NULL != (ptr)) \
do \
{ \
os_free_internal((void *)(ptr)); \
ptr = NULL; \
}
if (NULL != (ptr)) \
{ \
os_free_internal((void *)(ptr)); \
ptr = NULL; \
} \
} while (0)

#ifdef __cplusplus
}
Expand Down

0 comments on commit 57c75ea

Please sign in to comment.