lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 30 Jan 2015 12:14:53 +0200
From:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:	Jeff Epler <jepler@...ythonic.net>
Cc:	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Mathias Krause <minipli@...glemail.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] lib/string_helpers.c: Refactor string_escape_mem

On Thu, 2015-01-29 at 13:33 -0600, Jeff Epler wrote:
> [discussing the repeated three-line idiom]
> > if (out < end)
> >  *out = '\\';
> > ++out;
> 
> Instead of open-coding this each time, perhaps it would be appropriate
> to define a macro to possibly put a character and also advance the
> pointer.
> 
> Assuming that the locals are consistently "out" and "end", something
> like

Why not inline function?

> 
>     #define addch(c) do { \
>             if(out < end) *out = c; \
>             ++out; \
>     } while(0)
> 
> modulo any errors or differences with standard kernel coding style.

What about vsprintf.c ? 

-- 
Andy Shevchenko <andriy.shevchenko@...el.com>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