fix weird interference with polls

This commit is contained in:
biglyderv 2025-04-14 20:36:53 -04:00
parent 881d3602e7
commit be291628b8
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
2 changed files with 9 additions and 2 deletions

View file

@ -1,4 +1,5 @@
#include "map.h" #include "map.h"
#include <time.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -177,6 +178,8 @@ int suggest_command(char *command, char *command_re, hashmap *polls, hashmap *co
char *val = calloc(MAX_BUF_LENGTH, sizeof(char)); char *val = calloc(MAX_BUF_LENGTH, sizeof(char));
sprintf(val, "%s;%s", page, command_re); sprintf(val, "%s;%s", page, command_re);
srand(time(NULL));
char *key = calloc(MAX_BUF_LENGTH, sizeof(char)); char *key = calloc(MAX_BUF_LENGTH, sizeof(char));
sprintf(key, "%s_%i", name, (int)rand()); sprintf(key, "%s_%i", name, (int)rand());

View file

@ -1,5 +1,6 @@
#include "command.h" #include "command.h"
#include "loader.h" #include "loader.h"
#include "map.h"
#include <ctype.h> #include <ctype.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
@ -87,8 +88,11 @@ int main(int argc, char *argv[]) {
was_combination = 0; was_combination = 0;
if (help_command(command)) if (help_command(command))
continue; continue;
if (polls_command(command, polls, elements)) if (polls_command(command, polls, elements)) {
continue; hashmap_free(polls);
polls = hashmap_create();
init_tables(elements, inv, polls, elements_rev, 0);
}
if (slash_command(command, inv)) if (slash_command(command, inv))
continue; continue;