Re: [PATCH v1 03/25] structured-logging: add structured logging framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +void slog_set_command_name(const char *command_name)
> +{
> +	/*
> +	 * Capture the command name even if logging is not enabled
> +	 * because we don't know if the config has been loaded yet by
> +	 * the cmd_<command>() and/or it may be too early to force a
> +	 * lazy load.
> +	 */
> +	if (my__command_name)
> +		free(my__command_name);
> +	my__command_name = xstrdup(command_name);
> +}
> +
> +void slog_set_sub_command_name(const char *sub_command_name)
> +{
> +	/*
> +	 * Capture the sub-command name even if logging is not enabled
> +	 * because we don't know if the config has been loaded yet by
> +	 * the cmd_<command>() and/or it may be too early to force a
> +	 * lazy load.
> +	 */
> +	if (my__sub_command_name)
> +		free(my__sub_command_name);

Please drop the condition in these two functions; free() handles NULL
arguments just fine.


(Sidenote: what's the deal with these 'my__' prefixes anyway?)




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux