[augeas-devel] augeas: master - * src/pathx.c: remove the value() function, it's redundant with '.'

David Lutterkort lutter at fedoraproject.org
Fri Feb 6 21:56:31 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=cb9cca973bce12e2c04ac24849c3dc9ea5832aa6
Commit:        cb9cca973bce12e2c04ac24849c3dc9ea5832aa6
Parent:        5e08f2388aff2f6e5a1634f154a98b14f225d2c0
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Fri Feb 6 13:55:52 2009 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Feb 6 13:55:52 2009 -0800

* src/pathx.c: remove the value() function, it's redundant with '.'

---
 src/pathx.c       |   19 -------------------
 tests/xpath.tests |    4 ++--
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/src/pathx.c b/src/pathx.c
index 4ac0633..14f99e6 100644
--- a/src/pathx.c
+++ b/src/pathx.c
@@ -221,11 +221,8 @@ struct func {
 };
 
 static void func_last(struct state *state);
-static void func_value(struct state *state);
 
 static const struct func builtin_funcs[] = {
-    { .name = "value", .arity = 0, .type = T_STRING, .arg_types = NULL,
-      .impl = func_value },
     { .name = "last", .arity = 0, .type = T_NUMBER, .arg_types = NULL,
       .impl = func_last }
 };
@@ -434,22 +431,6 @@ static void func_last(struct state *state) {
     push_value(vind, state);
 }
 
-static void func_value(struct state *state) {
-    value_ind_t vind = make_value(T_STRING, state);
-    const char *s = state->step->cur->value;
-    char *v;
-
-    if (s == NULL) s = "";
-
-    v = strdup(s);
-    if (v == NULL) {
-        STATE_ENOMEM;
-        return;
-    }
-    state->value_pool[vind].string = v;
-    push_value(vind, state);
-}
-
 static int calc_eq_locpath_locpath(struct locpath *ns1, struct locpath *ns2,
                                    int neq, struct state *state) {
     for_each_node(t1, ns1, state) {
diff --git a/tests/xpath.tests b/tests/xpath.tests
index 7ab1f55..87cc835 100644
--- a/tests/xpath.tests
+++ b/tests/xpath.tests
@@ -21,7 +21,7 @@ test wildcard /files/etc/hosts/*/ipaddr
      /files/etc/hosts/2/ipaddr = 172.31.122.14
 
 # Compare the value of the current node with a constant
-test self-value /files/etc/hosts/*/ipaddr[ value() = '127.0.0.1' ]
+test self-value /files/etc/hosts/*/ipaddr[ . = '127.0.0.1' ]
      /files/etc/hosts/1/ipaddr = 127.0.0.1
 
 # Find nodes that have a child named 'ipaddr' with a fixed value
@@ -32,7 +32,7 @@ test child-value /files/etc/hosts/*[ipaddr = '127.0.0.1']
 test child-nil-value /files/etc/hosts/*[ipaddr = '']
 
 # Find nodes that have no value
-test self-nil-value /files/etc/hosts/*[value() = '']
+test self-nil-value /files/etc/hosts/*[. = '']
      /files/etc/hosts/1
      /files/etc/hosts/2
 




More information about the augeas-devel mailing list