On Wed, Sep 25, 2013 at 10:48:04PM -0500, guns wrote:
> I am unable to do any tests because the patches do not apply to my
> copy of the repository.
> 
whoops, sorry, i entirely forgot the "preparatory" patch.
>From e4ace86e387a9496d31c8f7fb628689eb3ecdcd9 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <[email protected]>
Date: Wed, 25 Sep 2013 18:53:18 +0200
Subject: [PATCH] make next_arg() more readable & efficient

---
 src/drv_imap.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index abfc760..798320d 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -458,33 +458,37 @@ imap_refcounted_done_box( imap_store_t *ctx ATTR_UNUSED, struct imap_cmd *cmd, i
 }
 
 static char *
-next_arg( char **s )
+next_arg( char **ps )
 {
-	char *ret;
+	char *ret, *s;
 
-	if (!s || !*s)
+	assert( ps );
+	s = *ps;
+	if (!s)
 		return 0;
-	while (isspace( (unsigned char) **s ))
-		(*s)++;
-	if (!**s) {
-		*s = 0;
+	while (isspace( (unsigned char)*s ))
+		s++;
+	if (!*s) {
+		*ps = 0;
 		return 0;
 	}
-	if (**s == '"') {
-		++*s;
-		ret = *s;
-		*s = strchr( *s, '"' );
+	if (*s == '"') {
+		++s;
+		ret = s;
+		s = strchr( s, '"' );
 	} else {
-		ret = *s;
-		while (**s && !isspace( (unsigned char) **s ))
-			(*s)++;
+		ret = s;
+		while (*s && !isspace( (unsigned char)*s ))
+			s++;
 	}
-	if (*s) {
-		if (**s)
-			*(*s)++ = 0;
-		if (!**s)
-			*s = 0;
+	if (s) {
+		if (*s)
+			*s++ = 0;
+		if (!*s)
+			s = 0;
 	}
+
+	*ps = s;
 	return ret;
 }
 
-- 
1.8.0.1.18.g93341d8

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to