add assignment operator and unify memory pools
The unification of memory pools also fixed some memory leaks and hopefully reduced the mallocs of identifier strings significantly by giving them the same pool as the token stream.
This commit is contained in:
7
tok.h
7
tok.h
@@ -4,6 +4,8 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
typedef struct Type {
|
||||
enum {
|
||||
TypeVoid = 0,
|
||||
@@ -87,10 +89,7 @@ typedef struct TokListItem {
|
||||
|
||||
typedef struct TokList {
|
||||
TokListItem *begin, *end;
|
||||
TokListItem *mempools[32]; /* few mallocs, no copying => much speed */
|
||||
size_t mempool_sizes[32];
|
||||
size_t curr_mempool_cap;
|
||||
size_t curr_mempool;
|
||||
Pool *p;
|
||||
} TokList;
|
||||
|
||||
void toklist_init(TokList *l);
|
||||
|
||||
Reference in New Issue
Block a user