use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE
[pspp] / lib / exclude.c
index a68f3cbef496e1311fe1050510ca2d8b1a0c5d18..fe74f361c6ca1431e5513802df79b53a71ac90d7 100644 (file)
@@ -1,7 +1,7 @@
 /* exclude.c -- exclude file names
 
-   Copyright (C) 1992, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1992-1994, 1997, 1999-2007, 2009-2011 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -60,6 +60,14 @@ verify (((EXCLUDE_ANCHORED | EXCLUDE_INCLUDE | EXCLUDE_WILDCARDS)
             | FNM_CASEFOLD | FNM_EXTMATCH))
         == 0);
 
+/* The attribute __pure__ was added in gcc 2.96.  */
+#undef _GL_ATTRIBUTE_PURE
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
 
 /* Exclusion patterns are grouped into a singly-linked list of
    "exclusion segments".  Each segment represents a set of patterns
@@ -111,7 +119,7 @@ struct exclude
   };
 
 /* Return true if str has wildcard characters */
-bool
+bool _GL_ATTRIBUTE_PURE
 fnmatch_pattern_has_wildcards (const char *str, int options)
 {
   const char *cset = "\\?*[]";
@@ -142,14 +150,14 @@ unescape_pattern (char *str)
   do
     {
       if (inset)
-       {
-         if (*q == ']')
-           inset = 0;
-       }
+        {
+          if (*q == ']')
+            inset = 0;
+        }
       else if (*q == '[')
-       inset = 1;
+        inset = 1;
       else if (*q == '\\')
-       q++;
+        q++;
     }
   while ((*str++ = *q++));
 }
@@ -501,7 +509,7 @@ add_exclude (struct exclude *ex, char const *pattern, int options)
 
       str = xstrdup (pattern);
       if (options & EXCLUDE_WILDCARDS)
-       unescape_pattern (str);
+        unescape_pattern (str);
       p = hash_insert (seg->v.table, str);
       if (p != str)
         free (str);