Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d21779b9
Commit
d21779b9
authored
Mar 29, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some global object-specific hacks
parent
e8d99a6b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
27 deletions
+11
-27
src/misc/objects.c
src/misc/objects.c
+9
-25
src/misc/threads.c
src/misc/threads.c
+2
-2
No files found.
src/misc/objects.c
View file @
d21779b9
...
@@ -95,7 +95,6 @@ static void vlc_object_yield_locked( vlc_object_t *p_this );
...
@@ -95,7 +95,6 @@ static void vlc_object_yield_locked( vlc_object_t *p_this );
* Local structure lock
* Local structure lock
*****************************************************************************/
*****************************************************************************/
static
vlc_mutex_t
structure_lock
;
static
vlc_mutex_t
structure_lock
;
static
vlc_object_internals_t
global_internals
;
void
*
vlc_custom_create
(
vlc_object_t
*
p_this
,
size_t
i_size
,
void
*
vlc_custom_create
(
vlc_object_t
*
p_this
,
size_t
i_size
,
int
i_type
,
const
char
*
psz_type
)
int
i_type
,
const
char
*
psz_type
)
...
@@ -103,19 +102,15 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
...
@@ -103,19 +102,15 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
vlc_object_t
*
p_new
;
vlc_object_t
*
p_new
;
vlc_object_internals_t
*
p_priv
;
vlc_object_internals_t
*
p_priv
;
p_priv
=
calloc
(
1
,
sizeof
(
*
p_priv
)
+
i_size
);
if
(
p_priv
==
NULL
)
return
NULL
;
if
(
i_type
==
VLC_OBJECT_GLOBAL
)
if
(
i_type
==
VLC_OBJECT_GLOBAL
)
{
p_new
=
p_this
;
p_new
=
p_this
;
p_priv
=
&
global_internals
;
memset
(
p_priv
,
0
,
sizeof
(
*
p_priv
)
);
}
else
else
{
{
assert
(
i_size
>=
sizeof
(
vlc_object_t
));
assert
(
i_size
>=
sizeof
(
vlc_object_t
));
p_priv
=
calloc
(
1
,
sizeof
(
*
p_priv
)
+
i_size
);
if
(
p_priv
==
NULL
)
return
NULL
;
p_new
=
(
vlc_object_t
*
)(
p_priv
+
1
);
p_new
=
(
vlc_object_t
*
)(
p_priv
+
1
);
}
}
...
@@ -133,18 +128,13 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
...
@@ -133,18 +128,13 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
p_new
->
psz_header
=
NULL
;
p_new
->
psz_header
=
NULL
;
if
(
p_this
->
i_flags
&
OBJECT_FLAGS_NODBG
)
p_new
->
i_flags
|=
p_this
->
i_flags
p_new
->
i_flags
|=
OBJECT_FLAGS_NODBG
;
&
(
OBJECT_FLAGS_NODBG
|
OBJECT_FLAGS_QUIET
|
OBJECT_FLAGS_NOINTERACT
);
if
(
p_this
->
i_flags
&
OBJECT_FLAGS_QUIET
)
p_new
->
i_flags
|=
OBJECT_FLAGS_QUIET
;
if
(
p_this
->
i_flags
&
OBJECT_FLAGS_NOINTERACT
)
p_new
->
i_flags
|=
OBJECT_FLAGS_NOINTERACT
;
p_priv
->
p_vars
=
calloc
(
sizeof
(
variable_t
),
16
);
p_priv
->
p_vars
=
calloc
(
sizeof
(
variable_t
),
16
);
if
(
!
p_priv
->
p_vars
)
if
(
!
p_priv
->
p_vars
)
{
{
if
(
i_type
!=
VLC_OBJECT_GLOBAL
)
free
(
p_priv
);
free
(
p_priv
);
return
NULL
;
return
NULL
;
}
}
...
@@ -162,6 +152,7 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
...
@@ -162,6 +152,7 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
p_libvlc_global
->
pp_objects
=
malloc
(
sizeof
(
vlc_object_t
*
)
);
p_libvlc_global
->
pp_objects
=
malloc
(
sizeof
(
vlc_object_t
*
)
);
p_libvlc_global
->
pp_objects
[
0
]
=
p_new
;
p_libvlc_global
->
pp_objects
[
0
]
=
p_new
;
p_priv
->
b_attached
=
VLC_TRUE
;
p_priv
->
b_attached
=
VLC_TRUE
;
vlc_mutex_init
(
p_new
,
&
structure_lock
);
}
}
else
else
{
{
...
@@ -205,11 +196,6 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
...
@@ -205,11 +196,6 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
vlc_spin_init
(
&
p_priv
->
spin
);
vlc_spin_init
(
&
p_priv
->
spin
);
p_priv
->
pipes
[
0
]
=
p_priv
->
pipes
[
1
]
=
-
1
;
p_priv
->
pipes
[
0
]
=
p_priv
->
pipes
[
1
]
=
-
1
;
if
(
i_type
==
VLC_OBJECT_GLOBAL
)
{
vlc_mutex_init
(
p_new
,
&
structure_lock
);
}
if
(
i_type
==
VLC_OBJECT_LIBVLC
)
if
(
i_type
==
VLC_OBJECT_LIBVLC
)
{
{
var_Create
(
p_new
,
"list"
,
VLC_VAR_STRING
|
VLC_VAR_ISCOMMAND
);
var_Create
(
p_new
,
"list"
,
VLC_VAR_STRING
|
VLC_VAR_ISCOMMAND
);
...
@@ -434,8 +420,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
...
@@ -434,8 +420,6 @@ static void vlc_object_destroy( vlc_object_t *p_this )
if
(
p_priv
->
pipes
[
0
]
!=
-
1
)
if
(
p_priv
->
pipes
[
0
]
!=
-
1
)
close
(
p_priv
->
pipes
[
0
]
);
close
(
p_priv
->
pipes
[
0
]
);
/* global is not dynamically allocated by vlc_object_create */
if
(
p_this
->
i_object_type
!=
VLC_OBJECT_GLOBAL
)
free
(
p_priv
);
free
(
p_priv
);
}
}
...
...
src/misc/threads.c
View file @
d21779b9
...
@@ -187,8 +187,8 @@ int __vlc_threads_init( vlc_object_t *p_this )
...
@@ -187,8 +187,8 @@ int __vlc_threads_init( vlc_object_t *p_this )
#elif defined( LIBVLC_USE_PTHREAD )
#elif defined( LIBVLC_USE_PTHREAD )
#endif
#endif
p_root
=
vlc_custom_create
(
p_libvlc_global
,
0
,
VLC_OBJECT_GLOBAL
,
p_root
=
vlc_custom_create
(
VLC_OBJECT
(
p_libvlc_global
),
0
,
"global"
);
VLC_OBJECT_GLOBAL
,
"global"
);
if
(
p_root
==
NULL
)
if
(
p_root
==
NULL
)
i_ret
=
VLC_ENOMEM
;
i_ret
=
VLC_ENOMEM
;
...
...
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