All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] Correct dir.c to compile on Solaris 9
Date: Sun, 15 Apr 2007 00:33:28 -0400	[thread overview]
Message-ID: <20070415043328.GA17285@spearce.org> (raw)

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

             reply	other threads:[~2007-04-15  4:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-15  4:33 Shawn O. Pearce [this message]
2007-04-15 16:25 ` [PATCH] Correct dir.c to compile on Solaris 9 Johannes Schindelin
2007-04-15 21:03   ` Josef Weidendorfer
2007-04-15 21:54     ` Robin Rosenberg
2007-04-15 22:48       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070415043328.GA17285@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.