AIX compile fix for repo-config.c
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Amos Waterland committed
Jan 4, 2006 at 19:31 UTC
0a15217184f20649c0ab19b24363e35112a91beb
1 file changed
+8
-8
repo-config.c
+8
-8
@@ -6,7 +6,7 @@ static const char git_config_set_usage[] =
6
7
static char* key = NULL;
8
static char* value = NULL;
9
-static regex_t* regex = NULL;
9
+static regex_t* regexp = NULL;
10
static int do_all = 0;
11
static int do_not_match = 0;
12
static int seen = 0;
@@ -14,9 +14,9 @@ static int seen = 0;
14
static int show_config(const char* key_, const char* value_)
15
{
16
if (!strcmp(key_, key) &&
17
- (regex == NULL ||
17
+ (regexp == NULL ||
18
(do_not_match ^
19
- !regexec(regex, value_, 0, NULL, 0)))) {
19
+ !regexec(regexp, value_, 0, NULL, 0)))) {
20
if (do_all) {
21
printf("%s\n", value_);
22
return 0;
@@ -46,8 +46,8 @@ static int get_value(const char* key_, const char* regex_)
46
regex_++;
47
}
48
49
- regex = (regex_t*)malloc(sizeof(regex_t));
50
- if (regcomp(regex, regex_, REG_EXTENDED)) {
49
+ regexp = (regex_t*)malloc(sizeof(regex_t));
50
+ if (regcomp(regexp, regex_, REG_EXTENDED)) {
51
fprintf(stderr, "Invalid pattern: %s\n", regex_);
52
return -1;
53
}
@@ -59,9 +59,9 @@ static int get_value(const char* key_, const char* regex_)
59
free(value);
60
}
61
free(key);
62
- if (regex) {
63
- regfree(regex);
64
- free(regex);
62
+ if (regexp) {
63
+ regfree(regexp);
64
+ free(regexp);
65
}
66
67
if (do_all)