mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/1] sunrpc/cache: simplify qword_add
@ 2015-03-06 15:18 Andy Shevchenko
  0 siblings, 0 replies; only message in thread
From: Andy Shevchenko @ 2015-03-06 15:18 UTC (permalink / raw)
  To: Rasmus Villemoes, Andrew Morton, linux-kernel; +Cc: Andy Shevchenko

The commit 7572d3b29896 (lib/string_helpers.c: change semantics of
string_escape_mem) updates qword_add() to follow the changes in
lib/string_helpers.c. This patch simplifies the approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Andrew, I think this one can be folded in the mentioned commit by Rasmus.
Changelog v2:
- add missed curly braces (grr... I have them in initial comment)

 net/sunrpc/cache.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 22c4418..ba815df 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1068,16 +1068,16 @@ void qword_add(char **bpp, int *lp, char *str)
 {
 	char *bp = *bpp;
 	int len = *lp;
-	int ret, written;
+	int ret;
 
 	if (len < 0) return;
 
 	ret = string_escape_str(str, bp, len, ESCAPE_OCTAL, "\\ \n\t");
-	written = min(ret, len);
-	bp += written;
-	if (ret >= len)
+	if (ret >= len) {
+		bp += len;
 		len = -1;
-	else {
+	} else {
+		bp += ret;
 		len -= ret;
 		*bp++ = ' ';
 		len--;
-- 
2.1.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-06 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-06 15:18 [PATCH v2 1/1] sunrpc/cache: simplify qword_add Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome