]> git.ipfire.org Git - thirdparty/dovecot/core.git/log
thirdparty/dovecot/core.git
4 years agolib-lua: test-lua - Use bool for expected_isnum in check_tointegerx_compat
Aki Tuomi [Mon, 10 May 2021 16:23:48 +0000 (19:23 +0300)] 
lib-lua: test-lua - Use bool for expected_isnum in check_tointegerx_compat

4 years agolib-lua: Define lua_isinteger as boolean function
Aki Tuomi [Mon, 10 May 2021 16:21:50 +0000 (19:21 +0300)] 
lib-lua: Define lua_isinteger as boolean function

4 years agolib-lua: Fix error reporting for script loading
Aki Tuomi [Mon, 19 Apr 2021 11:51:05 +0000 (14:51 +0300)] 
lib-lua: Fix error reporting for script loading

4 years agolib-lua: Use dluaL_error for luaL_error
Aki Tuomi [Mon, 19 Apr 2021 11:45:56 +0000 (14:45 +0300)] 
lib-lua: Use dluaL_error for luaL_error

4 years agolib-lua: Fix luaL_error usage
Aki Tuomi [Fri, 16 Apr 2021 10:19:26 +0000 (13:19 +0300)] 
lib-lua: Fix luaL_error usage

4 years agolib-lua: Add dluaL_error
Aki Tuomi [Fri, 16 Apr 2021 10:11:20 +0000 (13:11 +0300)] 
lib-lua: Add dluaL_error

4 years agolib-lua: dlua-script - Add dlua_pushfstring
Aki Tuomi [Fri, 16 Apr 2021 10:10:41 +0000 (13:10 +0300)] 
lib-lua: dlua-script - Add dlua_pushfstring

Uses full sprintf

4 years agolib-lua: dlua-wrapper - Constify extra functions
Aki Tuomi [Thu, 15 Apr 2021 08:19:52 +0000 (11:19 +0300)] 
lib-lua: dlua-wrapper - Constify extra functions

4 years agolib-index, lib-compression: Fix explicit integer wrapping
Timo Sirainen [Tue, 11 May 2021 14:53:57 +0000 (16:53 +0200)] 
lib-index, lib-compression: Fix explicit integer wrapping

Using modulo instead of AND wrapped it one number too early.
Luckily these didn't break anything.

4 years agolib: abort() on unexpected exit()
Timo Sirainen [Wed, 5 May 2021 09:45:25 +0000 (12:45 +0300)] 
lib: abort() on unexpected exit()

This can especially be useful in catching bugs in Lua script that could
unexpectedly exit.

4 years agoglobal: Replace exit() with lib_exit()
Timo Sirainen [Wed, 5 May 2021 09:44:03 +0000 (12:44 +0300)] 
global: Replace exit() with lib_exit()

4 years agolib-http: http-client-peer - Fix segfault occurring upon backoff connect.
Stephan Bosch [Wed, 14 Apr 2021 08:45:55 +0000 (10:45 +0200)] 
lib-http: http-client-peer - Fix segfault occurring upon backoff connect.

If peers decide to close and destroy immediately, the iteration in the shared
peer yields an invalid pointer for the next peer to connect. Fixed by preserving
pointer to next peer inside the loop.

4 years agolib: event filter - Avoid using event field wildcard matching when not needed
Josef 'Jeff' Sipek [Fri, 30 Apr 2021 20:59:50 +0000 (16:59 -0400)] 
lib: event filter - Avoid using event field wildcard matching when not needed

If the right hand side of an event field comparison is not using any
wildcards, we can compare using strcasecmp() instead of the more expensive
wildcard_match_icase().

This wildcard matching avoidance change speeds up matching quite a bit.
When the desired comparison is *not* a wildcard match (i.e., the filter is
'fieldname=abc'), microbenchmarks show at least a 11% speedup in filter
matching speed.  When the comparison includes a wildcard (i.e., the filter
is 'fieldname=abc*'), microbenchmarks show approximately 0.9% filer matching
slowdown.

