{"thread":{"id":"2967","subject":"[PATCH] AIX compile fix for repo-config.c","startedAt":"2006-01-05T00:31:02Z","lastAt":"2006-01-05T00:31:02Z","messageCount":1,"participants":["Amos Waterland"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"14169","messageId":"20060105003102.GA21251@kvasir.watson.ibm.com","threadId":"2967","inReplyTo":null,"subject":"[PATCH] AIX compile fix for repo-config.c","fromName":"Amos Waterland","fromEmail":"apw@us.ibm.com","sentAt":"2006-01-05T00:31:02Z","receivedAt":"2006-01-05T00:31:02Z","isPatch":true,"sender":{"key":"apw@debian.org","avatar":null},"body":"AIX 5 has a /usr/include/regex.h containing this code:\n\n #ifdef  _NO_PROTO\n extern  char    *regex();\n extern  char    *regcmp();\n #else /* _NO_PROTO */\n extern  char    *regex(const char *, const char *, ...);\n extern  char    *regcmp(const char *, ...);\n #endif  /* _NO_PROTO */\n\nThis means that repo-config.c is trying to redefine the `regex' symbol.\nHere is a simple patch that just uses `regexp' as the symbol name instead.\n\nSigned-off-by: Amos Waterland <apw@us.ibm.com>\n\n--- repo-config.c.orig\tWed Jan  4 18:58:21 2006\n+++ repo-config.c\tWed Jan  4 18:59:15 2006\n@@ -6,7 +6,7 @@\n \n static char* key = NULL;\n static char* value = NULL;\n-static regex_t* regex = NULL;\n+static regex_t* regexp = NULL;\n static int do_all = 0;\n static int do_not_match = 0;\n static int seen = 0;\n@@ -14,9 +14,9 @@\n static int show_config(const char* key_, const char* value_)\n {\n \tif (!strcmp(key_, key) &&\n-\t\t\t(regex == NULL ||\n+\t\t\t(regexp == NULL ||\n \t\t\t (do_not_match ^\n-\t\t\t  !regexec(regex, value_, 0, NULL, 0)))) {\n+\t\t\t  !regexec(regexp, value_, 0, NULL, 0)))) {\n \t\tif (do_all) {\n \t\t\tprintf(\"%s\\n\", value_);\n \t\t\treturn 0;\n@@ -46,8 +46,8 @@\n \t\t\tregex_++;\n \t\t}\n \n-\t\tregex = (regex_t*)malloc(sizeof(regex_t));\n-\t\tif (regcomp(regex, regex_, REG_EXTENDED)) {\n+\t\tregexp = (regex_t*)malloc(sizeof(regex_t));\n+\t\tif (regcomp(regexp, regex_, REG_EXTENDED)) {\n \t\t\tfprintf(stderr, \"Invalid pattern: %s\\n\", regex_);\n \t\t\treturn -1;\n \t\t}\n@@ -59,9 +59,9 @@\n \t\tfree(value);\n \t}\n \tfree(key);\n-\tif (regex) {\n-\t\tregfree(regex);\n-\t\tfree(regex);\n+\tif (regexp) {\n+\t\tregfree(regexp);\n+\t\tfree(regexp);\n \t}\n \n \tif (do_all)\n"}]}