lkml.org 
[lkml]   [2014]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/6] staging: rtl8192e: re-use string_escape_mem()
Date
Let's use kernel's library function to escape a buffer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/staging/rtl8192e/rtllib.h | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 83f5f57..cb99160 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -31,6 +31,7 @@
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/semaphore.h>
+#include <linux/string_helpers.h>

#include <linux/delay.h>
#include <linux/wireless.h>
@@ -2956,7 +2957,6 @@ extern inline int rtllib_get_scans(struct rtllib_device *ieee)
static inline const char *escape_essid(const char *essid, u8 essid_len)
{
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
- const char *s = essid;
char *d = escaped;

if (rtllib_is_empty_essid(essid, essid_len)) {
@@ -2965,15 +2965,8 @@ static inline const char *escape_essid(const char *essid, u8 essid_len)
}

essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
- while (essid_len--) {
- if (*s == '\0') {
- *d++ = '\\';
- *d++ = '0';
- s++;
- } else {
- *d++ = *s++;
- }
- }
+ d += string_escape_mem(essid, essid_len, escaped, sizeof(escaped) - 1,
+ ESCAPE_NULL, NULL);
*d = '\0';
return escaped;
}
--
2.0.0


\
 
 \ /
  Last update: 2014-07-02 16:01    [W:0.108 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site