Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
b893d33d
Commit
b893d33d
authored
Oct 23, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variables: store a single type per list
All entries in a single list always have the same type anyway.
parent
21938b73
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
20 deletions
+11
-20
include/vlc_common.h
include/vlc_common.h
+3
-4
modules/lua/libs/variables.c
modules/lua/libs/variables.c
+1
-2
src/misc/variables.c
src/misc/variables.c
+7
-14
No files found.
include/vlc_common.h
View file @
b893d33d
...
@@ -362,10 +362,9 @@ typedef union
...
@@ -362,10 +362,9 @@ typedef union
*/
*/
struct
vlc_list_t
struct
vlc_list_t
{
{
int
i_type
;
int
i_count
;
int
i_count
;
vlc_value_t
*
p_values
;
vlc_value_t
*
p_values
;
int
*
pi_types
;
};
};
/*****************************************************************************
/*****************************************************************************
...
...
modules/lua/libs/variables.c
View file @
b893d33d
...
@@ -85,8 +85,7 @@ static int vlclua_pushlist( lua_State *L, vlc_list_t *p_list )
...
@@ -85,8 +85,7 @@ static int vlclua_pushlist( lua_State *L, vlc_list_t *p_list )
for
(
int
i
=
0
;
i
<
i_count
;
i
++
)
for
(
int
i
=
0
;
i
<
i_count
;
i
++
)
{
{
lua_pushinteger
(
L
,
i
+
1
);
lua_pushinteger
(
L
,
i
+
1
);
if
(
!
vlclua_pushvalue
(
L
,
p_list
->
pi_types
[
i
],
if
(
!
vlclua_pushvalue
(
L
,
p_list
->
i_type
,
p_list
->
p_values
[
i
],
true
)
)
p_list
->
p_values
[
i
],
true
)
)
lua_pushnil
(
L
);
lua_pushnil
(
L
);
lua_settable
(
L
,
-
3
);
lua_settable
(
L
,
-
3
);
}
}
...
...
src/misc/variables.c
View file @
b893d33d
...
@@ -103,7 +103,7 @@ static void FreeList( vlc_value_t *p_val )
...
@@ -103,7 +103,7 @@ static void FreeList( vlc_value_t *p_val )
int
i
;
int
i
;
for
(
i
=
0
;
i
<
p_val
->
p_list
->
i_count
;
i
++
)
for
(
i
=
0
;
i
<
p_val
->
p_list
->
i_count
;
i
++
)
{
{
switch
(
p_val
->
p_list
->
pi_types
[
i
]
&
VLC_VAR_CLASS
)
switch
(
p_val
->
p_list
->
i_type
&
VLC_VAR_CLASS
)
{
{
case
VLC_VAR_STRING
:
case
VLC_VAR_STRING
:
FreeString
(
&
p_val
->
p_list
->
p_values
[
i
]
);
FreeString
(
&
p_val
->
p_list
->
p_values
[
i
]
);
...
@@ -114,10 +114,7 @@ static void FreeList( vlc_value_t *p_val )
...
@@ -114,10 +114,7 @@ static void FreeList( vlc_value_t *p_val )
}
}
if
(
p_val
->
p_list
->
i_count
)
if
(
p_val
->
p_list
->
i_count
)
{
free
(
p_val
->
p_list
->
p_values
);
free
(
p_val
->
p_list
->
p_values
);
free
(
p_val
->
p_list
->
pi_types
);
}
free
(
p_val
->
p_list
);
free
(
p_val
->
p_list
);
}
}
...
@@ -561,29 +558,28 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
...
@@ -561,29 +558,28 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
{
{
p_val
->
p_list
->
p_values
=
malloc
(
p_var
->
choices
.
i_count
p_val
->
p_list
->
p_values
=
malloc
(
p_var
->
choices
.
i_count
*
sizeof
(
vlc_value_t
)
);
*
sizeof
(
vlc_value_t
)
);
p_val
->
p_list
->
pi_types
=
malloc
(
p_var
->
choices
.
i_count
*
sizeof
(
int
)
);
if
(
p_val2
)
if
(
p_val2
)
{
{
p_val2
->
p_list
->
p_values
=
p_val2
->
p_list
->
p_values
=
malloc
(
p_var
->
choices
.
i_count
*
sizeof
(
vlc_value_t
)
);
malloc
(
p_var
->
choices
.
i_count
*
sizeof
(
vlc_value_t
)
);
p_val2
->
p_list
->
pi_types
=
malloc
(
p_var
->
choices
.
i_count
*
sizeof
(
int
)
);
}
}
}
}
p_val
->
p_list
->
i_type
=
p_var
->
i_type
;
p_val
->
p_list
->
i_count
=
p_var
->
choices
.
i_count
;
p_val
->
p_list
->
i_count
=
p_var
->
choices
.
i_count
;
if
(
p_val2
)
p_val2
->
p_list
->
i_count
=
p_var
->
choices
.
i_count
;
if
(
p_val2
)
{
p_val2
->
p_list
->
i_type
=
VLC_VAR_STRING
;
p_val2
->
p_list
->
i_count
=
p_var
->
choices
.
i_count
;
}
for
(
int
i
=
0
;
i
<
p_var
->
choices
.
i_count
;
i
++
)
for
(
int
i
=
0
;
i
<
p_var
->
choices
.
i_count
;
i
++
)
{
{
p_val
->
p_list
->
p_values
[
i
]
=
p_var
->
choices
.
p_values
[
i
];
p_val
->
p_list
->
p_values
[
i
]
=
p_var
->
choices
.
p_values
[
i
];
p_val
->
p_list
->
pi_types
[
i
]
=
p_var
->
i_type
;
p_var
->
ops
->
pf_dup
(
&
p_val
->
p_list
->
p_values
[
i
]
);
p_var
->
ops
->
pf_dup
(
&
p_val
->
p_list
->
p_values
[
i
]
);
if
(
p_val2
)
if
(
p_val2
)
{
{
p_val2
->
p_list
->
p_values
[
i
].
psz_string
=
p_val2
->
p_list
->
p_values
[
i
].
psz_string
=
p_var
->
choices_text
.
p_values
[
i
].
psz_string
?
p_var
->
choices_text
.
p_values
[
i
].
psz_string
?
strdup
(
p_var
->
choices_text
.
p_values
[
i
].
psz_string
)
:
NULL
;
strdup
(
p_var
->
choices_text
.
p_values
[
i
].
psz_string
)
:
NULL
;
p_val2
->
p_list
->
pi_types
[
i
]
=
VLC_VAR_STRING
;
}
}
}
}
break
;
break
;
...
@@ -1445,10 +1441,7 @@ void var_FreeList( vlc_value_t *p_val, vlc_value_t *p_val2 )
...
@@ -1445,10 +1441,7 @@ void var_FreeList( vlc_value_t *p_val, vlc_value_t *p_val2 )
for
(
int
i
=
0
;
i
<
p_val2
->
p_list
->
i_count
;
i
++
)
for
(
int
i
=
0
;
i
<
p_val2
->
p_list
->
i_count
;
i
++
)
free
(
p_val2
->
p_list
->
p_values
[
i
].
psz_string
);
free
(
p_val2
->
p_list
->
p_values
[
i
].
psz_string
);
if
(
p_val2
->
p_list
->
i_count
)
if
(
p_val2
->
p_list
->
i_count
)
{
free
(
p_val2
->
p_list
->
p_values
);
free
(
p_val2
->
p_list
->
p_values
);
free
(
p_val2
->
p_list
->
pi_types
);
}
free
(
p_val2
->
p_list
);
free
(
p_val2
->
p_list
);
}
}
}
}
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