* src/dutil.h: remove aug_submatch
* src/dutil.c: remove aug_submatch
* src/drv_initscripts.c: use aug_fmt_match instead of aug_submatch
---
src/drv_initscripts.c | 7 ++++---
src/dutil.c | 19 -------------------
src/dutil.h | 4 ----
3 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/src/drv_initscripts.c b/src/drv_initscripts.c
index df26b12..d4e2259 100644
--- a/src/drv_initscripts.c
+++ b/src/drv_initscripts.c
@@ -118,7 +118,7 @@ static int defnode(struct netcf *ncf, const char *name, const char
*value,
static int is_slave(struct netcf *ncf, const char *intf) {
for (int s = 0; s < ARRAY_CARDINALITY(subif_paths); s++) {
int r;
- r = aug_submatch(ncf, intf, subif_paths[s], NULL);
+ r = aug_fmt_match(ncf, NULL, "%s/%s", intf, subif_paths[s]);
if (r != 0)
return r;
}
@@ -331,7 +331,8 @@ static int list_interface_ids(struct netcf *ncf,
maxnames = nint; /* if not returning list, ignore maxnames too */
}
for (result = 0; (result < nint) && (nqualified < maxnames); result++)
{
- nmatches = aug_submatch(ncf, intf[result], id_attr, &matches);
+ nmatches = aug_fmt_match(ncf, &matches,
+ "%s/%s", intf[result], id_attr);
if (nmatches > 0) {
const char *name;
int is_qualified = ((flags & (NETCF_IFACE_ACTIVE|NETCF_IFACE_INACTIVE))
@@ -446,7 +447,7 @@ static xmlDocPtr aug_get_xml(struct netcf *ncf, int nint, char **intf)
{
for (int i=0; i < nint; i++) {
tree = xmlNewChild(root, NULL, BAD_CAST "tree", NULL);
xmlNewProp(tree, BAD_CAST "path", BAD_CAST intf[i]);
- nmatches = aug_submatch(ncf, intf[i], "*", &matches);
+ nmatches = aug_fmt_match(ncf, &matches, "%s/%s", intf[i],
"*");
ERR_COND_BAIL(nint < 0, ncf, EOTHER);
for (int j = 0; j < nmatches; j++) {
xmlNodePtr node = xmlNewChild(tree, NULL, BAD_CAST "node", NULL);
diff --git a/src/dutil.c b/src/dutil.c
index 7f20995..bb03f39 100644
--- a/src/dutil.c
+++ b/src/dutil.c
@@ -125,25 +125,6 @@ struct augeas *get_augeas(struct netcf *ncf) {
return NULL;
}
-int aug_submatch(struct netcf *ncf, const char *p1,
- const char *p2, char ***matches) {
- struct augeas *aug = get_augeas(ncf);
- char *path = NULL;
- int r;
-
- r = xasprintf(&path, "%s/%s", p1, p2);
- ERR_COND_BAIL(r < 0, ncf, EOTHER);
-
- r = aug_match(aug, path, matches);
- ERR_COND_BAIL(r < 0, ncf, EOTHER);
-
- free(path);
- return r;
- error:
- free(path);
- return -1;
-}
-
int aug_fmt_match(struct netcf *ncf, char ***matches, const char *fmt, ...) {
struct augeas *aug = NULL;
char *path = NULL;
diff --git a/src/dutil.h b/src/dutil.h
index 34a90dc..b22c512 100644
--- a/src/dutil.h
+++ b/src/dutil.h
@@ -48,10 +48,6 @@ int xasprintf(char **strp, const char *format, ...);
/* Get or create the augeas instance from NCF */
struct augeas *get_augeas(struct netcf *ncf);
-/* Like aug_match, but match P1/P2 */
-int aug_submatch(struct netcf *ncf, const char *p1,
- const char *p2, char ***matches);
-
/* Format a path by doing a printf of FMT and the var args, then call
AUG_MATCH on that path. Sets NCF->ERRCODE on error */
ATTRIBUTE_FORMAT(printf, 3, 4)
--
1.6.0.6