lib / string_helpers: introduce string_escape_mem()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 13 Oct 2014 22:55:16 +0000 (15:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:18:26 +0000 (02:18 +0200)
commitc8250381c8272a9828fdd353171727b154fbd296
tree050650d45d87d430334939f0552deafbe36561f9
parent45ff337a54c154680edf0c538e5c9eb4a2f862cc
lib / string_helpers: introduce string_escape_mem()

This is almost the opposite function to string_unescape().  Nevertheless
it handles \0 and could be used for any byte buffer.

The documentation is supplied together with the function prototype.

The test cases covers most of the scenarios and would be expanded later
on.

[akpm@linux-foundation.org: avoid 1k stack consumption]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "John W . Linville" <linville@tuxdriver.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Joe Perches <joe@perches.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/string_helpers.h
lib/string_helpers.c
lib/test-string_helpers.c