Skip to content

Commit c56bd96

Browse files
committed
ESP32/NVS: fix typos and other smaller issues
Signed-off-by: Davide Bettio <[email protected]>
1 parent aa58d2c commit c56bd96

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

libs/eavmlib/src/esp.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ nvs_get_binary(Key) when is_atom(Key) ->
177177
%%-----------------------------------------------------------------------------
178178
-spec nvs_get_binary(Namespace :: atom(), Key :: atom()) -> binary() | undefined.
179179
nvs_get_binary(Namespace, Key) when is_atom(Namespace) andalso is_atom(Key) ->
180-
case nvs_fetch_binary(Namespace, Key) of
180+
case esp:nvs_fetch_binary(Namespace, Key) of
181181
{ok, Result} -> Result;
182-
{errror, not_found} -> undefined;
182+
{error, not_found} -> undefined;
183183
{error, OtherError} -> throw(OtherError)
184184
end.
185185

src/platforms/esp32/components/avm_builtins/nvs_nif.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static const struct Nif *nvs_nif_get_nif(const char *nifname);
4343

4444
static int write_atom_c_string(Context *ctx, char *buf, size_t bufsize, term t);
4545

46-
static term nif_esp_nvs_get_binary(Context *ctx, int argc, term argv[])
46+
static term nif_esp_nvs_fetch_binary(Context *ctx, int argc, term argv[])
4747
{
4848
UNUSED(argc);
4949
VALIDATE_VALUE(argv[0], term_is_atom);
@@ -70,7 +70,7 @@ static term nif_esp_nvs_get_binary(Context *ctx, int argc, term argv[])
7070
}
7171
term error_tuple = term_alloc_tuple(2, &ctx->heap);
7272
term ns_not_found = globalcontext_make_atom(ctx->global, ATOM_STR("\x13", "namespace_not_found"));
73-
term_put_tuple_element(error_tuple, 0, OK_ATOM);
73+
term_put_tuple_element(error_tuple, 0, ERROR_ATOM);
7474
term_put_tuple_element(error_tuple, 1, ns_not_found);
7575
return error_tuple;
7676
}
@@ -91,7 +91,7 @@ static term nif_esp_nvs_get_binary(Context *ctx, int argc, term argv[])
9191
}
9292
term error_tuple = term_alloc_tuple(2, &ctx->heap);
9393
term not_found = globalcontext_make_atom(ctx->global, ATOM_STR("\x9", "not_found"));
94-
term_put_tuple_element(error_tuple, 0, OK_ATOM);
94+
term_put_tuple_element(error_tuple, 0, ERROR_ATOM);
9595
term_put_tuple_element(error_tuple, 1, not_found);
9696
return error_tuple;
9797
}
@@ -256,9 +256,9 @@ static term nif_esp_nvs_reformat(Context *ctx, int argc, term argv[])
256256
}
257257
}
258258

259-
static const struct Nif esp_nvs_get_binary_nif = {
259+
static const struct Nif esp_nvs_fetch_binary_nif = {
260260
.base.type = NIFFunctionType,
261-
.nif_ptr = nif_esp_nvs_get_binary
261+
.nif_ptr = nif_esp_nvs_fetch_binary
262262
};
263263
static const struct Nif esp_nvs_put_binary_nif = {
264264
.base.type = NIFFunctionType,
@@ -290,9 +290,9 @@ void nvs_nif_init(GlobalContext *gloabl)
290290

291291
const struct Nif *nvs_nif_get_nif(const char *nifname)
292292
{
293-
if (strcmp("esp:nvs_get_binary/2", nifname) == 0) {
293+
if (strcmp("esp:nvs_fetch_binary/2", nifname) == 0) {
294294
TRACE("Resolved platform nif %s ...\n", nifname);
295-
return &esp_nvs_get_binary_nif;
295+
return &esp_nvs_fetch_binary_nif;
296296
}
297297
if (strcmp("esp:nvs_put_binary/3", nifname) == 0) {
298298
TRACE("Resolved platform nif %s ...\n", nifname);

0 commit comments

Comments
 (0)