summaryrefslogtreecommitdiff
path: root/src/history.h
blob: 199e028efe8e9e95a4f7d387aaa94388ef1a6e77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef HISTORY_H
#define HISTORY_H

#include <stdbool.h>
#include <stddef.h>

struct program {
	char *restrict name;
	size_t run_count;
};

struct history {
	size_t count;
	size_t size;
	struct program *buf;
};

[[gnu::nonnull]]
void history_destroy(struct history *restrict vec);

[[gnu::nonnull]]
void history_add(struct history *restrict vec, const char *restrict str);

//[[gnu::nonnull]]
//void history_remove(struct history *restrict vec, const char *restrict str);

[[nodiscard("memory leaked")]]
struct history history_load(bool drun);

void history_save(struct history *history, bool drun);

#endif /* HISTORY_H */