* Discard any query text absorbed during an inactive conditional branch. * * We must discard data that was appended to query_buf during an inactive * \if branch. We don't have to do anything there if there's no query_buf. * * Also, reset the lexer state to the same paren depth there was before. * (The rest of its state doesn't need attention, since we could not be * inside a comment or lit
| 3007 | * inside a comment or literal or partial token.) |
| 3008 | */ |
| 3009 | static void |
| 3010 | discard_query_text(PsqlScanState scan_state, ConditionalStack cstack, |
| 3011 | PQExpBuffer query_buf) |
| 3012 | { |
| 3013 | if (query_buf) |
| 3014 | { |
| 3015 | int new_len = conditional_stack_get_query_len(cstack); |
| 3016 | |
| 3017 | Assert(new_len >= 0 && new_len <= query_buf->len); |
| 3018 | query_buf->len = new_len; |
| 3019 | query_buf->data[new_len] = '\0'; |
| 3020 | } |
| 3021 | psql_scan_set_paren_depth(scan_state, |
| 3022 | conditional_stack_get_paren_depth(cstack)); |
| 3023 | } |
| 3024 | |
| 3025 | /* |
| 3026 | * If query_buf is empty, copy previous_buf into it. |
no test coverage detected