bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep/2.5.1 portability issue


From: David Kaelbling
Subject: grep/2.5.1 portability issue
Date: Sun, 23 Mar 2003 23:29:52 -0500

Building grep/2.5.1 for SGI IRIX 6.5, the native compilers had a small
problem with some code in rfa.c that used non-constant values in array
initializers.  Attached is a patch that placated the compiler.

        Thanks,
        David

-- 
David KAELBLING <address@hidden>            Silicon Graphics Computer Systems
1 Cabot Rd, suite 250; Hudson, MA 01749       978.562.8857, fax .7450
--- ./src/dfa.c Wed Sep 26 12:57:55 2001
+++ ../grep-2.5.1/./src/dfa.c   Sun Mar 23 23:15:30 2003
@@ -1052,12 +1052,15 @@
                          setbit_case_fold (c, ccl);
                      } else {
                        /* POSIX locales are painful - leave the decision to 
libc */
-                       char expr[6] = { '[', c, '-', c2, ']', '\0' };
+                       char expr[6] = { '[', 0 /* c */, '-', 0 /* c2 */, ']', 
'\0' };
                        regex_t re;
+                       expr[1] = c;
+                       expr[3] = c2;
                        if (regcomp (&re, expr, case_fold ? REG_ICASE : 0) == 
REG_NOERROR) {
                          for (c = 0; c < NOTCHAR; ++c) {
-                           char buf[2] = { c, '\0' };
+                           char buf[2] = { 0 /* c */, '\0' };
                            regmatch_t mat;
+                           buf[0] = c;
                            if (regexec (&re, buf, 1, &mat, 0) == REG_NOERROR
                                && mat.rm_so == 0 && mat.rm_eo == 1)
                               setbit_case_fold (c, ccl);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]