]> git.baikalelectronics.ru Git - kernel.git/commit
lib/string_helpers.c: refactor string_escape_mem
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Wed, 15 Apr 2015 23:17:25 +0000 (16:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 Apr 2015 23:35:23 +0000 (16:35 -0700)
commitf1a4a83da2e9f224121a660c103868a97ed83a13
tree7f00129aa094227adc55ee92cc585f039a747fe5
parentba4fae0ae5966d3e8598139864d6bc4de4633c46
lib/string_helpers.c: refactor string_escape_mem

When printf is given the format specifier %pE, it needs a way of obtaining
the total output size that would be generated if the buffer was large
enough, and string_escape_mem doesn't easily provide that.  This is a
refactorization of string_escape_mem in preparation of changing its
external API to provide that information.

The somewhat ugly early returns and subsequent seemingly redundant
conditionals are to make the following patch touch as little as possible
in string_helpers.c while still preserving the current behaviour of never
outputting partial escape sequences.  That behaviour must also change for
%pE to work as one expects from every other printf specifier.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/string_helpers.c