~emersion/mrsh

537899b8a63adf88d442790b4cf6a38edd9288d9 — Simon Ser 10 months ago 5f5e4c0
shell/arithm: strip mrsh_ prefix for static functions

The mrsh_ prefix is reserved for exported, public functions.
1 files changed, 6 insertions(+), 6 deletions(-)

M shell/arithm.c
M shell/arithm.c => shell/arithm.c +6 -6
@@ 1,7 1,7 @@
#include <assert.h>
#include <mrsh/shell.h>

static bool mrsh_run_arithm_binop(struct mrsh_state *state,
static bool run_arithm_binop(struct mrsh_state *state,
		struct mrsh_arithm_binop *binop, long *result) {
	long left, right;
	if (!mrsh_run_arithm_expr(state, binop->left, &left)) {


@@ 69,7 69,7 @@ static bool mrsh_run_arithm_binop(struct mrsh_state *state,
	assert(false); // Unknown binary arithmetic operation
}

static bool mrsh_run_arithm_unop(struct mrsh_state *state,
static bool run_arithm_unop(struct mrsh_state *state,
		struct mrsh_arithm_unop *unop, long *result) {
	long val;
	if (!mrsh_run_arithm_expr(state, unop->body, &val)) {


@@ 92,7 92,7 @@ static bool mrsh_run_arithm_unop(struct mrsh_state *state,
	assert(false); // Unknown unary arithmetic operation
}

static bool mrsh_run_arithm_cond(struct mrsh_state *state,
static bool run_arithm_cond(struct mrsh_state *state,
		struct mrsh_arithm_cond *cond, long *result) {
	long condition;
	if (!mrsh_run_arithm_expr(state, cond->condition, &condition)) {


@@ 121,15 121,15 @@ bool mrsh_run_arithm_expr(struct mrsh_state *state,
	case MRSH_ARITHM_BINOP:;
		struct mrsh_arithm_binop *binop =
			(struct mrsh_arithm_binop *)expr;
		return mrsh_run_arithm_binop(state, binop, result);
		return run_arithm_binop(state, binop, result);
	case MRSH_ARITHM_UNOP:;
		struct mrsh_arithm_unop *unop =
			(struct mrsh_arithm_unop *)expr;
		return mrsh_run_arithm_unop(state, unop, result);
		return run_arithm_unop(state, unop, result);
	case MRSH_ARITHM_COND:;
		struct mrsh_arithm_cond *cond =
			(struct mrsh_arithm_cond *)expr;
		return mrsh_run_arithm_cond(state, cond, result);
		return run_arithm_cond(state, cond, result);
	default:
		// TODO
		*result = 42;