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
af3779ff
Commit
af3779ff
authored
Jan 23, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FindObjectName: split parent and child search modes
parent
538a9b4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
53 deletions
+33
-53
src/misc/objects.c
src/misc/objects.c
+33
-53
No files found.
src/misc/objects.c
View file @
af3779ff
...
@@ -77,7 +77,8 @@ static int DumpCommand( vlc_object_t *, char const *,
...
@@ -77,7 +77,8 @@ static int DumpCommand( vlc_object_t *, char const *,
static
vlc_object_t
*
FindParent
(
vlc_object_t
*
,
int
);
static
vlc_object_t
*
FindParent
(
vlc_object_t
*
,
int
);
static
vlc_object_t
*
FindChild
(
vlc_object_t
*
,
int
);
static
vlc_object_t
*
FindChild
(
vlc_object_t
*
,
int
);
static
vlc_object_t
*
FindObjectName
(
vlc_object_t
*
,
const
char
*
,
int
);
static
vlc_object_t
*
FindParentName
(
vlc_object_t
*
,
const
char
*
);
static
vlc_object_t
*
FindChildName
(
vlc_object_t
*
,
const
char
*
);
static
void
PrintObject
(
vlc_object_t
*
,
const
char
*
);
static
void
PrintObject
(
vlc_object_t
*
,
const
char
*
);
static
void
DumpStructure
(
vlc_object_t
*
,
int
,
char
*
);
static
void
DumpStructure
(
vlc_object_t
*
,
int
,
char
*
);
...
@@ -532,10 +533,17 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
...
@@ -532,10 +533,17 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
FIND_CHILD
);
FIND_CHILD
);
libvlc_lock
(
p_this
->
p_libvlc
);
libvlc_lock
(
p_this
->
p_libvlc
);
switch
(
i_mode
)
/* Otherwise, recursively look for the object */
{
p_found
=
FindObjectName
(
p_this
,
psz_name
,
i_mode
);
case
FIND_PARENT
:
p_found
=
FindParentName
(
p_this
,
psz_name
);
break
;
case
FIND_CHILD
:
p_found
=
FindChildName
(
p_this
,
psz_name
);
break
;
default:
assert
(
0
);
}
libvlc_unlock
(
p_this
->
p_libvlc
);
libvlc_unlock
(
p_this
->
p_libvlc
);
return
p_found
;
return
p_found
;
}
}
...
@@ -927,6 +935,18 @@ static vlc_object_t *FindParent (vlc_object_t *p_this, int i_type)
...
@@ -927,6 +935,18 @@ static vlc_object_t *FindParent (vlc_object_t *p_this, int i_type)
return
NULL
;
return
NULL
;
}
}
static
vlc_object_t
*
FindParentName
(
vlc_object_t
*
p_this
,
const
char
*
name
)
{
for
(
vlc_object_t
*
parent
=
p_this
->
p_parent
;
parent
!=
NULL
;
parent
=
parent
->
p_parent
)
{
if
(
!
objnamecmp
(
parent
,
name
))
return
vlc_object_hold
(
parent
);
}
return
NULL
;
}
static
vlc_object_t
*
FindChild
(
vlc_object_t
*
p_this
,
int
i_type
)
static
vlc_object_t
*
FindChild
(
vlc_object_t
*
p_this
,
int
i_type
)
{
{
for
(
int
i
=
vlc_internals
(
p_this
)
->
i_children
;
i
--
;
)
for
(
int
i
=
vlc_internals
(
p_this
)
->
i_children
;
i
--
;
)
...
@@ -942,61 +962,21 @@ static vlc_object_t *FindChild (vlc_object_t *p_this, int i_type)
...
@@ -942,61 +962,21 @@ static vlc_object_t *FindChild (vlc_object_t *p_this, int i_type)
return
NULL
;
return
NULL
;
}
}
static
vlc_object_t
*
FindChildName
(
vlc_object_t
*
p_this
,
const
char
*
name
)
static
vlc_object_t
*
FindObjectName
(
vlc_object_t
*
p_this
,
const
char
*
psz_name
,
int
i_mode
)
{
{
int
i
;
for
(
int
i
=
vlc_internals
(
p_this
)
->
i_children
;
i
--
;
)
vlc_object_t
*
p_tmp
;
switch
(
i_mode
)
{
{
case
FIND_PARENT
:
vlc_object_t
*
child
=
vlc_internals
(
p_this
)
->
pp_children
[
i
];
p_tmp
=
p_this
->
p_parent
;
if
(
!
objnamecmp
(
child
,
name
))
if
(
p_tmp
)
return
vlc_object_hold
(
child
);
{
if
(
!
objnamecmp
(
p_tmp
,
psz_name
)
)
{
vlc_object_hold
(
p_tmp
);
return
p_tmp
;
}
else
{
return
FindObjectName
(
p_tmp
,
psz_name
,
i_mode
);
}
}
break
;
case
FIND_CHILD
:
for
(
i
=
vlc_internals
(
p_this
)
->
i_children
;
i
--
;
)
{
p_tmp
=
vlc_internals
(
p_this
)
->
pp_children
[
i
];
if
(
!
objnamecmp
(
p_tmp
,
psz_name
)
)
{
vlc_object_hold
(
p_tmp
);
return
p_tmp
;
}
else
if
(
vlc_internals
(
p_tmp
)
->
i_children
)
{
p_tmp
=
FindObjectName
(
p_tmp
,
psz_name
,
i_mode
);
if
(
p_tmp
)
{
return
p_tmp
;
}
}
}
break
;
case
FIND_ANYWHERE
:
child
=
FindChildName
(
child
,
name
);
/* Handled in vlc_object_find */
if
(
child
!=
NULL
)
break
;
return
child
;
}
}
return
NULL
;
return
NULL
;
}
}
static
void
PrintObject
(
vlc_object_t
*
p_this
,
const
char
*
psz_prefix
)
static
void
PrintObject
(
vlc_object_t
*
p_this
,
const
char
*
psz_prefix
)
{
{
char
psz_children
[
20
],
psz_refcount
[
20
],
psz_thread
[
30
],
psz_name
[
50
],
char
psz_children
[
20
],
psz_refcount
[
20
],
psz_thread
[
30
],
psz_name
[
50
],
...
...
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