diff options
Diffstat (limited to 'include/m_string.h')
-rw-r--r-- | include/m_string.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/m_string.h b/include/m_string.h index e73f5c11487..f57b3eff8a0 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -246,4 +246,22 @@ extern int my_snprintf(char* to, size_t n, const char* fmt, ...); #if defined(__cplusplus) } #endif + +/* + LEX_STRING -- a pair of a C-string and its length. + + NOTE: this exactly form of declaration is required for some C-compilers + (for one, Sun C 5.7 2005/01/07). Unfortunatelt with such declaration + LEX_STRING can not be forward declared. +*/ + +typedef struct +{ + char *str; + uint length; +} LEX_STRING; + +#define STRING_WITH_LEN(X) (X), ((uint) (sizeof(X) - 1)) +#define C_STRING_WITH_SIZE(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) + #endif |