diff options
Diffstat (limited to 'include/m_string.h')
-rw-r--r-- | include/m_string.h | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/include/m_string.h b/include/m_string.h index c02ce92cd88..e009447c192 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -34,25 +34,12 @@ /* need by my_vsnprintf */ #include <stdarg.h> -/* Correct some things for UNIXWARE7 */ -#ifdef HAVE_UNIXWARE7_THREADS -#undef HAVE_STRINGS_H -#undef HAVE_MEMORY_H -#define HAVE_MEMCPY -#ifndef HAVE_MEMMOVE -#define HAVE_MEMMOVE -#endif -#undef HAVE_BCMP -#undef bcopy -#undef bcmp -#undef bzero -#endif /* HAVE_UNIXWARE7_THREADS */ #ifdef _AIX #undef HAVE_BCMP #endif /* This is needed for the definitions of bzero... on solaris */ -#if defined(HAVE_STRINGS_H) && !defined(HAVE_mit_thread) +#if defined(HAVE_STRINGS_H) #include <strings.h> #endif @@ -84,7 +71,7 @@ # define bmove_align(A,B,C) memcpy((A),(B),(C)) #endif -#if defined(__cplusplus) && !defined(OS2) +#if defined(__cplusplus) extern "C" { #endif @@ -95,7 +82,7 @@ extern "C" { extern void *(*my_str_malloc)(size_t); extern void (*my_str_free)(void *); -#if defined(HAVE_STPCPY) && !defined(HAVE_mit_thread) +#if defined(HAVE_STPCPY) #define strmov(A,B) stpcpy((A),(B)) #ifndef stpcpy extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */ @@ -119,12 +106,6 @@ extern char NEAR _dig_vec_lower[]; #define memcpy_fixed(A,B,C) memcpy((A),(B),(C)) #endif -#ifdef MSDOS -#undef bmove_align -#define bmove512(A,B,C) bmove_align(A,B,C) -extern void bmove_align(gptr dst,const gptr src,uint len); -#endif - #if (!defined(USE_BMOVE512) || defined(HAVE_purify)) && !defined(bmove512) #define bmove512(A,B,C) memcpy(A,B,C) #endif @@ -243,7 +224,7 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error); #ifdef HAVE_LONG_LONG extern char *longlong2str(longlong val,char *dst,int radix); extern char *longlong10_to_str(longlong val,char *dst,int radix); -#if (!defined(HAVE_STRTOULL) || defined(HAVE_mit_thread)) || defined(NO_STRTOLL_PROTO) +#if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) extern longlong strtoll(const char *str, char **ptr, int base); extern ulonglong strtoull(const char *str, char **ptr, int base); #endif @@ -256,7 +237,25 @@ extern int my_vsnprintf( char *str, size_t n, const char *format, va_list ap ); extern int my_snprintf(char* to, size_t n, const char* fmt, ...); -#if defined(__cplusplus) && !defined(OS2) +#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_LEN(X) ((char *) (X)), ((uint) (sizeof(X) - 1)) + #endif |