summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_c/token.h
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/parse/parse_c/token.h')
-rw-r--r--bitbake/lib/bb/parse/parse_c/token.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/bitbake/lib/bb/parse/parse_c/token.h b/bitbake/lib/bb/parse/parse_c/token.h
index 2351fda6b5..c6242015b7 100644
--- a/bitbake/lib/bb/parse/parse_c/token.h
+++ b/bitbake/lib/bb/parse/parse_c/token.h
@@ -24,13 +24,24 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24#ifndef TOKEN_H 24#ifndef TOKEN_H
25#define TOKEN_H 25#define TOKEN_H
26 26
27#include <ctype.h>
28#include <string.h>
29
27#define PURE_METHOD 30#define PURE_METHOD
28 31
32
33/**
34 * Special Value for End Of File Handling. We set it to
35 * 1001 so we can have up to 1000 Terminal Symbols on
36 * grammar. Currenlty we have around 20
37 */
38#define T_EOF 1001
39
29struct token_t { 40struct token_t {
30 const char* string()const PURE_METHOD; 41 const char* string()const PURE_METHOD;
31 42
32 static char* concatString(const char* l, const char* r); 43 static char* concatString(const char* l, const char* r);
33 void assignString(const char* str); 44 void assignString(char* str);
34 void copyString(const char* str); 45 void copyString(const char* str);
35 46
36 void release_this(); 47 void release_this();
@@ -51,15 +62,17 @@ inline const char* token_t::string()const
51inline char* token_t::concatString(const char* l, const char* r) 62inline char* token_t::concatString(const char* l, const char* r)
52{ 63{
53 size_t cb = (l ? strlen (l) : 0) + strlen (r) + 1; 64 size_t cb = (l ? strlen (l) : 0) + strlen (r) + 1;
54 r_sz = new char[cb]; 65 char *r_sz = new char[cb];
55 *r_sz = 0; 66 *r_sz = 0;
56 if (l) strcat (r_sz, l); 67
68 if (l)
69 strcat (r_sz, l);
57 strcat (r_sz, r); 70 strcat (r_sz, r);
58 71
59 return r_sz; 72 return r_sz;
60} 73}
61 74
62inline void token_t::assignString(const char* str) 75inline void token_t::assignString(char* str)
63{ 76{
64 m_string = str; 77 m_string = str;
65 m_stringLen = str ? strlen(str) : 0; 78 m_stringLen = str ? strlen(str) : 0;
@@ -70,7 +83,7 @@ inline void token_t::copyString(const char* str)
70 if( str ) { 83 if( str ) {
71 m_stringLen = strlen(str); 84 m_stringLen = strlen(str);
72 m_string = new char[m_stringLen+1]; 85 m_string = new char[m_stringLen+1];
73 strcpy(m_string, str) 86 strcpy(m_string, str);
74 } 87 }
75} 88}
76 89