Re: [PATCH v2 04/10] trace-cmd library: New API for setting a custom kallsyms to an output handler

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

 



On Thu, 11 Nov 2021 17:06:58 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> +int tracecmd_output_set_kallsyms(struct tracecmd_output *handler, const char *kallsyms)
> +{
> +	if (!handler || handler->file_state != TRACECMD_FILE_ALLOCATED)
> +		return -1;
> +
> +	free(handler->kallsyms);

Nit, this isn't a fast path, so the code could be a little cleaner with:

	handler->kallsyms = NULL;

here

> +	if (kallsyms) {
> +		handler->kallsyms = strdup(kallsyms);
> +		if (!handler->kallsyms)
> +			return -1;
> +	} else
> +		handler->kallsyms = NULL;

Then removing the else case.

-- Steve

> +
> +	return 0;
> +}
> +



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux