[augeas-devel] augeas: master - * src/transform.c (add_file_info): change what we store about a file

David Lutterkort lutter at fedoraproject.org
Tue Aug 11 00:58:36 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=38281e4be29e02fb109a32723cc7a7d102560ff9
Commit:        38281e4be29e02fb109a32723cc7a7d102560ff9
Parent:        d190f9c913cb028e6482c10090020318d5a9fe7d
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Thu Aug 6 18:35:21 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Aug 6 18:35:21 2009 -0700

* src/transform.c (add_file_info): change what we store about a file

For a file FILE, we now only record the path and the info for the lens;
instead of

  /augeas/files/FILE/path      = /files/FILE
  /augeas/files/FILE/lens/info = ...
  /augeas/files/FILE/lens/id = 0x...

we only record

  /augeas/files/FILE/path  = /files/FILE
  /augeas/files/FILE/lens  = ...

The id wasn't useful to anybody, and the lens info is useful for debugging
at best
---
 src/transform.c   |   17 +----------------
 tests/xpath.tests |    4 +---
 2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/transform.c b/src/transform.c
index 10cd645..4d382b2 100644
--- a/src/transform.c
+++ b/src/transform.c
@@ -60,8 +60,6 @@ static const int glob_flags = GLOB_NOSORT;
  */
 static const char *const s_path = "path";
 static const char *const s_lens = "lens";
-static const char *const s_info = "info";
-static const char *const s_id   = "id";
 
 static const char *const s_error = "error";
 /* These are all put underneath "error" */
@@ -338,7 +336,7 @@ static int add_file_info(struct augeas *aug,
         goto done;
     p[end] = '\0';
 
-    r = pathjoin(&p, 2, s_lens, s_info);
+    r = pathjoin(&p, 1, s_lens);
     if (r < 0)
         goto done;
 
@@ -349,19 +347,6 @@ static int add_file_info(struct augeas *aug,
     FREE(tmp);
     if (r < 0)
         goto done;
-    p[end] = '\0';
-
-    r = pathjoin(&p, 2, s_lens, s_id);
-    if (r < 0)
-        goto done;
-
-    r = asprintf(&tmp, "%p", lens);
-    if (r >= 0) {
-        r = aug_set(aug, p, tmp);
-        FREE(tmp);
-        if (r < 0)
-            goto done;
-    }
 
     result = 0;
  done:
diff --git a/tests/xpath.tests b/tests/xpath.tests
index df31bff..ac93b91 100644
--- a/tests/xpath.tests
+++ b/tests/xpath.tests
@@ -148,9 +148,7 @@ test ipaddr-sibling //*[../ipaddr]
 
 test lircd-ancestor //*[ancestor::kudzu][label() != '#comment']
      /augeas/files/etc/sysconfig/kudzu/path = /files/etc/sysconfig/kudzu
-     /augeas/files/etc/sysconfig/kudzu/lens
-     /augeas/files/etc/sysconfig/kudzu/lens/info = ...
-     /augeas/files/etc/sysconfig/kudzu/lens/id = ...
+     /augeas/files/etc/sysconfig/kudzu/lens = ...
      /files/etc/sysconfig/kudzu/SAFE = no
 
 test wildcard-last /files/etc/hosts/*[position() = last()]




More information about the augeas-devel mailing list