diff options
Diffstat (limited to 'm_option.h')
-rw-r--r-- | m_option.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/m_option.h b/m_option.h index 75f9ee5925..acbbb3fd9f 100644 --- a/m_option.h +++ b/m_option.h @@ -209,6 +209,11 @@ struct m_option_type { */ char *(*print)(const m_option_t *opt, const void *val); + // Print the value in a human readable form. Unlike print(), it doesn't + // necessarily return the exact value, and is generally not parseable with + // parse(). + char *(*pretty_print)(const m_option_t *opt, const void *val); + // Copy data between two locations. Deep copy if the data has pointers. /** \param opt The option to copy. * \param dst Pointer to the destination memory. @@ -413,6 +418,15 @@ static inline char *m_option_print(const m_option_t *opt, const void *val_ptr) return NULL; } +static inline char *m_option_pretty_print(const m_option_t *opt, + const void *val_ptr) +{ + if (opt->type->pretty_print) + return opt->type->pretty_print(opt, val_ptr); + else + return m_option_print(opt, val_ptr); +} + // Helper around \ref m_option_type::copy. static inline void m_option_copy(const m_option_t *opt, void *dst, const void *src) |