git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amos Waterland <apw@us.ibm.com>
To: junkio@cox.net
Cc: git@vger.kernel.org
Subject: [PATCH] AIX compile fix for repo-config.c
Date: Wed, 4 Jan 2006 19:31:02 -0500	[thread overview]
Message-ID: <20060105003102.GA21251@kvasir.watson.ibm.com> (raw)

AIX 5 has a /usr/include/regex.h containing this code:

 #ifdef  _NO_PROTO
 extern  char    *regex();
 extern  char    *regcmp();
 #else /* _NO_PROTO */
 extern  char    *regex(const char *, const char *, ...);
 extern  char    *regcmp(const char *, ...);
 #endif  /* _NO_PROTO */

This means that repo-config.c is trying to redefine the `regex' symbol.
Here is a simple patch that just uses `regexp' as the symbol name instead.

Signed-off-by: Amos Waterland <apw@us.ibm.com>

--- repo-config.c.orig	Wed Jan  4 18:58:21 2006
+++ repo-config.c	Wed Jan  4 18:59:15 2006
@@ -6,7 +6,7 @@
 
 static char* key = NULL;
 static char* value = NULL;
-static regex_t* regex = NULL;
+static regex_t* regexp = NULL;
 static int do_all = 0;
 static int do_not_match = 0;
 static int seen = 0;
@@ -14,9 +14,9 @@
 static int show_config(const char* key_, const char* value_)
 {
 	if (!strcmp(key_, key) &&
-			(regex == NULL ||
+			(regexp == NULL ||
 			 (do_not_match ^
-			  !regexec(regex, value_, 0, NULL, 0)))) {
+			  !regexec(regexp, value_, 0, NULL, 0)))) {
 		if (do_all) {
 			printf("%s\n", value_);
 			return 0;
@@ -46,8 +46,8 @@
 			regex_++;
 		}
 
-		regex = (regex_t*)malloc(sizeof(regex_t));
-		if (regcomp(regex, regex_, REG_EXTENDED)) {
+		regexp = (regex_t*)malloc(sizeof(regex_t));
+		if (regcomp(regexp, regex_, REG_EXTENDED)) {
 			fprintf(stderr, "Invalid pattern: %s\n", regex_);
 			return -1;
 		}
@@ -59,9 +59,9 @@
 		free(value);
 	}
 	free(key);
-	if (regex) {
-		regfree(regex);
-		free(regex);
+	if (regexp) {
+		regfree(regexp);
+		free(regexp);
 	}
 
 	if (do_all)

                 reply	other threads:[~2006-01-05  0:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060105003102.GA21251@kvasir.watson.ibm.com \
    --to=apw@us.ibm.com \
    --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 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).