Since there are so many non-wildcard matches in a typical filter, this is a
very good trade-off.

4 years agolib: event filter - Rename EVENT_FILTER_NODE_TYPE_EVENT_FIELD to denote wildcard...
Josef 'Jeff' Sipek [Fri, 30 Apr 2021 20:39:15 +0000 (16:39 -0400)] 
lib: event filter - Rename EVENT_FILTER_NODE_TYPE_EVENT_FIELD to denote wildcard matching

4 years agolib: event filter - Avoid using event name wildcard matching when not needed
Josef 'Jeff' Sipek [Fri, 30 Apr 2021 16:41:55 +0000 (12:41 -0400)] 
lib: event filter - Avoid using event name wildcard matching when not needed

If the right hand side of an event name comparison is not using any
wildcards, we can compare using strcmp() instead of the more expensive
wildcard_match().

This wildcard matching avoidance change speeds up matching quite a bit.
When the desired comparison is *not* a wildcard match (i.e., the filter is
'event=abc'), microbenchmarks show at least a 30% speedup in filter matching
speed.  When the comparison includes a wildcard (i.e., the filter is
'event=abc*'), microbenchmarks show approximately 0.4% filer matching
slowdown.

Since there are so many non-wildcard matches in a typical filter, this is a
very good trade-off.

4 years agolib: event filter - Rename EVENT_FILTER_NODE_TYPE_EVENT_NAME to denote wildcard matching
Josef 'Jeff' Sipek [Fri, 30 Apr 2021 16:44:17 +0000 (12:44 -0400)] 
lib: event filter - Rename EVENT_FILTER_NODE_TYPE_EVENT_NAME to denote wildcard matching

4 years agolib: Add wildcard_is_literal to check if a mask has * or ?
Josef 'Jeff' Sipek [Fri, 30 Apr 2021 18:09:10 +0000 (14:09 -0400)] 
lib: Add wildcard_is_literal to check if a mask has * or ?

4 years agolib: test-env-util - Make static analyzer happy
Timo Sirainen [Mon, 10 May 2021 08:26:54 +0000 (11:26 +0300)] 
lib: test-env-util - Make static analyzer happy

4 years agolib-dict: dict-lua - Don't yield again until previous one has completed
Aki Tuomi [Thu, 6 May 2021 18:25:54 +0000 (21:25 +0300)] 
lib-dict: dict-lua - Don't yield again until previous one has completed

4 years agolib-dict: dict-lua - Use absolute stack positions for arguments
Aki Tuomi [Tue, 4 May 2021 09:15:55 +0000 (12:15 +0300)] 
lib-dict: dict-lua - Use absolute stack positions for arguments

4 years agoacl: Reinitialize local acl object after creating mailbox
Aki Tuomi [Wed, 5 May 2021 10:40:29 +0000 (13:40 +0300)] 
acl: Reinitialize local acl object after creating mailbox

For INDEX layout this is needed to actually get the local mailbox path.
This fixes inheriting ACLs from parent folder for INDEX layouts.

4 years agolib: Add unit tests to env-util
Timo Sirainen [Wed, 5 May 2021 15:18:29 +0000 (18:18 +0300)] 
lib: Add unit tests to env-util

4 years agolib-index: Use env_put() instead of putenv() directly
Timo Sirainen [Wed, 20 Jan 2021 18:53:53 +0000 (20:53 +0200)] 
lib-index: Use env_put() instead of putenv() directly

4 years agoconfigure, lib: Remove workarounds for unsetenv()
Timo Sirainen [Wed, 20 Jan 2021 18:51:56 +0000 (20:51 +0200)] 
configure, lib: Remove workarounds for unsetenv()

It's in POSIX.1-2001 and available on all modern systems.

4 years agolib: env_put() - Use setenv() instead of putenv()
Timo Sirainen [Wed, 20 Jan 2021 18:48:24 +0000 (20:48 +0200)] 
lib: env_put() - Use setenv() instead of putenv()

