[前][次][番号順一覧][スレッド一覧]

ruby-changes:48230

From: nobu <ko1@a...>
Date: Sun, 22 Oct 2017 13:06:29 +0900 (JST)
Subject: [ruby-changes:48230] nobu:r60345 (trunk): dir.c: adjust indent [ci skip]

nobu	2017-10-22 13:06:23 +0900 (Sun, 22 Oct 2017)

  New Revision: 60345

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60345

  Log:
    dir.c: adjust indent [ci skip]

  Modified files:
    trunk/dir.c
Index: dir.c
===================================================================
--- dir.c	(revision 60344)
+++ dir.c	(revision 60345)
@@ -355,55 +355,56 @@ fnmatch_helper( https://github.com/ruby/ruby/blob/trunk/dir.c#L355
 	    goto failed;
 	  }
 
-	  case '{': if (flags & FNM_EXTGLOB) {
-			size_t len = pend - p;
-			char *buf = FNMATCH_ALLOC_N(char, len);
-			const char *rbrace = NULL;
-			while (p < pend) {
-			    const char *t = ++p;
-			    int nest = 0;
-			    while (p < pend && !(*p == ',' && nest == 0)) {
-				if (*p == '{') nest++;
-				if (*p == '}') {
-				    if (nest == 0) {
-					if (!rbrace) rbrace = p;
-					goto rest;
-				    }
-				    nest--;
-				}
-				if (*p == '\\' && escape) {
-				    if (++p >= pend) break;
-				}
-				Inc(p, pend, enc);
+	  case '{':
+	    if (flags & FNM_EXTGLOB) {
+		size_t len = pend - p;
+		char *buf = FNMATCH_ALLOC_N(char, len);
+		const char *rbrace = NULL;
+		while (p < pend) {
+		    const char *t = ++p;
+		    int nest = 0;
+		    while (p < pend && !(*p == ',' && nest == 0)) {
+			if (*p == '{') nest++;
+			if (*p == '}') {
+			    if (nest == 0) {
+				if (!rbrace) rbrace = p;
+				goto rest;
 			    }
-			    if (!rbrace) {
-				rbrace = p;
-				while (rbrace < pend && !(*rbrace == '}' && nest == 0)) {
-				    if (*rbrace == '{') nest++;
-				    if (*rbrace == '}') nest--;
-				    if (*rbrace == '\\' && escape) {
-					if (++p >= pend) break;
-				    }
-				    Inc(rbrace, pend, enc);
-				}
-			    }
-rest:
-			    memcpy(buf, t, p-t);
-			    buf[p-t]=0;
-			    strlcpy(buf+(p-t), rbrace+1, len-(p-t));
-			    {
-				const char *pp = buf, *ss = s;
-				r = fnmatch_helper((const char **)&pp, &ss, flags|FNM_DOTMATCH, enc);
-			    }
-			    if (r == 0) {
-				p = buf;
-				FNMATCH_FREE(buf);
-				RETURN(0);
+			    nest--;
+			}
+			if (*p == '\\' && escape) {
+			    if (++p >= pend) break;
+			}
+			Inc(p, pend, enc);
+		    }
+		    if (!rbrace) {
+			rbrace = p;
+			while (rbrace < pend && !(*rbrace == '}' && nest == 0)) {
+			    if (*rbrace == '{') nest++;
+			    if (*rbrace == '}') nest--;
+			    if (*rbrace == '\\' && escape) {
+				if (++p >= pend) break;
 			    }
-			    if (p >= rbrace) break;
+			    Inc(rbrace, pend, enc);
 			}
+		    }
+		  rest:
+		    memcpy(buf, t, p-t);
+		    buf[p-t]=0;
+		    strlcpy(buf+(p-t), rbrace+1, len-(p-t));
+		    {
+			const char *pp = buf, *ss = s;
+			r = fnmatch_helper((const char **)&pp, &ss, flags|FNM_DOTMATCH, enc);
+		    }
+		    if (r == 0) {
+			p = buf;
 			FNMATCH_FREE(buf);
+			RETURN(0);
 		    }
+		    if (p >= rbrace) break;
+		}
+		FNMATCH_FREE(buf);
+	    }
 	}
 
 	/* ordinary */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]