Download src/php/php-src/ext/mysqlnd/mysqlnd_alloc.h from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 4.35 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/mysqlnd/mysqlnd_alloc.h
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/ext/mysqlnd/mysqlnd_alloc.h
-
curl -L -o mysqlnd_alloc.h https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/ext/mysqlnd/mysqlnd_alloc.h
4.35 kB
| /* | |
| +----------------------------------------------------------------------+ | |
| | Copyright (c) The PHP Group | | |
| +----------------------------------------------------------------------+ | |
| | This source file is subject to version 3.01 of the PHP license, | | |
| | that is bundled with this package in the file LICENSE, and is | | |
| | available through the world-wide-web at the following url: | | |
| | https://www.php.net/license/3_01.txt | | |
| | If you did not receive a copy of the PHP license and are unable to | | |
| | obtain it through the world-wide-web, please send a note to | | |
| | license@php.net so we can mail you a copy immediately. | | |
| +----------------------------------------------------------------------+ | |
| | Authors: Andrey Hristov <andrey@php.net> | | |
| | Ulf Wendel <uw@php.net> | | |
| +----------------------------------------------------------------------+ | |
| */ | |
| PHPAPI extern const char * mysqlnd_debug_std_no_trace_funcs[]; | |
| struct st_mysqlnd_allocator_methods | |
| { | |
| void * (*m_emalloc)(size_t size MYSQLND_MEM_D); | |
| void * (*m_pemalloc)(size_t size, bool persistent MYSQLND_MEM_D); | |
| void * (*m_ecalloc)(unsigned int nmemb, size_t size MYSQLND_MEM_D); | |
| void * (*m_pecalloc)(unsigned int nmemb, size_t size, bool persistent MYSQLND_MEM_D); | |
| void * (*m_erealloc)(void *ptr, size_t new_size MYSQLND_MEM_D); | |
| void * (*m_perealloc)(void *ptr, size_t new_size, bool persistent MYSQLND_MEM_D); | |
| void (*m_efree)(void *ptr MYSQLND_MEM_D); | |
| void (*m_pefree)(void *ptr, bool persistent MYSQLND_MEM_D); | |
| char * (*m_pememdup)(const char * const ptr, size_t size, bool persistent MYSQLND_MEM_D); | |
| char * (*m_pestrndup)(const char * const ptr, size_t size, bool persistent MYSQLND_MEM_D); | |
| char * (*m_pestrdup)(const char * const ptr, bool persistent MYSQLND_MEM_D); | |
| }; | |
| PHPAPI extern struct st_mysqlnd_allocator_methods mysqlnd_allocator; | |
| static inline MYSQLND_STRING mnd_dup_cstring(const MYSQLND_CSTRING str, const bool persistent) | |
| { | |
| const MYSQLND_STRING ret = {(char*) mnd_pemalloc(str.l + 1, persistent), str.l}; | |
| if (ret.s) { | |
| memcpy(ret.s, str.s, str.l); | |
| ret.s[str.l] = '\0'; | |
| } | |
| return ret; | |
| } | |
| static inline MYSQLND_CSTRING mnd_str2c(const MYSQLND_STRING str) | |
| { | |
| const MYSQLND_CSTRING ret = {str.s, str.l}; | |
| return ret; | |
| } | |
| static inline void mysqlnd_set_string(MYSQLND_STRING *buf, const char *string, size_t len) { | |
| if (buf->s) { | |
| mnd_efree(buf->s); | |
| buf->s = NULL; | |
| buf->l = 0; | |
| } | |
| if (string) { | |
| buf->s = mnd_pestrndup(string, len, 0); | |
| buf->l = len; | |
| } | |
| } | |
| static inline void mysqlnd_set_persistent_string(MYSQLND_STRING *buf, const char *string, size_t len, bool persistent) { | |
| if (buf->s) { | |
| mnd_pefree(buf->s, persistent); | |
| buf->s = NULL; | |
| buf->l = 0; | |
| } | |
| if (string) { | |
| buf->s = mnd_pestrndup(string, len, persistent); | |
| buf->l = len; | |
| } | |
| } | |