Skip to content

Commit

Permalink
Add functions with shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Sep 26, 2020
1 parent fe8a449 commit 15dd70c
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions lwprintf/src/include/lwprintf/lwprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@ int lwprintf_snprintf_ex(lwprintf_t* const lw, char* s, size_t n, const
*/
#define lwprintf_printf(format, ...) lwprintf_printf_ex(NULL, (format), ## __VA_ARGS__)

/**
* \copydoc lwprintf_printf
* \note This function is equivalent to \ref lwprintf_printf
*/
#define lwprintf lwprintf_printf

/**
* \brief Write formatted data from variable argument list to sized buffer at default LwPRINTF instance
* \param[in] s: Pointer to a buffer where the resulting C-string is stored.
Expand Down Expand Up @@ -177,6 +171,37 @@ int lwprintf_snprintf_ex(lwprintf_t* const lw, char* s, size_t n, const
*/
#define lwprintf_sprintf(s, format, ...) lwprintf_sprintf_ex(NULL, (s), (format), ## __VA_ARGS__)

/* Shortcut versions */
/**
* \copydoc lwprintf_printf
* \note This function is equivalent to \ref lwprintf_printf
*/
#define lwprintf lwprintf_printf

/**
* \copydoc lwprintf_vprintf
* \note This function is equivalent to \ref lwprintf_vprintf
*/
#define lwvprintf(format, arg) lwprintf_vprintf

/**
* \copydoc lwprintf_vsnprintf
* \note This function is equivalent to \ref lwprintf_vsnprintf
*/
#define lwvsnprintf(s, n, format, arg) lwprintf_vsnprintf

/**
* \copydoc lwprintf_snprintf
* \note This function is equivalent to \ref lwprintf_snprintf
*/
#define lwsnprintf(s, n, format, ...) lwprintf_snprintf

/**
* \copydoc lwprintf_sprintf
* \note This function is equivalent to \ref lwprintf_sprintf
*/
#define lwsprintf(s, format, ...) lwprintf_sprintf

/**
* \}
*/
Expand Down

0 comments on commit 15dd70c

Please sign in to comment.