It's already in POSIX.1-2001 so it should be available everywhere.

4 years agolib, global: Change env_put() API to take name,value pair
Timo Sirainen [Wed, 20 Jan 2021 18:46:27 +0000 (20:46 +0200)] 
lib, global: Change env_put() API to take name,value pair

4 years agolib-program-client, script: Use env_put_array()
Timo Sirainen [Wed, 20 Jan 2021 18:45:11 +0000 (20:45 +0200)] 
lib-program-client, script: Use env_put_array()

4 years agolib: Add env_put_array()
Timo Sirainen [Wed, 20 Jan 2021 18:42:40 +0000 (20:42 +0200)] 
lib: Add env_put_array()

4 years agoutil/dovecot-sysreport: Finish report even if doveadm calls fail
Timo Sirainen [Tue, 20 Apr 2021 16:06:19 +0000 (18:06 +0200)] 
util/dovecot-sysreport: Finish report even if doveadm calls fail

It can be useful to generate the report even when dovecot isn't running.

4 years agoutil/dovecot-sysreport --core: Support multiple core files
Timo Sirainen [Thu, 1 Apr 2021 11:16:34 +0000 (14:16 +0300)] 
util/dovecot-sysreport --core: Support multiple core files

4 years agoutil/dovecot-sysreport --core: Check gdb existence earlier
Timo Sirainen [Thu, 1 Apr 2021 11:12:14 +0000 (14:12 +0300)] 
util/dovecot-sysreport --core: Check gdb existence earlier

Simplifies the next commit.

4 years agoutil/dovecot-sysreport --core: Change binary path to be optional
Timo Sirainen [Thu, 1 Apr 2021 11:09:42 +0000 (14:09 +0300)] 
util/dovecot-sysreport --core: Change binary path to be optional

If not specified, detect it from the core file itself

4 years agoglobal: Use array_idx_elem() where possible
Timo Sirainen [Wed, 5 May 2021 22:08:50 +0000 (01:08 +0300)] 
global: Use array_idx_elem() where possible

4 years agolib: Add array_idx_elem()
Timo Sirainen [Tue, 4 May 2021 13:40:09 +0000 (16:40 +0300)] 
lib: Add array_idx_elem()

This returns array_idx()'s value dereferenced, so it only works for
arrays of pointers.

Note that using *array_idx() does the same, but it won't compile if the
compiler doesn't have typeof() support.

4 years agolib: Remove array_swap()
Timo Sirainen [Wed, 10 Feb 2021 20:06:29 +0000 (22:06 +0200)] 
lib: Remove array_swap()

It's not used anywhere, and it's a bit too weird.

4 years agoglobal: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:45:58 +0000 (21:45 +0200)] 
global: Use array_foreach_elem() where possible

4 years agolib-fts: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:45:41 +0000 (21:45 +0200)] 
lib-fts: Use array_foreach_elem() where possible

4 years agosubmission: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:45:19 +0000 (21:45 +0200)] 
submission: Use array_foreach_elem() where possible

4 years agostats: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:43:18 +0000 (21:43 +0200)] 
stats: Use array_foreach_elem() where possible

4 years agolib-smtp: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:35:04 +0000 (21:35 +0200)] 
lib-smtp: Use array_foreach_elem() where possible

4 years agolib-old-stats: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:31:16 +0000 (21:31 +0200)] 
lib-old-stats: Use array_foreach_elem() where possible

4 years agoconfig: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:20:25 +0000 (21:20 +0200)] 
config: Use array_foreach_elem() where possible

4 years agoplugins: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:18:42 +0000 (21:18 +0200)] 
plugins: Use array_foreach_elem() where possible

4 years agomaster: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:09:42 +0000 (21:09 +0200)] 
master: Use array_foreach_elem() where possible

4 years agolib-index: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:03:16 +0000 (21:03 +0200)] 
lib-index: Use array_foreach_elem() where possible

