Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
3fa02df3
Commit
3fa02df3
authored
Aug 13, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Destroy module cache data after loading completes
We do not need them afterward.
parent
964658d0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
27 deletions
+20
-27
src/modules/cache.c
src/modules/cache.c
+15
-11
src/modules/modules.c
src/modules/modules.c
+4
-15
src/modules/modules.h
src/modules/modules.h
+1
-1
No files found.
src/modules/cache.c
View file @
3fa02df3
...
...
@@ -397,22 +397,19 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
static
int
CacheSaveBank
(
FILE
*
file
,
module_cache_t
*
const
*
,
size_t
);
/**
***************************************************************************
* Save
PluginsCache: saves the plugins cache to a file
*
****************************************************************************
/
/**
* Save
s a module cache to disk, and release cache data from memory.
*/
void
CacheSave
(
vlc_object_t
*
p_this
,
const
char
*
dir
,
module_cache_t
*
const
*
pp_cache
,
size_t
n
)
module_cache_t
**
entries
,
size_t
n
)
{
char
*
filename
,
*
tmpname
;
char
*
filename
=
NULL
,
*
tmpname
=
NULL
;
if
(
asprintf
(
&
filename
,
"%s"
DIR_SEP
CACHE_NAME
,
dir
)
==
-
1
)
return
;
goto
out
;
if
(
asprintf
(
&
tmpname
,
"%s.%"
PRIu32
,
filename
,
(
uint32_t
)
getpid
())
==
-
1
)
{
free
(
filename
);
return
;
}
goto
out
;
msg_Dbg
(
p_this
,
"saving plugins cache %s"
,
filename
);
FILE
*
file
=
vlc_fopen
(
tmpname
,
"wb"
);
...
...
@@ -423,7 +420,7 @@ void CacheSave (vlc_object_t *p_this, const char *dir,
goto
out
;
}
if
(
CacheSaveBank
(
file
,
pp_cache
,
n
))
if
(
CacheSaveBank
(
file
,
entries
,
n
))
{
msg_Warn
(
p_this
,
"cannot write %s (%m)"
,
tmpname
);
clearerr
(
file
);
...
...
@@ -443,6 +440,13 @@ void CacheSave (vlc_object_t *p_this, const char *dir,
out:
free
(
filename
);
free
(
tmpname
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
free
(
entries
[
i
]
->
path
);
free
(
entries
[
i
]);
}
free
(
entries
);
}
static
int
CacheSaveConfig
(
FILE
*
,
const
module_t
*
);
...
...
src/modules/modules.c
View file @
3fa02df3
...
...
@@ -117,8 +117,6 @@ void module_InitBank( vlc_object_t *p_this )
{
p_bank
=
calloc
(
1
,
sizeof
(
*
p_bank
));
p_bank
->
i_usage
=
1
;
p_bank
->
i_cache
=
0
;
p_bank
->
pp_cache
=
NULL
;
p_bank
->
head
=
NULL
;
/* Everything worked, attach the object */
...
...
@@ -177,15 +175,6 @@ void module_EndBank( vlc_object_t *p_this, bool b_plugins )
p_module_bank
=
NULL
;
vlc_mutex_unlock
(
&
module_lock
);
#ifdef HAVE_DYNAMIC_PLUGINS
while
(
p_bank
->
i_cache
--
)
{
free
(
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
->
path
);
free
(
p_bank
->
pp_cache
[
p_bank
->
i_cache
]
);
}
free
(
p_bank
->
pp_cache
);
#endif
while
(
p_bank
->
head
!=
NULL
)
DeleteModule
(
p_bank
,
p_bank
->
head
);
...
...
@@ -870,9 +859,8 @@ static void AllocateAllPlugins( vlc_object_t *p_this, module_bank_t *p_bank )
static
void
AllocatePluginPath
(
vlc_object_t
*
p_this
,
module_bank_t
*
p_bank
,
const
char
*
path
,
cache_mode_t
mode
)
{
module_cache_t
**
cache
;
module_cache_t
**
cache
=
NULL
;
size_t
count
=
0
;
size_t
offset
=
p_module_bank
->
i_cache
;
switch
(
mode
)
{
...
...
@@ -889,6 +877,8 @@ static void AllocatePluginPath( vlc_object_t *p_this, module_bank_t *p_bank,
msg_Dbg
(
p_this
,
"recursively browsing `%s'"
,
path
);
/* TODO: pass as argument, remove this hack */
p_bank
->
pp_cache
=
NULL
;
p_bank
->
i_cache
=
0
;
p_bank
->
pp_loaded_cache
=
cache
;
p_bank
->
i_loaded_cache
=
count
;
/* Don't go deeper than 5 subdirectories */
...
...
@@ -907,8 +897,7 @@ static void AllocatePluginPath( vlc_object_t *p_this, module_bank_t *p_bank,
}
free
(
cache
);
case
CACHE_RESET
:
CacheSave
(
p_this
,
path
,
p_bank
->
pp_cache
+
offset
,
p_bank
->
i_cache
-
offset
);
CacheSave
(
p_this
,
path
,
p_bank
->
pp_cache
,
p_bank
->
i_cache
);
case
CACHE_IGNORE
:
break
;
}
...
...
src/modules/modules.h
View file @
3fa02df3
...
...
@@ -130,7 +130,7 @@ void module_Unload (module_handle_t);
void
CacheMerge
(
vlc_object_t
*
,
module_t
*
,
module_t
*
);
void
CacheDelete
(
vlc_object_t
*
,
const
char
*
);
size_t
CacheLoad
(
vlc_object_t
*
,
const
char
*
,
module_cache_t
***
);
void
CacheSave
(
vlc_object_t
*
,
const
char
*
,
module_cache_t
*
const
*
,
size_t
);
void
CacheSave
(
vlc_object_t
*
,
const
char
*
,
module_cache_t
**
,
size_t
);
module_t
*
CacheFind
(
module_cache_t
*
const
*
,
size_t
,
const
char
*
,
const
struct
stat
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment