On 2023/04/12 16:37, Christian Weisgerber wrote:
> Stuart Henderson:
> 
> > Basically it seems that g_debug callers expect to be able to use NULL
> > srrings and it would be huge whack-a-mole to clean them up. I wonder
> > if it might be better to do something to catch these in g_debug() and
> > avoid passing the NULL to vfprintf.
> 
> How would you do this?  You would have to process the format string
> to see which arguments are pointers and then replace corresponding
> NULL arguments.  The glib code passes the variadic arguments straight
> through to v*printf().  Here's how that looks:
> 
> g_debug() macro expands to
> -> g_log() calls
>    -> g_logv() calls
>       -> g_strdup_vprintf() calls
>          -> vasprintf()
>          or
>       -> _g_vsnprintf() macro expands to
>          -> vsnprintf()
>    or
> -> g_log_structured() calls
>    -> g_strdup_vprintf() calls
>       -> vasprintf()
>       or
>    -> _g_vsnprintf() macro expands to
>       -> vsnprintf()

Perhaps by calling a different function instead of v*printf that does
most of the same things except not syslogging for null %s prints..

Reply via email to