feat: added randomly generated URLs
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Jef Roosens 2022-11-21 12:03:16 +01:00
parent 94f7400169
commit 51fc2867a8
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 190 additions and 87 deletions

View file

@ -10,6 +10,12 @@
#include <stdbool.h>
#include <stddef.h>
static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static const size_t charset_len = sizeof(charset) - 1;
// Length of randomly generated keys
#define RANDOM_KEY_LENGTH 4
/**
* Type definition for the struct representing the current Trie.
*
@ -51,6 +57,14 @@ char * ternarytrie_search(TernaryTrie* trie, const char* string);
*/
bool ternarytrie_add(TernaryTrie* trie, const char* string, const char *payload);
/**
* Add a payload by generating a random string as the key.
*
* @param trie
* @return the generated key
*/
char *ternarytrie_add_random(TernaryTrie *trie, const char *payload);
/**
* Remove a string from this trie.
*