[PATCH 1/4 v3] os/log: Pull LogMessageTypeVerbString out of LogVMessageVerb

Guillem Jover guillem at hadrons.org
Fri Aug 5 06:50:35 PDT 2011


Hi!

On Fri, 2011-08-05 at 15:09:58 +0800, Daniel Kurtz wrote:
> diff --git a/os/log.c b/os/log.c
> index f519762..56e5b80 100644
> --- a/os/log.c
> +++ b/os/log.c
> @@ -325,58 +328,64 @@ LogWrite(int verb, const char *f, ...)
>      va_end(args);
>  }
>  
> +/* Returns the Message Type string to prepend to a logging message, or NULL
> + * if the message will be dropped due to insufficient verbosity. */
> +static const char*

Ah forgot this last time, missing space before the ‘*’.

> +LogMessageTypeVerbString(MessageType type, int verb)
> +{
> +    if (type == X_ERROR)
> +	verb = 0;
> +
> +    if (logVerbosity < verb && logFileVerbosity < verb)
> +	return NULL;
> +
> +    switch (type) {
[...]
> +    case X_NONE:
> +	return X_NONE_STRING;
> +    }
> +    return X_UNKNOWN_STRING;

Small nit, but maybe turn this into the default switch case?

> +}
> +
>  void
>  LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
>  {
[...]
> +    /* if type_str is not "", prepend it, and ' ', to format */
> +    if (type_str[0] == '\0')
> +        new_format = format;
> +    else {
> +        new_format = tmpFormat;
> +        snprintf(tmpFormat, sizeof(tmpFormat), "%s %s", type_str, format);
>      }
> +
> +    LogVWrite(verb, tmpFormat, args);

This should be:

       LogVWrite(verb, new_format, args);
>  }

With at least the first and last comments fixed:

Reviewed-by: Guillem Jover <guillem at hadrons.org>

regards,
guillem


More information about the xorg-devel mailing list