4 years agolib-imap-client: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 19:01:06 +0000 (21:01 +0200)] 
lib-imap-client: Use array_foreach_elem() where possible

4 years agolib-http: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:58:20 +0000 (20:58 +0200)] 
lib-http: Use array_foreach_elem() where possible

4 years agolib-dict: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:45:50 +0000 (20:45 +0200)] 
lib-dict: Use array_foreach_elem() where possible

4 years agoimap: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:44:08 +0000 (20:44 +0200)] 
imap: Use array_foreach_elem() where possible

4 years agodoveadm: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:41:27 +0000 (20:41 +0200)] 
doveadm: Use array_foreach_elem() where possible

4 years agodirector: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:34:25 +0000 (20:34 +0200)] 
director: Use array_foreach_elem() where possible

4 years agoauth: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:25:30 +0000 (20:25 +0200)] 
auth: Use array_foreach_elem() where possible

4 years agolib-storage: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:13:52 +0000 (20:13 +0200)] 
lib-storage: Use array_foreach_elem() where possible

4 years agolib: Use array_foreach_elem() where possible
Timo Sirainen [Wed, 10 Feb 2021 18:06:07 +0000 (20:06 +0200)] 
lib: Use array_foreach_elem() where possible

4 years agolib: array.h - Update array_foreach*() comments
Timo Sirainen [Wed, 10 Feb 2021 17:53:25 +0000 (19:53 +0200)] 
lib: array.h - Update array_foreach*() comments

4 years agolib: array.h - Require C99
Timo Sirainen [Wed, 10 Feb 2021 17:49:00 +0000 (19:49 +0200)] 
lib: array.h - Require C99

We're already requiring C99 elsewhere.

4 years agolib: array_foreach_elem() - Don't allow using it for sizes larger than a pointer
Timo Sirainen [Wed, 5 May 2021 14:49:33 +0000 (17:49 +0300)] 
lib: array_foreach_elem() - Don't allow using it for sizes larger than a pointer

Dovecot doesn't use any types larger than the pointer size (e.g. long
double). Restricting it to max pointer size might prevent inefficient usage.

4 years agolib: array_foreach_elem() - Small optimization
Timo Sirainen [Wed, 10 Feb 2021 17:47:13 +0000 (19:47 +0200)] 
lib: array_foreach_elem() - Small optimization

Avoid having to recalculate the end of the array after each loop.
This makes the resulting assembler output similar to array_foreach().

4 years agolib-index: Try harder to open index with MAIL_INDEX_OPEN_FLAG_READONLY
Timo Sirainen [Thu, 1 Apr 2021 14:24:10 +0000 (17:24 +0300)] 
lib-index: Try harder to open index with MAIL_INDEX_OPEN_FLAG_READONLY

The readonly-flag is used when rebuilding index or dumping indexes.
In both cases it's better to try to open the index as best as possible,
since fsck isn't allowed.

4 years agolib-lua: Remove obsolete threading check
Josef 'Jeff' Sipek [Thu, 6 May 2021 19:17:05 +0000 (15:17 -0400)] 
lib-lua: Remove obsolete threading check

We support multiple lua thread as long as they are created using the
dlua_script_new_thread() helper.

4 years agodict-ldap: Fix calling dict_wait() on async lookup
Timo Sirainen [Wed, 5 May 2021 13:47:43 +0000 (16:47 +0300)] 
dict-ldap: Fix calling dict_wait() on async lookup

The dict_wait() could have waited forever because nothing stopped the
ioloop. Also fix calling the callback with the proper active ioloop.

4 years agodict-redis: dict-client: Use the proper active ioloop while calling commit() callbacks
Timo Sirainen [Wed, 5 May 2021 13:41:21 +0000 (16:41 +0300)] 
dict-redis: dict-client: Use the proper active ioloop while calling commit() callbacks

