feat(dev): expansion
This commit is contained in:
parent
609c1667af
commit
4fc43e4678
8 changed files with 36 additions and 32 deletions
|
|
@ -12,12 +12,7 @@
|
|||
|
||||
#define VARS_INITIAL_SIZE 16
|
||||
|
||||
struct hash_map *vars_init(void)
|
||||
{
|
||||
return hash_map_init(VARS_INITIAL_SIZE);
|
||||
}
|
||||
|
||||
void vars_default(struct hash_map *vars)
|
||||
static void vars_default(struct hash_map *vars)
|
||||
{
|
||||
set_var_copy(vars, "?", "0");
|
||||
pid_t pid = getpid();
|
||||
|
|
@ -26,6 +21,14 @@ void vars_default(struct hash_map *vars)
|
|||
set_var_copy(vars, "$", pid_str);
|
||||
}
|
||||
|
||||
struct hash_map *vars_init(void)
|
||||
{
|
||||
struct hash_map *vars = hash_map_init(VARS_INITIAL_SIZE);
|
||||
if (vars != NULL)
|
||||
vars_default(vars);
|
||||
return vars;
|
||||
}
|
||||
|
||||
short short_random(void)
|
||||
{
|
||||
static bool seeded = false;
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@
|
|||
*/
|
||||
struct hash_map *vars_init(void);
|
||||
|
||||
/**
|
||||
* Set default variables.
|
||||
*/
|
||||
void vars_default(struct hash_map *vars);
|
||||
|
||||
/**
|
||||
* Generate a random short integer (16 bits positive [0-32767]).
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue