projects
/
cparser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d7384b0
)
do not fail when initializing tokens multiple times
author
Matthias Braun
<matze@braunis.de>
Wed, 28 Nov 2012 14:33:53 +0000
(15:33 +0100)
committer
Matthias Braun
<matze@braunis.de>
Wed, 28 Nov 2012 14:33:53 +0000
(15:33 +0100)
token.c
patch
|
blob
|
history
diff --git
a/token.c
b/token.c
index
50de656
..
60adc9d
100644
(file)
--- a/
token.c
+++ b/
token.c
@@
-24,6
+24,7
@@
#include <assert.h>
#include <stdio.h>
+#include <stdbool.h>
#include "symbol.h"
#include "lang_features.h"
@@
-67,6
+68,11
@@
static void register_pp_token(pp_token_kind_t const id, char const *const string
void init_tokens(void)
{
+ static bool tokens_initialized = false;
+ if (tokens_initialized)
+ return;
+ tokens_initialized = true;
+
memset(token_symbols, 0, T_LAST_TOKEN * sizeof(token_symbols[0]));
#define T(mode,x,str,val) register_token(mode, x, str);