git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Correct dir.c to compile on Solaris 9
@ 2007-04-15  4:33 Shawn O. Pearce
  2007-04-15 16:25 ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Shawn O. Pearce @ 2007-04-15  4:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The compiler on my Solaris 9 system doesn't understand
the array initialization syntax used here in dir.c.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 dir.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/dir.c b/dir.c
index 7426fde..038fd82 100644
--- a/dir.c
+++ b/dir.c
@@ -423,18 +423,17 @@ static int cmp_name(const void *p1, const void *p2)
  */
 static int simple_length(const char *match)
 {
-	const char special[256] = {
-		[0] = 1, ['?'] = 1,
-		['\\'] = 1, ['*'] = 1,
-		['['] = 1
-	};
 	int len = -1;
 
 	for (;;) {
 		unsigned char c = *match++;
 		len++;
-		if (special[c])
+		switch (c) {
+		case 0: case '?':
+		case '\\': case '*':
+		case '[':
 			return len;
+		}
 	}
 }
 
-- 
1.5.1.1.83.g2bfe3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-15 22:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-15  4:33 [PATCH] Correct dir.c to compile on Solaris 9 Shawn O. Pearce
2007-04-15 16:25 ` Johannes Schindelin
2007-04-15 21:03   ` Josef Weidendorfer
2007-04-15 21:54     ` Robin Rosenberg
2007-04-15 22:48       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).