[augeas-devel] augeas: master - struct error: add pointer back to struct augeas

David Lutterkort lutter at fedoraproject.org
Fri Jan 15 01:31:15 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=919db52da611be583c0ab9371bbaae721268e4f6
Commit:        919db52da611be583c0ab9371bbaae721268e4f6
Parent:        b9cb63d3850d4cf67ee5419ee7cd39f549161f12
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Wed Nov 11 12:01:47 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Jan 14 14:48:38 2010 -0800

struct error: add pointer back to struct augeas

---
 src/augeas.c  |    2 ++
 src/errcode.h |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/augeas.c b/src/augeas.c
index a363f93..209f606 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -333,6 +333,8 @@ struct augeas *aug_init(const char *root, const char *loadpath,
         goto error;
     if (ALLOC(result->error) < 0)
         goto error;
+    result->error->aug = result;
+
     result->origin = make_tree_origin(tree_root);
     if (result->origin == NULL) {
         free_tree(tree_root);
diff --git a/src/errcode.h b/src/errcode.h
index 54dc330..a61fb51 100644
--- a/src/errcode.h
+++ b/src/errcode.h
@@ -35,6 +35,11 @@ struct error {
     int            minor;
     char          *details;       /* Human readable explanation */
     const char    *minor_details; /* Human readable version of MINOR */
+    /* Bit of a kludge to get at struct augeas, but since struct error
+     * is now available in a lot of places (through struct info), this
+     * gives a convenient way to get at the overall state
+     */
+    const struct augeas *aug;
 };
 
 void report_error(struct error *err, aug_errcode_t errcode,




More information about the augeas-devel mailing list