Remove excess functions
This commit is contained in:
parent
51a06fdd2c
commit
c31808e8c4
@ -16,9 +16,7 @@ DECL char * raw(char const * const sql);
|
||||
DECL char * remind(char * who);
|
||||
DECL char * slurp(char const * fn);
|
||||
DECL int is_admin(char const * user);
|
||||
DECL int parse_admin_list(char const * admin_list_file);
|
||||
DECL int parse_pair(char const * buf, size_t const len);
|
||||
DECL void clean_admin_list();
|
||||
DECL void creds_free_password(void);
|
||||
DECL void creds_free_rest(void);
|
||||
DECL void parse_command(char const * const cmd);
|
||||
|
44
src/parse.c
44
src/parse.c
@ -204,50 +204,6 @@ parse_pair(char const * buf, size_t len)
|
||||
}
|
||||
|
||||
DECL int
|
||||
parse_admin_list(char const * admin_list_path)
|
||||
{
|
||||
#define ADMIN_LIST_INIT_SIZE 8
|
||||
/* prealloc with 8 */
|
||||
size_t current_array_size = ADMIN_LIST_INIT_SIZE;
|
||||
|
||||
FILE * stream;
|
||||
size_t lines_read = 0;
|
||||
char * line = NULL;
|
||||
size_t nread = 0;
|
||||
|
||||
stream = fopen(admin_list_path, "r");
|
||||
if (stream == NULL)
|
||||
{
|
||||
/* Pretty valid case I guess? No admin file = no admins,
|
||||
maybe all configuration is performed locally */
|
||||
return 0;
|
||||
}
|
||||
|
||||
admins = calloc(ADMIN_LIST_INIT_SIZE, sizeof(char *));
|
||||
|
||||
while (getline(&line, &nread, stream) > 0)
|
||||
{
|
||||
if (++lines_read > current_array_size)
|
||||
{
|
||||
/* double the space */
|
||||
current_array_size *= 2;
|
||||
realloc(admins, current_array_size);
|
||||
}
|
||||
|
||||
admins[lines_read - 1] = line;
|
||||
}
|
||||
|
||||
/* set up array end marker for proper clean-up later */
|
||||
if (lines_read + 1 > current_array_size)
|
||||
{
|
||||
realloc(admins, current_array_size + 1);
|
||||
}
|
||||
admins[lines_read] = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECL int
|
||||
is_admin(char const * user)
|
||||
{
|
||||
/* No Gods or Kings, Only Man */
|
||||
|
Reference in New Issue
Block a user