If the callbacks did any IO/timeout changes, they would have gone to a wrong
ioloop. This would have caused a warning about IO/timeout leak though, so
it doesn't seem like there were such code paths currently.

4 years agodict-memcached-ascii: Assert-crash if dict ioloop gets any unexpected IOs or timeouts
Timo Sirainen [Wed, 5 May 2021 13:37:52 +0000 (16:37 +0300)] 
dict-memcached-ascii: Assert-crash if dict ioloop gets any unexpected IOs or timeouts

4 years agodict-client: Assert-crash if dict ioloop gets any unexpected IOs or timeouts
Timo Sirainen [Mon, 22 Mar 2021 15:05:24 +0000 (17:05 +0200)] 
dict-client: Assert-crash if dict ioloop gets any unexpected IOs or timeouts

4 years agodict-client: Use the proper active ioloop while calling commit() and lookup() callbacks
Timo Sirainen [Mon, 22 Mar 2021 14:50:04 +0000 (16:50 +0200)] 
dict-client: Use the proper active ioloop while calling commit() and lookup() callbacks

If the callbacks did any IO/timeout changes, they would have gone to a wrong
ioloop.

4 years agolib: Add io_loop_is_empty()
Timo Sirainen [Mon, 22 Mar 2021 14:59:09 +0000 (16:59 +0200)] 
lib: Add io_loop_is_empty()

4 years agostats: Truncate field values to 1000 bytes with log exporter
Timo Sirainen [Wed, 5 May 2021 08:19:24 +0000 (11:19 +0300)] 
stats: Truncate field values to 1000 bytes with log exporter

This attempts to prevent log lines from growing longer than 4 kB, which
causes them to wrap.

4 years agoimap: copy/move: Refresh source mailbox before copying/moving
Timo Sirainen [Tue, 4 May 2021 11:12:20 +0000 (14:12 +0300)] 
imap: copy/move: Refresh source mailbox before copying/moving

This way if another session had just expunged mails, the expunges will be
noticed and the copy/move will abort early.

4 years agoimap: move: Sync source mailbox between commits
Timo Sirainen [Thu, 29 Apr 2021 12:49:00 +0000 (15:49 +0300)] 
imap: move: Sync source mailbox between commits

This way the messages are actually expunged from storage after the commit,
not just requested to be expunged. Most importantly this means that if
another session attempts to start moving the same messages it can be noticed
earlier and one of the moves aborted.

4 years agoimap: Add imap_search_anyset_to_uidset()
Timo Sirainen [Thu, 29 Apr 2021 12:45:44 +0000 (15:45 +0300)] 
imap: Add imap_search_anyset_to_uidset()

4 years agoimap: Allow imap_search_seqset_iter_init() to iterate over uidset also
Timo Sirainen [Thu, 29 Apr 2021 12:46:48 +0000 (15:46 +0300)] 
imap: Allow imap_search_seqset_iter_init() to iterate over uidset also

4 years agolib-storage: Fix mailbox_get_uid_range() to handle "*" correctly
Timo Sirainen [Thu, 29 Apr 2021 12:43:10 +0000 (15:43 +0300)] 
lib-storage: Fix mailbox_get_uid_range() to handle "*" correctly

Previously attempting to convert e.g. 1:* range would just assert-crash.
There were no such callers currently though.

4 years agolib-storage: Always set struct mail.expunged
Timo Sirainen [Thu, 29 Apr 2021 12:39:29 +0000 (15:39 +0300)] 
lib-storage: Always set struct mail.expunged

Previously it was set only when some error noticed that there was a problem
accessing the mail. Now this is set immediately in mail_set_seq(). This
allows e.g. IMAP COPY/MOVE to abort when it encounters expunged mails.

4 years agolib-program-client: test-program-client-unix - Add test for delayed disconnect after...
Stephan Bosch [Tue, 4 May 2021 00:19:07 +0000 (02:19 +0200)] 
lib-program-client: test-program-client-unix - Add test for delayed disconnect after sending result code.

