[netcf-devel] [PATCH 3/5] remove unnecessary calls to get_augeas()

Laine Stump laine at laine.org
Mon Mar 16 15:03:16 UTC 2015


There were several functions in drv_redhat.c that apparently had
previously required an augeas object, but no longer do (if the augeas
object was required, the return value of get_augeas() would have been
saved, and the side effect of rereading the augeas tree from disk
isn't needed as any subordinate function that required the augeas
object to be up-to-date would also need to call get_augeas() in order
to get its own pointer to the augeas object).

This has no functional effect, it's just removing redundant code.
---
 src/drv_redhat.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/drv_redhat.c b/src/drv_redhat.c
index 14ed787..fb7fca6 100644
--- a/src/drv_redhat.c
+++ b/src/drv_redhat.c
@@ -171,9 +171,6 @@ static char *find_ifcfg_path_by_device(struct netcf *ncf, const char *name) {
     int ndevs = 0;
     char **devs = NULL;
 
-    get_augeas(ncf);
-    ERR_BAIL(ncf);
-
     ndevs = aug_fmt_match(ncf, &devs, "%s[DEVICE = '%s']",
                           ifcfg_path, name);
     ERR_COND_BAIL(ndevs < 0, ncf, EOTHER);
@@ -314,9 +311,6 @@ static int list_ifcfg_paths(struct netcf *ncf, char ***intf) {
 static int list_interfaces(struct netcf *ncf, char ***intf) {
     int nint = 0, result = 0;
 
-    get_augeas(ncf);
-    ERR_BAIL(ncf);
-
     /* Look in augeas for all interfaces */
     nint = list_ifcfg_paths(ncf, intf);
     ERR_BAIL(ncf);
@@ -463,9 +457,6 @@ struct netcf_if *drv_lookup_by_name(struct netcf *ncf, const char *name) {
     char *pathx = NULL;
     char *name_dup = NULL;
 
-    get_augeas(ncf);
-    ERR_BAIL(ncf);
-
     pathx = find_ifcfg_path(ncf, name);
     ERR_BAIL(ncf);
 
@@ -934,9 +925,6 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
 
     MEMZERO(ifaces, maxifaces);
 
-    get_augeas(ncf);
-    ERR_BAIL(ncf);
-
     nmatches = aug_match_mac(ncf, mac, &matches);
     ERR_BAIL(ncf);
     if (nmatches == 0) {
-- 
2.1.0



More information about the netcf-devel mailing list