optimize for filesize

This commit is contained in:
biglyderv 2025-03-27 07:34:20 -04:00
parent aab88a6c19
commit dffdf200cc
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
5 changed files with 15 additions and 16 deletions

View file

@ -2,4 +2,4 @@ CC?=gcc
BIN?=bin/elem
make: src/main.c
$(CC) -o $(BIN) src/map.c src/loader.c src/command.c src/main.c
$(CC) -ffunction-sections -fdata-sections -Wl,--gc-sections -Os -o $(BIN) src/map.c src/loader.c src/command.c src/main.c

View file

@ -4,12 +4,7 @@
#include <stdlib.h>
#include <string.h>
#define MAX_BUF_LENGTH 1024
#define MAX_COMBO_LENGTH 1024
#define poll_file "polls.txt"
#define polls_lock_file "polls_lock.txt"
#define combo_file "combos.txt"
#define UPVOTE_IN 2
#include "main.h"
struct pager {
int page;

View file

@ -4,7 +4,7 @@
#include <stdlib.h>
#include <string.h>
#define MAX_FILE_SIZE 1024 * 16
#include "main.h"
int load_elements(hashmap *m, char *table, int use_inv) {
FILE *fptr;

View file

@ -6,14 +6,7 @@
#include <stdlib.h>
#include <string.h>
#define inv_file "inv.txt"
#define inv_base_file "inv_base.txt"
#define combo_file "combos.txt"
#define poll_file "polls.txt"
#define polls_lock_file "polls_lock.txt"
#define MAX_BUF_LENGTH 1024
#define MAX_COMBO_LENGTH 1024
#include "main.h"
void init_tables(hashmap *elements, hashmap *inv, hashmap *polls, int do_inv) {
load_elements(elements, "../elem_data/" combo_file, 0);

11
src/main.h Normal file
View file

@ -0,0 +1,11 @@
#define inv_file "inv.txt"
#define inv_base_file "inv_base.txt"
#define combo_file "combos.txt"
#define poll_file "polls.txt"
#define polls_lock_file "polls_lock.txt"
#define MAX_BUF_LENGTH 1024
#define MAX_COMBO_LENGTH 1024
#define UPVOTE_IN 2
#define MAX_FILE_SIZE 1024 * 16
long stoi(const char *s);