[augeas-devel] augeas: master - * src/transform.c (add_file_info): minor cleanup
David Lutterkort
lutter at fedoraproject.org
Tue Aug 11 00:58:34 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=d190f9c913cb028e6482c10090020318d5a9fe7d
Commit: d190f9c913cb028e6482c10090020318d5a9fe7d
Parent: a7ee31686ec24ef53eb85722c016a8c8902875be
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Thu Aug 6 18:25:08 2009 -0700
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Aug 6 18:25:08 2009 -0700
* src/transform.c (add_file_info): minor cleanup
- Rename add_load_info to add_file_info
- Eliminate filename argument, since it's redundant
---
src/transform.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/transform.c b/src/transform.c
index fe4a511..10cd645 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -308,7 +308,15 @@ static int store_error(struct augeas *aug,
return result;
}
-static int add_load_info(struct augeas *aug, const char *filename,
+/* Set up the file information in the /augeas tree.
+ *
+ * NODE must be the path to the file contents, and start with /files.
+ * LENS is the lens used to transform the file.
+ * Create entries under /augeas/NODE with some metadata about the file.
+ *
+ * Returns 0 on success, -1 on error
+ */
+static int add_file_info(struct augeas *aug,
const char *node, struct lens *lens) {
char *tmp = NULL;
int r;
@@ -316,7 +324,7 @@ static int add_load_info(struct augeas *aug, const char *filename,
int end = 0;
int result = -1;
- r = pathjoin(&p, 2, AUGEAS_META_FILES, filename + strlen(aug->root) - 1);
+ r = pathjoin(&p, 2, AUGEAS_META_TREE, node);
if (r < 0)
goto done;
end = strlen(p);
@@ -385,7 +393,7 @@ static int load_file(struct augeas *aug, struct lens *lens, char *filename) {
pathjoin(&path, 2, AUGEAS_FILES_TREE, filename + strlen(aug->root) - 1);
- r = add_load_info(aug, filename, path, lens);
+ r = add_file_info(aug, path, lens);
if (r < 0)
goto done;
More information about the augeas-devel
mailing list