Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cache the default dict path

  • Loading branch information...
commit f901b8c2a54d65b9a9dbd73f6d5478cd71e6d9d3 1 parent 93dc44c
@msantos authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 c_src/cerck.c
View
5 c_src/cerck.c
@@ -36,6 +36,7 @@
static ERL_NIF_TERM atom_ok;
static ERL_NIF_TERM atom_error;
static ERL_NIF_TERM atom_enomem;
+static ERL_NIF_TERM string_dictpath;
static ERL_NIF_TERM error_tuple(ErlNifEnv *env, char *err);
@@ -47,6 +48,8 @@ load(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info)
atom_error = enif_make_atom(env, "error");
atom_enomem = enif_make_atom(env, "enomem");
+ string_dictpath = enif_make_string(env, GetDefaultCracklibDict(), ERL_NIF_LATIN1);
+
return (0);
}
@@ -87,7 +90,7 @@ nif_check(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM
nif_dictpath(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
- return enif_make_string(env, GetDefaultCracklibDict(), ERL_NIF_LATIN1);
+ return string_dictpath;
}
static ERL_NIF_TERM
Please sign in to comment.
Something went wrong with that request. Please try again.