Commit 0670fc93 authored by unknown's avatar unknown

Added a compile fix for AIX to include/my_sys.h

Corrected some comments that were using C++-style instead of C-style 


include/my_sys.h:
  Portability fix: define alloca as a compiler builtin on systems that have
  gcc but no alloca.h (e.g. some IBM AIX flavors), use "#pragma alloca" for
  IBMs compiler (xlc)
mysys/my_getopt.c:
  Replace C++-style comments with C-style comments
strings/ctype-latin1_de.c:
  Replace C++-style comments with C-style comments
strings/ctype-tis620.c:
  Replace C++-style comments with C-style comments
parent ef8712b2
...@@ -159,6 +159,13 @@ extern my_string my_strdup(const char *from,myf MyFlags); ...@@ -159,6 +159,13 @@ extern my_string my_strdup(const char *from,myf MyFlags);
#define ORIG_CALLER_INFO /* nothing */ #define ORIG_CALLER_INFO /* nothing */
#endif #endif
#ifdef HAVE_ALLOCA #ifdef HAVE_ALLOCA
#ifdef __GNUC__
/* Remove any previous definitions. */
#undef alloca
#define alloca(size) __builtin_alloca (size)
#else /* xlc */
#pragma alloca
#endif /* GCC. */
#define my_alloca(SZ) alloca((size_t) (SZ)) #define my_alloca(SZ) alloca((size_t) (SZ))
#define my_afree(PTR) {} #define my_afree(PTR) {}
#else #else
......
...@@ -293,7 +293,7 @@ int handle_options(int *argc, char ***argv, ...@@ -293,7 +293,7 @@ int handle_options(int *argc, char ***argv,
*/ */
*((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1'); *((my_bool*) optp->value)= (my_bool) (!optend || *optend == '1');
(*argc)--; (*argc)--;
continue; // For GET_BOOL get_one_option() shouldn't be called continue; /* For GET_BOOL get_one_option() shouldn't be called */
} }
argument= optend; argument= optend;
} }
...@@ -341,16 +341,16 @@ int handle_options(int *argc, char ***argv, ...@@ -341,16 +341,16 @@ int handle_options(int *argc, char ***argv,
if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG) if (optp->var_type == GET_BOOL && optp->arg_type == NO_ARG)
{ {
*((my_bool*) optp->value)= (my_bool) 1; *((my_bool*) optp->value)= (my_bool) 1;
continue; // For GET_BOOL get_one_option() shouldn't be called continue; /* For GET_BOOL get_one_option() shouldn't be called */
} }
else if (optp->arg_type == REQUIRED_ARG || else if (optp->arg_type == REQUIRED_ARG ||
optp->arg_type == OPT_ARG) optp->arg_type == OPT_ARG)
{ {
if (*(optend + 1)) if (*(optend + 1))
{ {
// The rest of the option is option argument /* The rest of the option is option argument */
argument= optend + 1; argument= optend + 1;
// This is in effect a jump out of the outer loop /* This is in effect a jump out of the outer loop */
optend= (char*) " "; optend= (char*) " ";
} }
else if (optp->arg_type == REQUIRED_ARG) else if (optp->arg_type == REQUIRED_ARG)
...@@ -573,7 +573,7 @@ static longlong getopt_ll (char *arg, const struct my_option *optp, int *err) ...@@ -573,7 +573,7 @@ static longlong getopt_ll (char *arg, const struct my_option *optp, int *err)
if (num < (longlong) optp->min_value) if (num < (longlong) optp->min_value)
num= (longlong) optp->min_value; num= (longlong) optp->min_value;
else if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value else if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value
&& optp->max_value) // if max value is not set -> no upper limit && optp->max_value) /* if max value is not set -> no upper limit */
num= (longlong) (ulong) optp->max_value; num= (longlong) (ulong) optp->max_value;
num= ((num - (longlong) optp->sub_size) / (optp->block_size ? num= ((num - (longlong) optp->sub_size) / (optp->block_size ?
(ulonglong) optp->block_size : (ulonglong) optp->block_size :
...@@ -597,7 +597,7 @@ static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err) ...@@ -597,7 +597,7 @@ static ulonglong getopt_ull (char *arg, const struct my_option *optp, int *err)
if (num < (ulonglong) optp->min_value) if (num < (ulonglong) optp->min_value)
num= (ulonglong) optp->min_value; num= (ulonglong) optp->min_value;
else if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value else if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value
&& optp->max_value) // if max value is not set -> no upper limit && optp->max_value) /* if max value is not set -> no upper limit */
num= (ulonglong) (ulong) optp->max_value; num= (ulonglong) (ulong) optp->max_value;
num= ((num - (ulonglong) optp->sub_size) / (optp->block_size ? num= ((num - (ulonglong) optp->sub_size) / (optp->block_size ?
(ulonglong) optp->block_size : (ulonglong) optp->block_size :
...@@ -717,7 +717,7 @@ void my_print_help(const struct my_option *options) ...@@ -717,7 +717,7 @@ void my_print_help(const struct my_option *options)
for (line_end= comment + comment_space; *line_end != ' '; line_end--); for (line_end= comment + comment_space; *line_end != ' '; line_end--);
for (; comment != line_end; comment++) for (; comment != line_end; comment++)
putchar(*comment); putchar(*comment);
comment++; // skip the space, as a newline will take it's place now comment++; /* skip the space, as a newline will take it's place now */
putchar('\n'); putchar('\n');
for (col= 0; col < name_space; col++) for (col= 0; col < name_space; col++)
putchar(' '); putchar(' ');
......
...@@ -339,7 +339,7 @@ my_bool my_like_range_latin1_de(const char *ptr, uint ptr_length, ...@@ -339,7 +339,7 @@ my_bool my_like_range_latin1_de(const char *ptr, uint ptr_length,
*min_length = (uint)(min_str - min_org); *min_length = (uint)(min_str - min_org);
*max_length = res_length; *max_length = res_length;
do { do {
*min_str++ = ' '; // Because if key compression *min_str++ = ' '; /* Because if key compression */
*max_str++ = max_sort_char; *max_str++ = max_sort_char;
} while (min_str != min_end); } while (min_str != min_end);
return 0; return 0;
...@@ -356,6 +356,6 @@ my_bool my_like_range_latin1_de(const char *ptr, uint ptr_length, ...@@ -356,6 +356,6 @@ my_bool my_like_range_latin1_de(const char *ptr, uint ptr_length,
} }
while (min_str != min_end) while (min_str != min_end)
*min_str++ = *max_str++ = ' '; // Because if key compression *min_str++ = *max_str++ = ' '; /* Because if key compression */
return 0; return 0;
} }
...@@ -460,8 +460,8 @@ static uchar* thai2sortable(const uchar * tstr,uint len) ...@@ -460,8 +460,8 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
const uchar* p = tstr; const uchar* p = tstr;
uchar *outBuf; uchar *outBuf;
// uchar *pRight1, *pRight2, *pRight3, *pRight4; /* uchar *pRight1, *pRight2, *pRight3, *pRight4; */
// uchar *pLeft1, *pLeft2, *pLeft3, *pLeft4; /* uchar *pLeft1, *pLeft2, *pLeft3, *pLeft4; */
uchar *pRight1, *pRight2, *pRight3; uchar *pRight1, *pRight2, *pRight3;
uchar *pLeft1, *pLeft2, *pLeft3; uchar *pLeft1, *pLeft2, *pLeft3;
uint bufSize; uint bufSize;
...@@ -496,11 +496,11 @@ static uchar* thai2sortable(const uchar * tstr,uint len) ...@@ -496,11 +496,11 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
*pRight1++ = t_ctype[p[1]][0]; *pRight1++ = t_ctype[p[1]][0];
*pRight2++ = t_ctype[p[1]][1]; *pRight2++ = t_ctype[p[1]][1];
*pRight3++ = t_ctype[p[1]][2]; *pRight3++ = t_ctype[p[1]][2];
// *pRight4++ = t_ctype[p[1]][3]; /* *pRight4++ = t_ctype[p[1]][3]; */
*pRight1++ = t_ctype[*p][0]; *pRight1++ = t_ctype[*p][0];
*pRight2++ = t_ctype[*p][1]; *pRight2++ = t_ctype[*p][1];
*pRight3++ = t_ctype[*p][2]; *pRight3++ = t_ctype[*p][2];
// *pRight4++ = t_ctype[*p][3]; /* *pRight4++ = t_ctype[*p][3]; */
len--; len--;
p += 2; p += 2;
} else { } else {
...@@ -517,17 +517,17 @@ static uchar* thai2sortable(const uchar * tstr,uint len) ...@@ -517,17 +517,17 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
} }
*pRight1++ = L2_BLANK; *pRight1++ = L2_BLANK;
*pRight2++ = L3_BLANK; *pRight2++ = L3_BLANK;
// *pRight3++ = L4_BLANK; /* *pRight3++ = L4_BLANK; */
*pRight3++ = '\0'; *pRight3++ = '\0';
// *pRight4++ = '\0'; /* *pRight4++ = '\0'; */
memcpy(pRight1, pLeft2, pRight2 - pLeft2); memcpy(pRight1, pLeft2, pRight2 - pLeft2);
pRight1 += pRight2 - pLeft2; pRight1 += pRight2 - pLeft2;
memcpy(pRight1, pLeft3, pRight3 - pLeft3); memcpy(pRight1, pLeft3, pRight3 - pLeft3);
// pRight1 += pRight3 - pLeft3; /* pRight1 += pRight3 - pLeft3; */
// memcpy(pRight1, pLeft4, pRight4 - pLeft4); /* memcpy(pRight1, pLeft4, pRight4 - pLeft4); */
free(pLeft2); free(pLeft2);
free(pLeft3); free(pLeft3);
// free(pLeft4); /* free(pLeft4); */
return(outBuf); return(outBuf);
} }
...@@ -619,22 +619,22 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape, ...@@ -619,22 +619,22 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
{ {
if (*ptr == escape && ptr+1 != end) if (*ptr == escape && ptr+1 != end)
{ {
ptr++; // Skipp escape ptr++; /* Skipp escape */
*min_str++= *max_str++ = *ptr; *min_str++= *max_str++ = *ptr;
continue; continue;
} }
if (*ptr == wild_one) // '_' in SQL if (*ptr == wild_one) /* '_' in SQL */
{ {
*min_str++='\0'; // This should be min char *min_str++='\0'; /* This should be min char */
*max_str++=max_sort_chr; *max_str++=max_sort_chr;
continue; continue;
} }
if (*ptr == wild_many) // '%' in SQL if (*ptr == wild_many) /* '%' in SQL */
{ {
*min_length= (uint) (min_str - min_org); *min_length= (uint) (min_str - min_org);
*max_length=res_length; *max_length=res_length;
do { do {
*min_str++ = ' '; // Because if key compression *min_str++ = ' '; /* Because if key compression */
*max_str++ = max_sort_chr; *max_str++ = max_sort_chr;
} while (min_str != min_end); } while (min_str != min_end);
return 0; return 0;
...@@ -644,7 +644,7 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape, ...@@ -644,7 +644,7 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
*min_length= *max_length = (uint) (min_str - min_org); *min_length= *max_length = (uint) (min_str - min_org);
while (min_str != min_end) while (min_str != min_end)
*min_str++ = *max_str++ = ' '; // Because if key compression *min_str++ = *max_str++ = ' '; /* Because if key compression */
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment