diff options
author | Mike Frysinger <vapier@gentoo.org> | 2014-03-10 04:11:14 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2014-03-10 04:11:14 -0400 |
commit | bc7d4c9bf7245e9a97f504fd229f2b850358749b (patch) | |
tree | 510f81fb6c35204a41d7638afbadf23be22c2369 /qdepends.c | |
parent | eat_file: convert API to work on dynamic buffers (diff) | |
download | portage-utils-bc7d4c9bf7245e9a97f504fd229f2b850358749b.tar.gz portage-utils-bc7d4c9bf7245e9a97f504fd229f2b850358749b.tar.bz2 portage-utils-bc7d4c9bf7245e9a97f504fd229f2b850358749b.zip |
vdb: add a q_vdb_pkg_eat helper to unify various call styles
Now that the core eat func is based on dynamic bufs, it's a lot easier
to create a core vdb helper for eating pkg files.
This has the added advantage of making the pkg dir open a delayed call.
We only opendir when we actually want to read files out of it. For many
funcs which don't do that, it saves a lot of syscall overhead.
Diffstat (limited to 'qdepends.c')
-rw-r--r-- | qdepends.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -413,7 +413,7 @@ _q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) IF_DEBUG(warn("matched %s/%s", catname, pkgname)); - if (!eat_file_at(pkg_ctx->fd, state->depend_file, &depend, &depend_len)) + if (!q_vdb_pkg_eat(pkg_ctx, state->depend_file, &depend, &depend_len)) return 0; IF_DEBUG(warn("growing tree...")); @@ -434,7 +434,7 @@ _q_static int qdepends_main_vdb_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) printf("%s%s/%s%s%s: ", BOLD, catname, BLUE, pkgname, NORM); } - if (!eat_file_at(pkg_ctx->fd, "USE", &use, &use_len)) { + if (!q_vdb_pkg_eat(pkg_ctx, "USE", &use, &use_len)) { warn("Could not eat_file(%s), you'll prob have incorrect output", buf); } else { for (ptr = use; *ptr; ++ptr) @@ -473,7 +473,7 @@ _q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) IF_DEBUG(warn("matched %s/%s for %s", catname, pkgname, state->depend_file)); - if (!eat_file_at(pkg_ctx->fd, state->depend_file, &depend, &depend_len)) + if (!q_vdb_pkg_eat(pkg_ctx, state->depend_file, &depend, &depend_len)) return 0; IF_DEBUG(warn("growing tree...")); @@ -483,7 +483,7 @@ _q_static int qdepends_vdb_deep_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv) IF_DEBUG(puts(depend)); IF_DEBUG(dep_dump_tree(dep_tree)); - if (eat_file_at(pkg_ctx->fd, "USE", &use, &use_len)) + if (q_vdb_pkg_eat(pkg_ctx, "USE", &use, &use_len)) use[0] = ' '; for (ptr = use; *ptr; ++ptr) |