4 years agolib-program-client: test-program-client-net - Add test for delayed disconnect after...
Stephan Bosch [Mon, 3 May 2021 21:54:11 +0000 (23:54 +0200)] 
lib-program-client: test-program-client-net - Add test for delayed disconnect after sending result code.

4 years agolib-program-client: test-program-client-unix - Fix server-side argument count check.
Stephan Bosch [Tue, 4 May 2021 00:12:21 +0000 (02:12 +0200)] 
lib-program-client: test-program-client-unix - Fix server-side argument count check.

4 years agolib-program-client: test-program-client-net - Fix server-side argument count check.
Stephan Bosch [Tue, 4 May 2021 00:11:34 +0000 (02:11 +0200)] 
lib-program-client: test-program-client-net - Fix server-side argument count check.

4 years agolib-program-client: program-client-remote - Fix result parsing in the istream.
Stephan Bosch [Mon, 3 May 2021 21:54:26 +0000 (23:54 +0200)] 
lib-program-client: program-client-remote - Fix result parsing in the istream.

This fixes internal errors occurring when the parent stream is fully read before
EOF is signaled. This was caused by the fact that the final bytes were not
always reserved properly for parsing, so that these ended up being exposed to
and eaten by the application. At the end, the result parsing code would be faced
with no data, thereby causing an internal error to be returned by the calling
application.

This came to light as CI tests involving Sieve extprograms failed irregularly.
This problem only occurs when a (slight) delay exists between the last data
being sent and the connection being closed by the script service, making this
hard to reproduce. It typically occurred only under high server load.

4 years agolib-program-client: program-client-remote - Fix error handling of istream.
Stephan Bosch [Mon, 3 May 2021 21:51:36 +0000 (23:51 +0200)] 
lib-program-client: program-client-remote - Fix error handling of istream.

These days, input streams also set eof upon error, making the existing code path
wrong.

4 years agolib-program-client: program-client-remote - Add proper error and debug logging for...
Stephan Bosch [Mon, 3 May 2021 23:46:22 +0000 (01:46 +0200)] 
lib-program-client: program-client-remote - Add proper error and debug logging for result code parsing.

4 years agolib-program-client: program-client-local - Add debug for child start problem.
Stephan Bosch [Mon, 3 May 2021 23:34:30 +0000 (01:34 +0200)] 
lib-program-client: program-client-local - Add debug for child start problem.

4 years agolib-program-client: Reformat test-program-client-unix.c.
Stephan Bosch [Mon, 3 May 2021 21:49:11 +0000 (23:49 +0200)] 
lib-program-client: Reformat test-program-client-unix.c.

4 years agolib-program-client: Reformat test-program-client-net.c.
Stephan Bosch [Mon, 3 May 2021 21:43:47 +0000 (23:43 +0200)] 
lib-program-client: Reformat test-program-client-net.c.

4 years agolib-program-client: Reformat program-client-remote.c.
Stephan Bosch [Mon, 3 May 2021 21:35:38 +0000 (23:35 +0200)] 
lib-program-client: Reformat program-client-remote.c.

4 years agolib-test: Convert test_assert()s to fatal asserts when running static analyzer
Timo Sirainen [Thu, 22 Apr 2021 09:07:12 +0000 (12:07 +0300)] 
lib-test: Convert test_assert()s to fatal asserts when running static analyzer

This avoids unnecessary warnings about unit tests crashing when
test_assert()s fail. The warnings are correct, but it's a bit unnecessary
to write the failure code paths that nicely.

4 years agolib: Perform most of the event logging within data stack frame
Timo Sirainen [Mon, 26 Apr 2021 11:14:45 +0000 (14:14 +0300)] 
lib: Perform most of the event logging within data stack frame

4 years agolib-storage: Add data stack frames to mail_set_*()
Timo Sirainen [Mon, 26 Apr 2021 11:13:09 +0000 (14:13 +0300)] 
lib-storage: Add data stack frames to mail_set_*()

This can reduce data stack usage significantly with mail thread building.

