*
* @param[in] fmt printf style format string.
* If NULL clears any existing messages.
- * @param[in] ... Arguments for the format string.
+ * @param[in] ap Arguments for the format string.
*
* @hidecallergraph
*/
-void fr_strerror_printf(char const *fmt, ...)
+void fr_strerror_vprintf(char const *fmt, va_list ap)
{
- va_list ap;
+ va_list our_ap;
- va_start(ap, fmt);
- strerror_vprintf(fmt, ap);
- va_end(ap);
+ va_copy(our_ap, ap);
+ strerror_vprintf(fmt, our_ap);
+ va_end(our_ap);
}
/** Add a message to an existing stack of messages at the tail
*
* @param[in] fmt printf style format string.
- * If NULL clears any existing messages.
- * @param[in] ... Arguments for the format string.
+ * @param[in] ap Arguments for the format string.
*
* @hidecallergraph
*/
-void fr_strerror_printf_push(char const *fmt, ...)
+void fr_strerror_vprintf_push(char const *fmt, va_list ap)
{
- va_list ap;
+ va_list our_ap;
fr_log_buffer_t *buffer;
fr_log_entry_t *entry;
buffer = fr_strerror_init();
if (unlikely(!buffer)) return;
- va_start(ap, fmt);
- entry = strerror_vprintf_push(buffer, fmt, ap);
- va_end(ap);
+ va_copy(our_ap, ap);
+ entry = strerror_vprintf_push(buffer, fmt, our_ap);
+ va_end(our_ap);
if (unlikely(!entry)) return;
/** Add a message to an existing stack of messages at the head
*
* @param[in] fmt printf style format string.
- * If NULL clears any existing messages.
- * @param[in] ... Arguments for the format string.
+ * @param[in] ap Arguments for the format string.
*
* @hidecallergraph
*/
-void fr_strerror_printf_push_head(char const *fmt, ...)
+void fr_strerror_vprintf_push_head(char const *fmt, va_list ap)
{
- va_list ap;
+ va_list our_ap;
fr_log_buffer_t *buffer;
fr_log_entry_t *entry;
buffer = fr_strerror_init();
if (unlikely(!buffer)) return;
- va_start(ap, fmt);
- entry = strerror_vprintf_push(buffer, fmt, ap);
- va_end(ap);
+ va_copy(our_ap, ap);
+ entry = strerror_vprintf_push(buffer, fmt, our_ap);
+ va_end(our_ap);
if (unlikely(!entry)) return;
* @param[in] offset Positive offset to show where the error
* should be positioned.
* @param[in] fmt Error string.
- * @param[in] ... Arguments for the error string.
+ * @param[in] ap Arguments for the error string.
*
* @hidecallergraph
*/
-void fr_strerror_marker_printf(char const *subject, size_t offset, char const *fmt, ...)
+void fr_strerror_marker_vprintf(char const *subject, size_t offset, char const *fmt, va_list ap)
{
- va_list ap;
+ va_list our_ap;
fr_log_entry_t *entry;
- va_start(ap, fmt);
- entry = strerror_vprintf(fmt, ap);
- va_end(ap);
+ va_copy(our_ap, ap);
+ entry = strerror_vprintf(fmt, our_ap);
+ va_end(our_ap);
if (unlikely(!entry)) return;
* @param[in] offset Positive offset to show where the error
* should be positioned.
* @param[in] fmt Error string.
- * @param[in] ... Arguments for the error string.
+ * @param[in] ap Arguments for the error string.
*
* @hidecallergraph
*/
-void fr_strerror_marker_printf_push(char const *subject, size_t offset, char const *fmt, ...)
+void fr_strerror_marker_vprintf_push(char const *subject, size_t offset, char const *fmt, va_list ap)
{
- va_list ap;
+ va_list our_ap;
fr_log_entry_t *entry;
fr_log_buffer_t *buffer;
buffer = fr_strerror_init();
if (unlikely(!buffer)) return;
- va_start(ap, fmt);
- entry = strerror_vprintf_push(buffer, fmt, ap);
- va_end(ap);
+ va_copy(our_ap, ap);
+ entry = strerror_vprintf_push(buffer, fmt, our_ap);
+ va_end(our_ap);
if (unlikely(!entry)) return;
* @param[in] offset Positive offset to show where the error
* should be positioned.
* @param[in] fmt Error string.
- * @param[in] ... Arguments for the error string.
+ * @param[in] ap Arguments for the error string.
*
* @hidecallergraph
*/
-void fr_strerror_marker_printf_push_head(char const *subject, size_t offset, char const *fmt, ...)
+void fr_strerror_marker_vprintf_push_head(char const *subject, size_t offset, char const *fmt, va_list ap)
{
- va_list ap;
+ va_list our_ap;
fr_log_entry_t *entry;
fr_log_buffer_t *buffer;
buffer = fr_strerror_init();
if (unlikely(!buffer)) return;
- va_start(ap, fmt);
- entry = strerror_vprintf_push(buffer, fmt, ap);
- va_end(ap);
+ va_copy(our_ap, ap);
+ entry = strerror_vprintf_push(buffer, fmt, our_ap);
+ va_end(our_ap);
if (unlikely(!entry)) return;
#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <string.h>
+#include <stdarg.h>
/** @name Add an error string to the thread local error stack
*
*
* @{
*/
+
/** @hidecallergraph */
-void fr_strerror_printf(char const *fmt, ...) CC_HINT(nonnull) CC_HINT(format (printf, 1, 2));
+void fr_strerror_vprintf(char const *fmt, va_list ap);
/** @hidecallergraph */
-void fr_strerror_printf_push(char const *fmt, ...) CC_HINT(nonnull) CC_HINT(format (printf, 1, 2));
+void fr_strerror_vprintf_push(char const *fmt, va_list ap);
/** @hidecallergraph */
-void fr_strerror_printf_push_head(char const *fmt, ...) CC_HINT(nonnull) CC_HINT(format (printf, 1, 2));
+void fr_strerror_vprintf_push_head(char const *fmt, va_list ap);
+
+/** Log to thread local error buffer
+ *
+ * @param[in] fmt printf style format string.
+ * If NULL clears any existing messages.
+ * @param[in] ... Arguments for the format string.
+ *
+ * @hidecallergraph
+ */
+static inline CC_HINT(nonnull) CC_HINT(format (printf, 1, 2))
+void fr_strerror_printf(char const *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fr_strerror_vprintf(fmt, ap);
+ va_end(ap);
+}
+
+/** Add a message to an existing stack of messages at the tail
+ *
+ * @param[in] fmt printf style format string.
+ * @param[in] ... Arguments for the format string.
+ *
+ * @hidecallergraph
+ */
+
+static inline CC_HINT(nonnull) CC_HINT(format (printf, 1, 2))
+void fr_strerror_printf_push(char const *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fr_strerror_vprintf_push(fmt, ap);
+ va_end(ap);
+}
+
+/** Add a message to an existing stack of messages at the head
+ *
+ * @param[in] fmt printf style format string.
+ * @param[in] ... Arguments for the format string.
+ *
+ * @hidecallergraph
+ */
+static inline CC_HINT(nonnull) CC_HINT(format (printf, 1, 2))
+void fr_strerror_printf_push_head(char const *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fr_strerror_vprintf_push_head(fmt, ap);
+ va_end(ap);
+}
/** @} */
/** @name Add an error string with marker to the thread local error stack
* @{
*/
/** @hidecallergraph */
-void fr_strerror_marker_printf(char const *subject, size_t offset, char const *fmt, ...) CC_HINT(nonnull) CC_HINT(format (printf, 3, 4));
+void fr_strerror_marker_vprintf(char const *subject, size_t offset, char const *fmt, va_list ap);
/** @hidecallergraph */
-void fr_strerror_marker_printf_push(char const *subject, size_t offset, char const *fmt, ...) CC_HINT(nonnull) CC_HINT(format (printf, 3, 4));
+void fr_strerror_marker_vprintf_push(char const *subject, size_t offset, char const *fmt, va_list ap);
/** @hidecallergraph */
-void fr_strerror_marker_printf_push_head(char const *subject, size_t offset, char const *fmt, ...) CC_HINT(nonnull) CC_HINT(format (printf, 3, 4));
+void fr_strerror_marker_vprintf_push_head(char const *subject, size_t offset, char const *fmt, va_list ap);
+
+/** Add an error marker to an existing stack of messages
+ *
+ * @param[in] subject to mark up.
+ * @param[in] offset Positive offset to show where the error
+ * should be positioned.
+ * @param[in] fmt Error string.
+ * @param[in] ... Arguments for the error string.
+ *
+ * @hidecallergraph
+ */
+static inline CC_HINT(nonnull) CC_HINT(format (printf, 3, 4))
+void fr_strerror_marker_printf(char const *subject, size_t offset, char const *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fr_strerror_marker_vprintf(subject, offset, fmt, ap);
+ va_end(ap);
+}
+
+/** Add an error marker to an existing stack of messages at the tail
+ *
+ * @param[in] subject to mark up.
+ * @param[in] offset Positive offset to show where the error
+ * should be positioned.
+ * @param[in] fmt Error string.
+ * @param[in] ... Arguments for the error string.
+ *
+ * @hidecallergraph
+ */
+static inline CC_HINT(nonnull) CC_HINT(format (printf, 3, 4))
+void fr_strerror_marker_printf_push(char const *subject, size_t offset, char const *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fr_strerror_marker_vprintf_push(subject, offset, fmt, ap);
+ va_end(ap);
+}
+
+/** Add an error marker to an existing stack of messages at the head
+ *
+ * @param[in] subject to mark up.
+ * @param[in] offset Positive offset to show where the error
+ * should be positioned.
+ * @param[in] fmt Error string.
+ * @param[in] ... Arguments for the error string.
+ *
+ * @hidecallergraph
+ */
+static inline CC_HINT(nonnull) CC_HINT(format (printf, 3, 4))
+void fr_strerror_marker_printf_push_head(char const *subject, size_t offset, char const *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ fr_strerror_marker_vprintf_push_head(subject, offset, fmt, ap);
+ va_end(ap);
+}
/** @} */
/** @name Add a const error string to the thread local error stack