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
674c2927
Commit
674c2927
authored
Sep 01, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CacheName: inline and thread-safe
parent
c148ac56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
18 deletions
+12
-18
src/modules/cache.c
src/modules/cache.c
+12
-18
No files found.
src/modules/cache.c
View file @
674c2927
...
@@ -81,12 +81,19 @@
...
@@ -81,12 +81,19 @@
#ifdef HAVE_DYNAMIC_PLUGINS
#ifdef HAVE_DYNAMIC_PLUGINS
static
int
CacheLoadConfig
(
module_t
*
,
FILE
*
);
static
int
CacheLoadConfig
(
module_t
*
,
FILE
*
);
static
int
CacheSaveConfig
(
module_t
*
,
FILE
*
);
static
int
CacheSaveConfig
(
module_t
*
,
FILE
*
);
static
char
*
CacheName
(
void
);
/* Sub-version number
/* Sub-version number
* (only used to avoid breakage in dev version when cache structure changes) */
* (only used to avoid breakage in dev version when cache structure changes) */
#define CACHE_SUBVERSION_NUM 3
#define CACHE_SUBVERSION_NUM 3
/* Format string for the cache filename */
#define CACHENAME_FORMAT \
"plugins-%.2zx%.2zx%.2"PRIx8".dat"
/* Magic for the cache filename */
#define CACHENAME_VALUES \
sizeof(int), sizeof(void *), *(uint8_t *)&(uint16_t){ 0xbe1e }
/*****************************************************************************
/*****************************************************************************
* LoadPluginsCache: loads the plugins cache file
* LoadPluginsCache: loads the plugins cache file
*****************************************************************************
*****************************************************************************
...
@@ -112,8 +119,8 @@ void CacheLoad( vlc_object_t *p_this )
...
@@ -112,8 +119,8 @@ void CacheLoad( vlc_object_t *p_this )
return
;
return
;
}
}
if
(
asprintf
(
&
psz_filename
,
"%s"
DIR_SEP
"%s"
,
if
(
asprintf
(
&
psz_filename
,
"%s"
DIR_SEP
CACHENAME_FORMAT
,
psz_cachedir
,
CacheName
()
)
==
-
1
)
psz_cachedir
,
CACHENAME_VALUES
)
==
-
1
)
{
{
free
(
psz_cachedir
);
free
(
psz_cachedir
);
return
;
return
;
...
@@ -493,7 +500,8 @@ void CacheSave( vlc_object_t *p_this )
...
@@ -493,7 +500,8 @@ void CacheSave( vlc_object_t *p_this )
}
}
snprintf
(
psz_filename
,
sizeof
(
psz_filename
),
snprintf
(
psz_filename
,
sizeof
(
psz_filename
),
"%s"
DIR_SEP
"%s"
,
psz_cachedir
,
CacheName
()
);
"%s"
DIR_SEP
CACHENAME_FORMAT
,
psz_cachedir
,
CACHENAME_VALUES
);
free
(
psz_cachedir
);
free
(
psz_cachedir
);
msg_Dbg
(
p_this
,
"writing plugins cache %s"
,
psz_filename
);
msg_Dbg
(
p_this
,
"writing plugins cache %s"
,
psz_filename
);
...
@@ -677,20 +685,6 @@ error:
...
@@ -677,20 +685,6 @@ error:
return
-
1
;
return
-
1
;
}
}
/*****************************************************************************
* CacheName: Return the cache file name for this platform.
*****************************************************************************/
static
char
*
CacheName
(
void
)
{
static
char
psz_cachename
[
32
];
/* Code int size, pointer size and endianness in the filename */
int32_t
x
=
0xbe00001e
;
sprintf
(
psz_cachename
,
"plugins-%.2x%.2x%.2x.dat"
,
(
int
)
sizeof
(
int
),
(
int
)
sizeof
(
void
*
),
(
unsigned
int
)((
unsigned
char
*
)
&
x
)[
0
]
);
return
psz_cachename
;
}
/*****************************************************************************
/*****************************************************************************
* CacheMerge: Merge a cache module descriptor with a full module descriptor.
* CacheMerge: Merge a cache module descriptor with a full module descriptor.
*****************************************************************************/
*****************************************************************************/
...
...
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