| 874 | #define MY_YACC_MAX 32000 // Because of 'short' |
| 875 | |
| 876 | bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize) |
| 877 | { |
| 878 | Yacc_state *state= & current_thd->m_parser_state->m_yacc; |
| 879 | ulong old_info=0; |
| 880 | DBUG_ASSERT(state); |
| 881 | if ((uint) *yystacksize >= MY_YACC_MAX) |
| 882 | return 1; |
| 883 | if (!state->yacc_yyvs) |
| 884 | old_info= *yystacksize; |
| 885 | *yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX); |
| 886 | if (!(state->yacc_yyvs= (uchar*) |
| 887 | my_realloc(state->yacc_yyvs, |
| 888 | *yystacksize*sizeof(**yyvs), |
| 889 | MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR))) || |
| 890 | !(state->yacc_yyss= (uchar*) |
| 891 | my_realloc(state->yacc_yyss, |
| 892 | *yystacksize*sizeof(**yyss), |
| 893 | MYF(MY_ALLOW_ZERO_PTR | MY_FREE_ON_ERROR)))) |
| 894 | return 1; |
| 895 | if (old_info) |
| 896 | { |
| 897 | /* |
| 898 | Only copy the old stack on the first call to my_yyoverflow(), |
| 899 | when replacing a static stack (YYINITDEPTH) by a dynamic stack. |
| 900 | For subsequent calls, my_realloc already did preserve the old stack. |
| 901 | */ |
| 902 | memcpy(state->yacc_yyss, *yyss, old_info*sizeof(**yyss)); |
| 903 | memcpy(state->yacc_yyvs, *yyvs, old_info*sizeof(**yyvs)); |
| 904 | } |
| 905 | *yyss= (short*) state->yacc_yyss; |
| 906 | *yyvs= (YYSTYPE*) state->yacc_yyvs; |
| 907 | return 0; |
| 908 | } |
| 909 | |
| 910 | |
| 911 | /** |
nothing calls this directly
no test coverage detected