diff --git a/src/eval.c b/src/eval.c index 8e07b39..e76cfcb 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1240,7 +1240,7 @@ evaluate_dot(apfl_ctx ctx, struct apfl_expr_dot *dot) }; struct apfl_value out; - if (apfl_value_get_item(ctx->allocator, apfl_value_move(&lhs), apfl_value_move(&key), &out) != APFL_VALUE_GET_ITEM_OK) { + if (apfl_value_get_item(ctx->allocator, apfl_value_move(&lhs), apfl_value_move(&key), &out) != GET_ITEM_OK) { return APFL_RESULT_ERR; // TODO: Describe error } @@ -1260,7 +1260,7 @@ evaluate_at(apfl_ctx ctx, struct apfl_expr_at *at) struct apfl_value lhs = stack_must_pop(ctx, -1); struct apfl_value out; - if (apfl_value_get_item(ctx->allocator, apfl_value_move(&lhs), apfl_value_move(&rhs), &out) != APFL_VALUE_GET_ITEM_OK) { + if (apfl_value_get_item(ctx->allocator, apfl_value_move(&lhs), apfl_value_move(&rhs), &out) != GET_ITEM_OK) { return APFL_RESULT_ERR; // TODO: Describe error } diff --git a/src/value.c b/src/value.c index 81f16cc..880a183 100644 --- a/src/value.c +++ b/src/value.c @@ -589,12 +589,12 @@ apfl_dict_get_item(struct apfl_allocator allocator, apfl_dict dict, struct apfl_ return ok; } -static enum apfl_value_get_item_result +static enum get_item_result get_item(struct apfl_allocator allocator, /*borrowed*/ struct apfl_value container, /*borrowed*/ struct apfl_value key, struct apfl_value *out) { if (container.type == APFL_VALUE_LIST) { if (key.type != APFL_VALUE_NUMBER) { - return APFL_VALUE_GET_ITEM_WRONG_KEY_TYPE; + return GET_ITEM_WRONG_KEY_TYPE; } return apfl_list_get_item( @@ -603,8 +603,8 @@ get_item(struct apfl_allocator allocator, /*borrowed*/ struct apfl_value contain (size_t)key.number, out ) - ? APFL_VALUE_GET_ITEM_OK - : APFL_VALUE_GET_ITEM_KEY_DOESNT_EXIST; + ? GET_ITEM_OK + : GET_ITEM_KEY_DOESNT_EXIST; } else if (container.type == APFL_VALUE_DICT) { return apfl_dict_get_item( allocator, @@ -612,17 +612,17 @@ get_item(struct apfl_allocator allocator, /*borrowed*/ struct apfl_value contain apfl_value_incref(key), out ) - ? APFL_VALUE_GET_ITEM_OK - : APFL_VALUE_GET_ITEM_KEY_DOESNT_EXIST; + ? GET_ITEM_OK + : GET_ITEM_KEY_DOESNT_EXIST; } else { - return APFL_VALUE_GET_ITEM_NOT_A_CONTAINER; + return GET_ITEM_NOT_A_CONTAINER; } } -enum apfl_value_get_item_result +enum get_item_result apfl_value_get_item(struct apfl_allocator allocator, struct apfl_value container, struct apfl_value key, struct apfl_value *out) { - enum apfl_value_get_item_result result = get_item(allocator, container, key, out); + enum get_item_result result = get_item(allocator, container, key, out); apfl_value_deinit(allocator, &container); apfl_value_deinit(allocator, &key); return result; diff --git a/src/value.h b/src/value.h index c11ad5d..d86d44e 100644 --- a/src/value.h +++ b/src/value.h @@ -44,14 +44,14 @@ struct apfl_value apfl_value_incref(struct apfl_value); void apfl_value_print(struct apfl_value, FILE *); void apfl_value_deinit(struct apfl_allocator, struct apfl_value *); -enum apfl_value_get_item_result { - APFL_VALUE_GET_ITEM_OK, - APFL_VALUE_GET_ITEM_KEY_DOESNT_EXIST, - APFL_VALUE_GET_ITEM_NOT_A_CONTAINER, - APFL_VALUE_GET_ITEM_WRONG_KEY_TYPE, +enum get_item_result { + GET_ITEM_OK, + GET_ITEM_KEY_DOESNT_EXIST, + GET_ITEM_NOT_A_CONTAINER, + GET_ITEM_WRONG_KEY_TYPE, }; -enum apfl_value_get_item_result apfl_value_get_item(struct apfl_allocator allocator, struct apfl_value container, struct apfl_value key, struct apfl_value *out); +enum get_item_result apfl_value_get_item(struct apfl_allocator allocator, struct apfl_value container, struct apfl_value key, struct apfl_value *out); apfl_list apfl_list_incref(apfl_list); size_t apfl_list_len(apfl_list);