0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

[meson] CONFIG_MEMCOUNT separated from CONFIG_DEBUG

This commit is contained in:
Witold Filipczyk 2025-01-30 10:38:00 +01:00
parent c88f3cb5cb
commit 8f550b8108
14 changed files with 30 additions and 18 deletions

View File

@ -164,6 +164,9 @@
/* Define if you want: Marks support */
#mesondefine CONFIG_MARKS
/* Define if you want: memcount support */
#mesondefine CONFIG_MEMCOUNT
/* Define if you want: Mimetypes files support */
#mesondefine CONFIG_MIMETYPES

View File

@ -62,6 +62,7 @@ conf_data.set('CONFIG_DOM', get_option('html-highlight'))
conf_data.set('CONFIG_BACKTRACE', get_option('backtrace'))
conf_data.set('CONFIG_NO_ROOT_EXEC', get_option('no-root'))
conf_data.set('CONFIG_DEBUG', get_option('withdebug'))
conf_data.set('CONFIG_MEMCOUNT', get_option('memcount'))
conf_data.set('CONFIG_FASTMEM', get_option('fastmem'))
conf_data.set('CONFIG_OWN_LIBC', get_option('own-libc'))
conf_data.set('CONFIG_SMALL', get_option('small'))

View File

@ -33,6 +33,7 @@ option('html-highlight', type: 'boolean', value: false, description: 'HTML highl
option('backtrace', type: 'boolean', value: true, description: 'backtrace support')
option('no-root', type: 'boolean', value: false, description: 'prevention of usage by root')
option('withdebug', type: 'boolean', value: false, description: 'leak debug and internal error checking')
option('memcount', type: 'boolean', value: false, description: 'count memory allocations')
option('fastmem', type: 'boolean', value: false, description: 'direct use of system allocation functions, not usable with debug enabled')
option('own-libc', type: 'boolean', value: false, description: 'force use of internal functions instead of those of system libc')
option('small', type: 'boolean', value: false, description: 'reduce binary size as far as possible (but see the bottom of doc/small.txt!)')

View File

@ -268,7 +268,7 @@ get_resource_info(struct terminal *term, void *data)
val = get_number_of_temporary_files();
add_format_to_string(&info, ": %ld.", val);
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
#ifdef CONFIG_BROTLI
add_format_to_string(&info, "\nBrotli: calls: %ld active: %ld, size: %ld", get_brotli_total_allocs(), get_brotli_active(), get_brotli_size());
#endif

View File

@ -52,7 +52,7 @@ brotli_open(struct stream_encoded *stream, int fd)
if (!data) {
return -1;
}
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
data->state = BrotliDecoderCreateInstance(el_brotli_alloc, el_brotli_free, NULL);
#else
data->state = BrotliDecoderCreateInstance(NULL, NULL, NULL);

View File

@ -61,7 +61,7 @@ deflate_open(int window_size, struct stream_encoded *stream, int fd)
/* Initialize all members of *data, except data->buf[], which
* will be initialized on demand by deflate_read. */
copy_struct(&data->deflate_stream, &null_z_stream);
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
data->deflate_stream.zalloc = el_gzip_alloc;
data->deflate_stream.zfree = el_gzip_free;
#endif

View File

@ -49,7 +49,7 @@ zstd_open(struct stream_encoded *stream, int fd)
}
data->fdread = fd;
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
data->zstd_stream = ZSTD_createDCtx_advanced(el_zstd_mf);
#else
data->zstd_stream = ZSTD_createDCtx();

View File

@ -722,7 +722,7 @@ init_ecmascript_module(struct module *module)
#endif
}
ecmascript_enabled = get_opt_bool("ecmascript.enable", NULL);
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
curl_global_init_mem(CURL_GLOBAL_DEFAULT, el_curl_malloc, el_curl_free, el_curl_realloc, el_curl_strdup, el_curl_calloc);
#else
curl_global_init(CURL_GLOBAL_DEFAULT);

View File

