#ifndef UTILS_H_
#define UTILS_H_

#include <stddef.h>
#include "types.h"

int regex_match(const char *, str_array_t, str_array_t *);

int substitute_str(const char *subject, const char *pattern,
                   const char *replacement, char **presult);

const char *mimeType2ext(const char *mimeType);

int repchr(char *str, char t, char r);

/* NOTICE: pass a pointer-to-pointer to free the original pointer. */
void free_and_nullify(void *p);

#endif