forked from oceanbase/seekdb
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparse_malloc.h
More file actions
55 lines (47 loc) · 2.57 KB
/
Copy pathparse_malloc.h
File metadata and controls
55 lines (47 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Copyright (c) 2025 OceanBase.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OCEANBASE_SQL_PARSER_PARSE_MALLOC_
#define OCEANBASE_SQL_PARSER_PARSE_MALLOC_
#include <stdint.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
// NB: Be careful!!!, it is only used in parser module
// NOTE, parse_malloc will memset the allocated memory to 0
extern void *parse_malloc(const size_t nbyte, void *malloc_pool);
extern void *parse_realloc(void *ptr, size_t nbyte, void *malloc_pool);
extern void parse_free(void *ptr);
extern char *parse_strndup(const char *str, size_t nbyte, void *malloc_pool);
extern char *parse_strdup(const char *str, void *malloc_pool, int64_t *out_len);
extern char* charset_upper(const struct ObCharsetInfo* src_cs, char *src_ptr, int64_t src_len, void *malloc_pool);
extern char *parse_str_convert_utf8(const struct ObCharsetInfo* src_cs, const char *str, void *malloc_pool, int64_t *out_len, int *extra_errno);
extern char *replace_invalid_character(const struct ObCharsetInfo* src_cs,
const struct ObCharsetInfo* oracle_db_cs,
const char *str, int64_t *out_len, void *malloc_pool, int *extra_errno);
extern char *strndup_with_prefix(const char *prefix, const char *str, size_t nbyte, void *malloc_pool);
extern char *strndup_with_prefix_and_postfix(const char *prefix, const char *postfix, const char *str, size_t nbyte, void *malloc_pool);
extern char *cp_str_value(const char *src, const size_t nbyte, void *malloc_pool);
extern char *parse_strdup_with_replace_multi_byte_char(const char *str, int *connection_collation_,
void *malloc_pool, int64_t *out_len);
extern bool check_real_escape(const struct ObCharsetInfo *cs, char *str, int64_t str_len,
int64_t last_escape_check_pos);
extern void *parser_alloc(void *malloc_pool, const int64_t alloc_size);
extern void *malloc_parentheses_info(const size_t nbyte, void *malloc_pool);
#ifdef __cplusplus
}
#endif
#endif //OCEANBASE_SQL_PARSER_PARSE_MALLOC_