@ -138,7 +138,7 @@ mujs_get_interpreter(struct ecmascript_interpreter *interpreter)
{
assert(interpreter);
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
js_State *J = js_newstate(el_mujs_alloc, NULL, 0);
#else
js_State *J = js_newstate(NULL, NULL, 0);

View File

@ -175,7 +175,7 @@ quickjs_init(struct module *module)
map_form_elements_rev = attr_create_new_form_elements_map_rev();
//js_module_init_ok = spidermonkey_runtime_addref();
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
quickjs_runtime = JS_NewRuntime2(&el_quickjs_mf, NULL);
#else
quickjs_runtime = JS_NewRuntime();

View File

@ -860,7 +860,7 @@ enable_libevent(void)
return;
#endif
#if !defined(EVENT__DISABLE_MM_REPLACEMENT) && defined(CONFIG_DEBUG)
#if !defined(EVENT__DISABLE_MM_REPLACEMENT) && defined(CONFIG_MEMCOUNT)
event_set_mem_functions(el_libevent_malloc, el_libevent_realloc, el_libevent_free);
#endif
@ -1153,7 +1153,7 @@ select_loop(void (*init)(void))
#if defined(CONFIG_LIBCURL) && defined(CONFIG_LIBEVENT)
memset(&g, 0, sizeof(GlobalInfo));
g.evbase = event_base;
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
curl_global_init_mem(CURL_GLOBAL_DEFAULT, el_curl_malloc, el_curl_free, el_curl_realloc, el_curl_strdup, el_curl_calloc);
#else
curl_global_init(CURL_GLOBAL_DEFAULT);
@ -1176,7 +1176,7 @@ select_loop(void (*init)(void))
#if defined(CONFIG_LIBCURL) && defined(CONFIG_LIBEV)
memset(&g, 0, sizeof(GlobalInfo));
g.loop = ev_default_loop(0);
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
curl_global_init_mem(CURL_GLOBAL_DEFAULT, el_curl_malloc, el_curl_free, el_curl_realloc, el_curl_strdup, el_curl_calloc);
#else
curl_global_init(CURL_GLOBAL_DEFAULT);
@ -1229,7 +1229,7 @@ select_loop(void (*init)(void))
{
#if defined(CONFIG_LIBCURL)
memset(&g, 0, sizeof(GlobalInfo));
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
curl_global_init_mem(CURL_GLOBAL_DEFAULT, el_curl_malloc, el_curl_free, el_curl_realloc, el_curl_strdup, el_curl_calloc);
#else
curl_global_init(CURL_GLOBAL_DEFAULT);

View File

@ -101,7 +101,7 @@ struct sixel_encoder {
void *dither_cache;
};
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
static sixel_allocator_t *el_sixel_allocator;
static void
@ -858,7 +858,7 @@ add_image_to_document(struct document *doc, struct string *pixels, int lineno, s
mem_free(im);
return 0;
}
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
init_allocator();
status = sixel_decoder_new(&decoder, el_sixel_allocator);
#else
@ -943,7 +943,7 @@ copy_frame(struct image *src, struct el_box *box, int cell_width, int cell_heigh
mem_free(dest);
return NULL;
}
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
init_allocator();
status = sixel_decoder_new(&decoder, el_sixel_allocator);
#else
@ -1050,7 +1050,7 @@ el_sixel_get_image(char *data, int length, int *outlen)
*outlen = 0;
#ifdef HAVE_MEMFD_CREATE
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
init_allocator();
status = sixel_encoder_new(&encoder, el_sixel_allocator);
#else

View File

@ -1,7 +1,7 @@
#ifndef EL__UTIL_MEMCOUNT_H
#define EL__UTIL_MEMCOUNT_H
#ifdef CONFIG_DEBUG
#ifdef CONFIG_MEMCOUNT
#ifdef CONFIG_LIBSIXEL
#include <sixel.h>

View File

@ -6,12 +6,19 @@ endif
if conf_data.get('CONFIG_CSS') or conf_data.get('CONFIG_BITTORRENT')
srcs += files('scanner.c')
endif
if conf_data.get('CONFIG_DEBUG')
srcs += files('memcount.cpp', 'memdebug.c')
if conf_data.get('CONFIG_MEMCOUNT')
srcs += files('memcount.cpp')
endif
if conf_data.get('CONFIG_DEBUG')
srcs += files('memdebug.c')
endif
if conf_data.get('CONFIG_DOM')
srcs += files('scanner.c')
endif
if conf_data.get('CONFIG_BITTORRENT')
if conf_data.get('CONFIG_OWN_LIBC') or not conf_data.get('CONFIG_OPENSSL')
srcs += files('sha1.c')