Re: [PATCH v2 1/2] btrfs-progs: Introduce warning and error for common use

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

 



On Wed, Sep 16, 2015 at 05:40:46PM +0800, Zhao Lei wrote:
> +static inline void __veprintf(const char *prefix, const char *format,
> +			      va_list ap)
> +{
> +	if (prefix)
> +		fprintf(stderr, "%s", prefix);
> +	vfprintf(stderr, format, ap);

I'm not sure we need this helper. All it does it prints a fixed string,
we can simply add fputs("prefix", stderr) into warning/error functions.

> +static inline int warning_on(int condition, const char *fmt, ...)
> +{
> +	if (!condition)
> +		return 0;
> +
> +	va_list args;

Please do not put declaration(s) after statements.

> +static inline int error_on(int condition, const char *fmt, ...)
> +{
> +	if (!condition)
> +		return 0;
> +
> +	va_list args;

dtto

> +
> +	va_start(args, fmt);
> +	__veprintf("ERROR: ", fmt, args);
> +	va_end(args);
> +
> +	return 1;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux