[vlc-devel] [PATCH] core: use config count not size

Lyndon Brown jnqnfe at gmail.com
Sun Sep 27 21:42:57 CEST 2020


From: Lyndon Brown <jnqnfe at gmail.com>
Date: Wed, 17 Apr 2019 18:15:19 +0100
Subject: core: use config count not size

count already excludes hint items, thus by using that instead of size we
accurately only allocate the memory required, rather than ending up with
a chunk of overhead from all of the hint items that don't even get stored
in it.

as a rough estimate, there are around 1400 hint entry calls in the tree;
considering most but not all will exist on each platform, this thus avoids
wasting space for in the region of 1000 unneeded pointers.

diff --git a/src/config/core.c b/src/config/core.c
index b24ef59ab4..b9ed95da37 100644
--- a/src/config/core.c
+++ b/src/config/core.c
@@ -403,7 +403,7 @@ int config_SortConfig (void)
     size_t nconf = 0;
 
     for (p = vlc_plugins; p != NULL; p = p->next)
-         nconf += p->conf.size;
+         nconf += p->conf.count;
 
     module_config_t **clist = vlc_alloc (nconf, sizeof (*clist));
     if (unlikely(clist == NULL))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core_conf_count.patch
Type: text/x-patch
Size: 1055 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200927/e980208d/attachment-0001.bin>


More information about the vlc-devel mailing list