[GRASS-SVN] r62482 - in grass/branches/releasebranch_7_0: . include/defs lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 29 07:51:09 PDT 2014
Author: hcho
Date: 2014-10-29 07:51:09 -0700 (Wed, 29 Oct 2014)
New Revision: 62482
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/include/defs/gis.h
grass/branches/releasebranch_7_0/lib/gis/ls_filter.c
Log:
G_ls_*_filter: Case-insensitive option (merge from trunk r62448)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Deleted: svn:mergeinfo
- /grass/trunk:61095,61098-61099,61788,61897,62141,62327,62346,62352,62354,62356,62360,62364,62415,62425,62438,62440,62462,62477,62479
Modified: grass/branches/releasebranch_7_0/include/defs/gis.h
===================================================================
--- grass/branches/releasebranch_7_0/include/defs/gis.h 2014-10-29 14:49:20 UTC (rev 62481)
+++ grass/branches/releasebranch_7_0/include/defs/gis.h 2014-10-29 14:51:09 UTC (rev 62482)
@@ -412,8 +412,8 @@
/* ls_filter.c */
#ifdef HAVE_REGEX_H
-void *G_ls_regex_filter(const char *, int, int);
-void *G_ls_glob_filter(const char *, int);
+void *G_ls_regex_filter(const char *, int, int, int);
+void *G_ls_glob_filter(const char *, int, int);
void G_free_ls_filter(void *);
#endif
Modified: grass/branches/releasebranch_7_0/lib/gis/ls_filter.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/ls_filter.c 2014-10-29 14:49:20 UTC (rev 62481)
+++ grass/branches/releasebranch_7_0/lib/gis/ls_filter.c 2014-10-29 14:51:09 UTC (rev 62482)
@@ -146,15 +146,17 @@
{
regex_t *regex = closure;
- return filename[0] != '.' &&
- regexec(regex, filename, 0, NULL, 0) == 0;
+ return filename[0] != '.' && regexec(regex, filename, 0, NULL, 0) == 0;
}
-void *G_ls_regex_filter(const char *pat, int exclude, int extended)
+void *G_ls_regex_filter(const char *pat, int exclude, int extended,
+ int ignorecase)
{
regex_t *regex = G_malloc(sizeof(regex_t));
- if (regcomp(regex, pat, (extended ? REG_EXTENDED : 0) | REG_NOSUB) != 0) {
+ if (regcomp(regex, pat, REG_NOSUB |
+ (extended ? REG_EXTENDED : 0) |
+ (ignorecase ? REG_ICASE : 0)) != 0) {
G_free(regex);
return NULL;
}
@@ -167,7 +169,7 @@
return regex;
}
-void *G_ls_glob_filter(const char *pat, int exclude)
+void *G_ls_glob_filter(const char *pat, int exclude, int ignorecase)
{
struct buffer buf;
regex_t *regex;
@@ -179,7 +181,7 @@
return NULL;
}
- regex = G_ls_regex_filter(buf.buf, exclude, 1);
+ regex = G_ls_regex_filter(buf.buf, exclude, 1, ignorecase);
fini(&buf);
More information about the grass-commit
mailing list