aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2014-03-10 04:11:14 -0400
committerMike Frysinger <vapier@gentoo.org>2014-03-10 04:11:14 -0400
commitbc7d4c9bf7245e9a97f504fd229f2b850358749b (patch)
tree510f81fb6c35204a41d7638afbadf23be22c2369 /qfile.c
parenteat_file: convert API to work on dynamic buffers (diff)
downloadportage-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 'qfile.c')
-rw-r--r--qfile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/qfile.c b/qfile.c
index 7094034..a32e512 100644
--- a/qfile.c
+++ b/qfile.c
@@ -114,7 +114,7 @@ _q_static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
}
if (state->exclude_slot == NULL)
goto qlist_done; /* "(CAT/)?(PN|PF)" matches, and no SLOT specified */
- eat_file_at(pkg_ctx->fd, "SLOT", &state->buf, &state->buflen);
+ q_vdb_pkg_eat(pkg_ctx, "SLOT", &state->buf, &state->buflen);
rmspace(state->buf);
if (strcmp(state->exclude_slot, state->buf) == 0)
goto qlist_done; /* "(CAT/)?(PN|PF):SLOT" matches */
@@ -218,7 +218,7 @@ _q_static int qfile_cb(q_vdb_pkg_ctx *pkg_ctx, void *priv)
/* XXX: This assumes the buf is big enough. */
char *slot_hack = slot + 1;
size_t slot_len = sizeof(slot) - 1;
- eat_file_at(pkg_ctx->fd, "SLOT", &slot_hack, &slot_len);
+ q_vdb_pkg_eat(pkg_ctx, "SLOT", &slot_hack, &slot_len);
rmspace(slot_hack);
slot[0] = ':';
} else