4 years agolib: data-stack - If frame doesn't change current block, no blocks need to be freed
Timo Sirainen [Wed, 31 Mar 2021 13:26:00 +0000 (16:26 +0300)] 
lib: data-stack - If frame doesn't change current block, no blocks need to be freed

This is a micro-optimization to t_pop() to avoid an extra if-check.

4 years agolib: data-stack - Use stack_block.left_lowwater only with DEBUG
Timo Sirainen [Wed, 31 Mar 2021 13:22:24 +0000 (16:22 +0300)] 
lib: data-stack - Use stack_block.left_lowwater only with DEBUG

4 years agolib: Remove data_stack_set_clean_after_pop()
Timo Sirainen [Wed, 31 Mar 2021 13:17:30 +0000 (16:17 +0300)] 
lib: Remove data_stack_set_clean_after_pop()

4 years agolib: data-stack - Move frame memory allocation inside data stack block
Timo Sirainen [Wed, 31 Mar 2021 13:04:47 +0000 (16:04 +0300)] 
lib: data-stack - Move frame memory allocation inside data stack block

4 years agolib: data-stack - Replace stack_frame_block with a single stack_frame
Timo Sirainen [Wed, 31 Mar 2021 11:25:47 +0000 (14:25 +0300)] 
lib: data-stack - Replace stack_frame_block with a single stack_frame

This simplifies the code at the cost of more memory allocations.
However, this will be fixed by the following commit.

4 years agolib: data-stack - Add data_stack_grow event
Timo Sirainen [Mon, 16 Nov 2020 18:54:20 +0000 (20:54 +0200)] 
lib: data-stack - Add data_stack_grow event

This is now always enabled, not just in debug builds.

4 years agolib: t_get_bytes_available() - Fix return value when current_block is almost full
Timo Sirainen [Wed, 31 Mar 2021 11:40:12 +0000 (14:40 +0300)] 
lib: t_get_bytes_available() - Fix return value when current_block is almost full

4 years agolib-settings: settings_check() - Avoid growing data stack unnecessarily
Timo Sirainen [Mon, 16 Nov 2020 12:56:50 +0000 (14:56 +0200)] 
lib-settings: settings_check() - Avoid growing data stack unnecessarily

Each check_func() could have increased data stack usage. Add it inside
a data stack frame to avoid it growing unnecessarily large.

4 years agolib: module_dir_*load*(): Avoid growing data stack when checking duplicates
Timo Sirainen [Mon, 16 Nov 2020 12:58:08 +0000 (14:58 +0200)] 
lib: module_dir_*load*(): Avoid growing data stack when checking duplicates

This check could have unnecessarily grown data stack size when many plugins
are installed.

4 years agoglobal: Use T_END_PASS_STR() where possible
Timo Sirainen [Mon, 16 Nov 2020 17:37:26 +0000 (19:37 +0200)] 
global: Use T_END_PASS_STR() where possible

4 years agolib: data-stack - Add t_pop_pass_str() and T_END_PASS_STR[_IF]()
Timo Sirainen [Mon, 16 Nov 2020 16:23:59 +0000 (18:23 +0200)] 
lib: data-stack - Add t_pop_pass_str() and T_END_PASS_STR[_IF]()

This simplifies passing error strings out of stack frames. For example:

   const char *error;
   T_BEGIN {
     ...
     if (ret < 0)
       error = t_strdup_printf("foo() failed: %m");
   } T_END_PASS_STR_IF(ret < 0, &error);
   // error is still valid

4 years agolib: Add data_stack_frame_contains()
Timo Sirainen [Wed, 31 Mar 2021 08:56:10 +0000 (11:56 +0300)] 
lib: Add data_stack_frame_contains()

4 years agolib: Add data_stack_get_alloc_size()
Timo Sirainen [Wed, 31 Mar 2021 10:19:00 +0000 (13:19 +0300)] 
lib: Add data_stack_get_alloc_size()