1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00
profanity/src
Steffen Jaeckel d3b6ebb1d7 Less allocations in str_replace()
If `n` is the number of `substr` replace operations, the old
implementation did `n+1` allocations and always first copied start,
then replacement, then the remaining (unsearched) part of the original
string.

Now calculate the number of occurences of `substr` before allocating the
resulting string.
Change the algorithm to parse through the original string and only
copy the parts that must be kept into the resulting string plus the
replacements where they belong at.
Now we also only have to go through the original string twice plus we only
do a single allocation.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
2023-09-01 12:12:44 +02:00
..
command Fix spaces in /privacy description 2023-08-04 08:39:20 +02:00
config Update preferences.h 2023-08-31 23:14:02 +02:00
event ox: correctly recognize ox encrypted carbons 2023-08-25 08:24:53 +02:00
omemo Cleanup g_strfreev() to auto_gcharv 2023-07-13 17:05:07 +02:00
otr g_free() to auto_gfree, introduce auto_guchar 2023-07-13 17:04:59 +02:00
pgp Cleanup g_strfreev() to auto_gcharv 2023-07-13 17:05:07 +02:00
plugins Cleanup g_strfreev() to auto_gcharv 2023-07-13 17:05:07 +02:00
tools Don't crash when using /plugins install disconnected 2023-08-28 07:55:29 +02:00
ui Introduce win_println_va() 2023-09-01 12:12:44 +02:00
xmpp Display headline sender 2023-08-11 15:56:26 +02:00
chatlog.c Fix my email address 2023-07-31 16:51:58 +02:00
chatlog.h Split log.c into log.c and chatlog.c 2022-06-28 20:08:38 +02:00
common.c Less allocations in str_replace() 2023-09-01 12:12:44 +02:00
common.h Add helper function to create version string 2023-07-25 20:58:15 +02:00
database.c Fix my email address 2023-07-31 16:51:58 +02:00
database.h Fix my email address 2023-07-31 16:51:58 +02:00
log.c Fix some more char* -> gchar*. 2023-08-31 23:14:02 +02:00
log.h Fix some more char* -> gchar*. 2023-08-31 23:14:02 +02:00
main.c Add helper function to create version string 2023-07-25 20:58:15 +02:00
profanity.c Add helper function to create version string 2023-07-25 20:58:15 +02:00
profanity.h Update copyright year 2023-01-10 10:37:25 +01:00