[augeas-devel] [PATCH 4/4] Use pathx_aug_parse rather than pathx_parse in various places
lutter at redhat.com
lutter at redhat.com
Thu Aug 5 20:58:28 UTC 2010
From: David Lutterkort <lutter at redhat.com>
Since pathx_aug_parse makes sure the symbol table stays updated, use
pathx_aug_parse whereever that makes sense.
---
src/augeas.c | 11 +++++------
src/transform.c | 8 +++-----
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/augeas.c b/src/augeas.c
index 8937eee..d10966d 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -126,7 +126,7 @@ struct tree *tree_find(struct augeas *aug, const char *path) {
struct tree *result = NULL;
int r;
- pathx_parse(aug->origin, aug->error, path, true, aug->symtab, &p);
+ p = pathx_aug_parse(aug, aug->origin, path, true);
ERR_BAIL(aug);
r = pathx_find_one(p, &result);
@@ -146,7 +146,7 @@ struct tree *tree_find_cr(struct augeas *aug, const char *path) {
struct tree *result = NULL;
int r;
- pathx_parse(aug->origin, aug->error, path, true, aug->symtab, &p);
+ p = pathx_aug_parse(aug, aug->origin, path, true);
ERR_BAIL(aug);
r = pathx_expand_tree(p, &result);
@@ -706,7 +706,6 @@ int aug_set(struct augeas *aug, const char *path, const char *value) {
int aug_setm(struct augeas *aug, const char *base,
const char *sub, const char *value) {
struct pathx *bx = NULL, *sx = NULL;
- struct error *err = err_of_aug(aug);
struct tree *bt, *st;
int result, r;
@@ -722,7 +721,7 @@ int aug_setm(struct augeas *aug, const char *base,
for (bt = pathx_first(bx); bt != NULL; bt = pathx_next(bx)) {
if (sub != NULL) {
/* Handle subnodes of BT */
- pathx_parse(bt, err, sub, true, aug->symtab, &sx);
+ sx = pathx_aug_parse(aug, bt, sub, true);
ERR_BAIL(aug);
if (pathx_first(sx) != NULL) {
/* Change existing subnodes matching SUB */
@@ -1153,8 +1152,8 @@ static int unlink_removed_files(struct augeas *aug,
if (tf == NULL) {
/* Unlink all files in tm */
struct pathx *px = NULL;
- if (pathx_parse(tm, err_of_aug(aug), file_nodes, true, NULL, &px)
- != PATHX_NOERROR) {
+ if (pathx_parse(tm, err_of_aug(aug), file_nodes, true,
+ aug->symtab, &px) != PATHX_NOERROR) {
result = -1;
continue;
}
diff --git a/src/transform.c b/src/transform.c
index fa082c3..f655715 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -817,11 +817,9 @@ static int file_saved_event(struct augeas *aug, const char *path) {
struct tree *dummy;
int r;
- r = pathx_parse(aug->origin, err_of_aug(aug),
- AUGEAS_EVENTS_SAVED "[last()]",
- true, NULL, &px);
- if (r != PATHX_NOERROR)
- return -1;
+ px = pathx_aug_parse(aug, aug->origin, AUGEAS_EVENTS_SAVED "[last()]",
+ true);
+ ERR_BAIL(aug);
if (pathx_find_one(px, &dummy) == 1) {
r = tree_insert(px, saved, 0);
--
1.7.2
More information about the augeas-devel
mailing list