From ff53e4e4778109389192494af3bb5dbfcdeb50f0 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 6 Oct 2020 13:01:16 -0400 Subject: exec: Adjust some calling conventions --- exec.c | 6 +++--- exec.h | 10 +++++----- parse.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/exec.c b/exec.c index 3c9c6a5..625cdd5 100644 --- a/exec.c +++ b/exec.c @@ -117,7 +117,7 @@ static size_t bfs_exec_arg_max(const struct bfs_exec *execbuf) { return arg_max; } -struct bfs_exec *parse_bfs_exec(char **argv, enum bfs_exec_flags flags, const struct bfs_ctx *ctx) { +struct bfs_exec *bfs_exec_parse(const struct bfs_ctx *ctx, char **argv, enum bfs_exec_flags flags) { struct bfs_exec *execbuf = malloc(sizeof(*execbuf)); if (!execbuf) { bfs_perror(ctx, "malloc()"); @@ -188,7 +188,7 @@ struct bfs_exec *parse_bfs_exec(char **argv, enum bfs_exec_flags flags, const st return execbuf; fail: - free_bfs_exec(execbuf); + bfs_exec_free(execbuf); return NULL; } @@ -613,7 +613,7 @@ int bfs_exec_finish(struct bfs_exec *execbuf) { return execbuf->ret; } -void free_bfs_exec(struct bfs_exec *execbuf) { +void bfs_exec_free(struct bfs_exec *execbuf) { if (execbuf) { bfs_exec_closewd(execbuf, NULL); free(execbuf->argv); diff --git a/exec.h b/exec.h index 2ff0c73..1ba409f 100644 --- a/exec.h +++ b/exec.h @@ -21,10 +21,10 @@ #ifndef BFS_EXEC_H #define BFS_EXEC_H -#include "bftw.h" -#include "color.h" +#include -struct ctx; +struct BFTW; +struct bfs_ctx; /** * Flags for the -exec actions. @@ -87,7 +87,7 @@ struct bfs_exec { * @return * The parsed exec action, or NULL on failure. */ -struct bfs_exec *parse_bfs_exec(char **argv, enum bfs_exec_flags flags, const struct bfs_ctx *ctx); +struct bfs_exec *bfs_exec_parse(const struct bfs_ctx *ctx, char **argv, enum bfs_exec_flags flags); /** * Execute the command for a file. @@ -114,6 +114,6 @@ int bfs_exec_finish(struct bfs_exec *execbuf); /** * Free a parsed exec action. */ -void free_bfs_exec(struct bfs_exec *execbuf); +void bfs_exec_free(struct bfs_exec *execbuf); #endif // BFS_EXEC_H diff --git a/parse.c b/parse.c index ef695de..7113a1f 100644 --- a/parse.c +++ b/parse.c @@ -111,7 +111,7 @@ void free_expr(struct expr *expr) { } bfs_printf_free(expr->printf); - free_bfs_exec(expr->execbuf); + bfs_exec_free(expr->execbuf); free_expr(expr->lhs); free_expr(expr->rhs); @@ -1103,14 +1103,14 @@ static struct expr *parse_empty(struct parser_state *state, int arg1, int arg2) * Parse -exec(dir)?/-ok(dir)?. */ static struct expr *parse_exec(struct parser_state *state, int flags, int arg2) { - struct bfs_exec *execbuf = parse_bfs_exec(state->argv, flags, state->ctx); + struct bfs_exec *execbuf = bfs_exec_parse(state->ctx, state->argv, flags); if (!execbuf) { return NULL; } struct expr *expr = parse_action(state, eval_exec, execbuf->tmpl_argc + 2); if (!expr) { - free_bfs_exec(execbuf); + bfs_exec_free(execbuf); return NULL; } -- cgit v1.2.3