Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
830bfb51
Commit
830bfb51
authored
May 03, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocate global object as the others - not statically anymore
parent
c07b1d0c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
src/misc/objects.c
src/misc/objects.c
+5
-9
src/misc/threads.c
src/misc/threads.c
+8
-8
No files found.
src/misc/objects.c
View file @
830bfb51
...
@@ -115,13 +115,8 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
...
@@ -115,13 +115,8 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
if
(
p_priv
==
NULL
)
if
(
p_priv
==
NULL
)
return
NULL
;
return
NULL
;
if
(
i_type
==
VLC_OBJECT_GLOBAL
)
p_new
=
p_this
;
else
{
assert
(
i_size
>=
sizeof
(
vlc_object_t
));
assert
(
i_size
>=
sizeof
(
vlc_object_t
));
p_new
=
(
vlc_object_t
*
)(
p_priv
+
1
);
p_new
=
(
vlc_object_t
*
)(
p_priv
+
1
);
}
p_new
->
p_internals
=
p_priv
;
p_new
->
p_internals
=
p_priv
;
p_new
->
i_object_type
=
i_type
;
p_new
->
i_object_type
=
i_type
;
...
@@ -137,7 +132,8 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
...
@@ -137,7 +132,8 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
p_new
->
psz_header
=
NULL
;
p_new
->
psz_header
=
NULL
;
p_new
->
i_flags
|=
p_this
->
i_flags
if
(
p_this
)
p_new
->
i_flags
=
p_this
->
i_flags
&
(
OBJECT_FLAGS_NODBG
|
OBJECT_FLAGS_QUIET
|
OBJECT_FLAGS_NOINTERACT
);
&
(
OBJECT_FLAGS_NODBG
|
OBJECT_FLAGS_QUIET
|
OBJECT_FLAGS_NOINTERACT
);
p_priv
->
p_vars
=
calloc
(
sizeof
(
variable_t
),
16
);
p_priv
->
p_vars
=
calloc
(
sizeof
(
variable_t
),
16
);
...
...
src/misc/threads.c
View file @
830bfb51
...
@@ -57,13 +57,12 @@ static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER;
...
@@ -57,13 +57,12 @@ static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER;
* Global process-wide VLC object.
* Global process-wide VLC object.
* Contains inter-instance data, such as the module cache and global mutexes.
* Contains inter-instance data, such as the module cache and global mutexes.
*/
*/
static
vlc_object_t
*
p_root
;
static
libvlc_global_data_t
*
p_root
;
static
libvlc_global_data_t
libvlc_global
;
libvlc_global_data_t
*
vlc_global
(
void
)
libvlc_global_data_t
*
vlc_global
(
void
)
{
{
assert
(
i_initializations
>
0
);
assert
(
i_initializations
>
0
);
return
&
libvlc_global
;
return
p_root
;
}
}
...
@@ -143,16 +142,16 @@ int vlc_threads_init( void )
...
@@ -143,16 +142,16 @@ int vlc_threads_init( void )
if
(
i_initializations
==
0
)
if
(
i_initializations
==
0
)
{
{
/* We should be safe now. Do all the initialization stuff we want. */
p_root
=
vlc_custom_create
(
NULL
,
sizeof
(
*
p_root
),
libvlc_global
.
b_ready
=
false
;
p_root
=
vlc_custom_create
(
VLC_OBJECT
(
&
libvlc_global
),
0
,
VLC_OBJECT_GLOBAL
,
"global"
);
VLC_OBJECT_GLOBAL
,
"global"
);
if
(
p_root
==
NULL
)
if
(
p_root
==
NULL
)
{
{
i_ret
=
VLC_ENOMEM
;
i_ret
=
VLC_ENOMEM
;
goto
out
;
goto
out
;
}
}
/* We should be safe now. Do all the initialization stuff we want. */
p_root
->
b_ready
=
false
;
vlc_threadvar_create
(
p_root
,
&
msg_context_global_key
);
vlc_threadvar_create
(
p_root
,
&
msg_context_global_key
);
}
}
i_initializations
++
;
i_initializations
++
;
...
@@ -185,8 +184,9 @@ void vlc_threads_end( void )
...
@@ -185,8 +184,9 @@ void vlc_threads_end( void )
#endif
#endif
assert
(
i_initializations
>
0
);
assert
(
i_initializations
>
0
);
if
(
--
i_initializations
==
0
)
if
(
i_initializations
==
0
)
vlc_object_release
(
p_root
);
vlc_object_release
(
p_root
);
i_initializations
--
;
#if defined( UNDER_CE )
#if defined( UNDER_CE )
#elif defined( WIN32 )
#elif defined( WIN32 )
...
...
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