<commit_before>#ifndef _LOGIN_H
#define _LOGIN_H
#include <stdio.h>
#include <regex.h>
#include <string.h>

#include <SDL2/SDL_net.h>
#include <curl/curl.h>

#include "cearth_defines.h"
#include "cearth_network.h"
#include "cearth_config.h"

typedef struct
{
        int n;
        char *name[LOGINDB_MAX];
        char *cookie[LOGINDB_MAX];
        char *token[LOGINDB_MAX];
} cearth_logindb;

/* Logs into havenandhearth.com and gets a session cookie */
void loginhttp_getcookie(const char *user);
/* gets /autohaven and gets a token in hexadecimal */
void loginhttp_gettoken(const char *user, const char *cookie);

int logindb_useradd(cearth_logindb *, char *user);
int logindb_userdel(cearth_logindb *, char *user);
/*
 * Checks if a user exists in the logindb
 * Returns 0 if the user does not exists;
 * Returns 1 if the user exists but has no cookie.
 * Returns 2 if the user exists and has a cookie.
 */
int logindb_usercheck(cearth_logindb *, char *user);
int logindb_cookieget(cearth_logindb *, char *user);
int logindb_cookieset(cearth_logindb *, char *user, char *cookie);
int logindb_cookiedel(cearth_logindb *, char *user);

/*
 * Opens LOGINDB_FILE and loads it into the appropriate struct.
 * @returns pointer to loaded logindb.
 */
cearth_logindb *logindb_open(cearth_logindb *);
/*
 * Saves updated logindb to LOGINDB_FILE and frees memory.
 * This must be called when cearth is done with logindb.
 */
void logindb_close(cearth_logindb *);
#endif<commit_msg>Change some function names to improved form<commit_after>#ifndef _LOGIN_H
#define _LOGIN_H
#include <stdio.h>
#include <regex.h>
#include <string.h>

#include <SDL2/SDL_net.h>
#include <curl/curl.h>

#include "cearth_defines.h"
#include "cearth_network.h"
#include "cearth_config.h"

typedef struct
{
        int n;
        char *name[LOGINDB_MAX];
        char *cookie[LOGINDB_MAX];
        char *token[LOGINDB_MAX];
} cearth_logindb;

/* Logs into havenandhearth.com and gets a session cookie */
void loginhttp_cookieget(const char *user);
/* gets /autohaven and gets a token in hexadecimal */
void loginhttp_tokenget(const char *user, const char *cookie);

int logindb_useradd(cearth_logindb *, char *user);
int logindb_userdel(cearth_logindb *, char *user);
/*
 * Checks if a user exists in the logindb
 * Returns 0 if the user does not exists;
 * Returns 1 if the user exists but has no cookie.
 * Returns 2 if the user exists and has a cookie.
 */
int logindb_usercheck(cearth_logindb *, char *user);
int logindb_cookieget(cearth_logindb *, char *user);
int logindb_cookieset(cearth_logindb *, char *user, char *cookie);
int logindb_cookiedel(cearth_logindb *, char *user);
/*
 * Requires user to have an assigned cookie or it will return NULL.
 * Retrieves hexadecimal cookie using logindb_tokenget
 * and returns a pointer to it.
 */
char * logindb_tokenget(cearth_logindb *, char *user);

/*
 * Opens LOGINDB_FILE and loads it into the appropriate struct.
 * @returns pointer to loaded logindb.
 */
cearth_logindb *logindb_open(cearth_logindb *);
/*
 * Saves updated logindb to LOGINDB_FILE and frees memory.
 * This must be called when cearth is done with logindb.
 */
void logindb_close(cearth_logindb *);
#endif
{'fraction_non_alphanumeric': 0.09940606439512348, 'fraction_numerical': 0.0025007814942169426, 'mean_word_length': 4.604203152364273, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4358003', 'n_tokens_mistral': 1142, 'n_tokens_neox': 1113, 'n_words': 346}