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.
#ifndef TOKEN_H
#define TOKEN_H
+#include <ctype.h>
+#include <string.h>
+
#define PURE_METHOD
+
+/**
+ * Special Value for End Of File Handling. We set it to
+ * 1001 so we can have up to 1000 Terminal Symbols on
+ * grammar. Currenlty we have around 20
+ */
+#define T_EOF 1001
+
struct token_t {
const char* string()const PURE_METHOD;
static char* concatString(const char* l, const char* r);
- void assignString(const char* str);
+ void assignString(char* str);
void copyString(const char* str);
void release_this();
@@ -51,15 +62,17 @@ inline const char* token_t::string()const
inline char* token_t::concatString(const char* l, const char* r)
{
size_t cb = (l ? strlen (l) : 0) + strlen (r) + 1;
- r_sz = new char[cb];
+ char *r_sz = new char[cb];
*r_sz = 0;
- if (l) strcat (r_sz, l);
+
+ if (l)
+ strcat (r_sz, l);
strcat (r_sz, r);
return r_sz;
}
-inline void token_t::assignString(const char* str)
+inline void token_t::assignString(char* str)
{
m_string = str;
m_stringLen = str ? strlen(str) : 0;
@@ -70,7 +83,7 @@ inline void token_t::copyString(const char* str)
if( str ) {
m_stringLen = strlen(str);
m_string = new char[m_stringLen+1];
- strcpy(m_string, str)
+ strcpy(m_string, str);
}
}