[augeas-devel] augeas: master - * src/lens.c (str_to_fa): compile nocase fa when needed
David Lutterkort
lutter at fedoraproject.org
Thu Jan 14 18:19:56 UTC 2010
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=3d90ee5021724dc4f56de17db81c7f709ec42eee
Commit: 3d90ee5021724dc4f56de17db81c7f709ec42eee
Parent: cca990f19d8455645cbe4fc5fcf7281dcb76344a
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Tue Jan 12 15:38:51 2010 -0800
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Jan 13 10:27:34 2010 -0800
* src/lens.c (str_to_fa): compile nocase fa when needed
---
src/lens.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/lens.c b/src/lens.c
index 6d23ade..cb770ba 100644
--- a/src/lens.c
+++ b/src/lens.c
@@ -70,7 +70,7 @@ char *format_lens(struct lens *l) {
* return an exception.
*/
static struct value *str_to_fa(struct info *info, const char *pattern,
- struct fa **fa) {
+ struct fa **fa, int nocase) {
int error;
struct value *exn = NULL;
size_t re_err_len;
@@ -78,8 +78,13 @@ static struct value *str_to_fa(struct info *info, const char *pattern,
*fa = NULL;
error = fa_compile(pattern, strlen(pattern), fa);
- if (error == REG_NOERROR)
+ if (error == REG_NOERROR) {
+ if (nocase) {
+ error = fa_nocase(*fa);
+ ERR_NOMEM(error < 0, info);
+ }
return NULL;
+ }
re_str = escape(pattern, -1);
ERR_NOMEM(re_str == NULL, info);
@@ -105,7 +110,7 @@ static struct value *str_to_fa(struct info *info, const char *pattern,
}
static struct value *regexp_to_fa(struct regexp *regexp, struct fa **fa) {
- return str_to_fa(regexp->info, regexp->pattern->str, fa);
+ return str_to_fa(regexp->info, regexp->pattern->str, fa, regexp->nocase);
}
static struct lens *make_lens(enum lens_tag tag, struct info *info) {
@@ -391,7 +396,7 @@ struct value *lns_make_prim(enum lens_tag tag, struct info *info,
/* Typecheck */
if (tag == L_KEY) {
- exn = str_to_fa(info, "(.|\n)*/(.|\n)*", &fa_slash);
+ exn = str_to_fa(info, "(.|\n)*/(.|\n)*", &fa_slash, regexp->nocase);
if (exn != NULL)
goto error;
More information about the augeas-devel
mailing list