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
89593593
Commit
89593593
authored
Jun 17, 2011
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua: remove spurious strdup (a string is valid as long as it stays on the stack)
parent
e52251f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
modules/lua/libs/sd.c
modules/lua/libs/sd.c
+14
-14
No files found.
modules/lua/libs/sd.c
View file @
89593593
...
@@ -114,12 +114,13 @@ static int vlclua_sd_add_node( lua_State *L )
...
@@ -114,12 +114,13 @@ static int vlclua_sd_add_node( lua_State *L )
lua_getfield
(
L
,
-
1
,
"title"
);
lua_getfield
(
L
,
-
1
,
"title"
);
if
(
lua_isstring
(
L
,
-
1
)
)
if
(
lua_isstring
(
L
,
-
1
)
)
{
{
char
*
name
=
strdup
(
lua_tostring
(
L
,
-
1
)
);
const
char
*
psz_name
=
lua_tostring
(
L
,
-
1
);
lua_pop
(
L
,
1
);
input_item_t
*
p_input
=
input_item_NewWithType
(
VLC_OBJECT
(
p_sd
),
input_item_t
*
p_input
=
input_item_NewWithType
(
VLC_OBJECT
(
p_sd
),
"vlc://nop"
,
"vlc://nop"
,
name
,
0
,
NULL
,
0
,
psz_
name
,
0
,
NULL
,
0
,
-
1
,
ITEM_TYPE_NODE
);
-
1
,
ITEM_TYPE_NODE
);
lua_pop
(
L
,
1
);
if
(
p_input
)
if
(
p_input
)
{
{
lua_getfield
(
L
,
-
1
,
"arturl"
);
lua_getfield
(
L
,
-
1
,
"arturl"
);
...
@@ -144,7 +145,6 @@ static int vlclua_sd_add_node( lua_State *L )
...
@@ -144,7 +145,6 @@ static int vlclua_sd_add_node( lua_State *L )
}
}
lua_setmetatable
(
L
,
-
2
);
lua_setmetatable
(
L
,
-
2
);
}
}
free
(
name
);
}
}
else
else
msg_Err
(
p_sd
,
"vlc.sd.add_node: the
\"
title
\"
parameter can't be empty"
);
msg_Err
(
p_sd
,
"vlc.sd.add_node: the
\"
title
\"
parameter can't be empty"
);
...
@@ -164,13 +164,14 @@ static int vlclua_sd_add_item( lua_State *L )
...
@@ -164,13 +164,14 @@ static int vlclua_sd_add_item( lua_State *L )
{
{
char
**
ppsz_options
=
NULL
;
char
**
ppsz_options
=
NULL
;
int
i_options
=
0
;
int
i_options
=
0
;
char
*
psz_path
=
strdup
(
lua_tostring
(
L
,
-
1
)
);
const
char
*
psz_path
=
lua_tostring
(
L
,
-
1
);
lua_pop
(
L
,
1
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
input_item_t
*
p_input
=
input_item_NewExt
(
p_sd
,
psz_path
,
psz_path
,
input_item_t
*
p_input
=
input_item_NewExt
(
p_sd
,
psz_path
,
psz_path
,
i_options
,
i_options
,
(
const
char
**
)
ppsz_options
,
(
const
char
**
)
ppsz_options
,
VLC_INPUT_OPTION_TRUSTED
,
-
1
);
VLC_INPUT_OPTION_TRUSTED
,
-
1
);
lua_pop
(
L
,
1
);
if
(
p_input
)
if
(
p_input
)
{
{
vlclua_read_meta_data
(
p_sd
,
L
,
p_input
);
vlclua_read_meta_data
(
p_sd
,
L
,
p_input
);
...
@@ -195,7 +196,6 @@ static int vlclua_sd_add_item( lua_State *L )
...
@@ -195,7 +196,6 @@ static int vlclua_sd_add_item( lua_State *L )
lua_setmetatable
(
L
,
-
2
);
lua_setmetatable
(
L
,
-
2
);
vlc_gc_decref
(
p_input
);
vlc_gc_decref
(
p_input
);
}
}
free
(
psz_path
);
while
(
i_options
>
0
)
while
(
i_options
>
0
)
free
(
ppsz_options
[
--
i_options
]
);
free
(
ppsz_options
[
--
i_options
]
);
free
(
ppsz_options
);
free
(
ppsz_options
);
...
@@ -235,14 +235,15 @@ static int vlclua_node_add_subitem( lua_State *L )
...
@@ -235,14 +235,15 @@ static int vlclua_node_add_subitem( lua_State *L )
{
{
char
**
ppsz_options
=
NULL
;
char
**
ppsz_options
=
NULL
;
int
i_options
=
0
;
int
i_options
=
0
;
char
*
psz_path
=
strdup
(
lua_tostring
(
L
,
-
1
)
);
const
char
*
psz_path
=
lua_tostring
(
L
,
-
1
);
lua_pop
(
L
,
1
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
vlclua_read_options
(
p_sd
,
L
,
&
i_options
,
&
ppsz_options
);
input_item_node_t
*
p_input_node
=
input_item_node_Create
(
*
pp_node
);
input_item_node_t
*
p_input_node
=
input_item_node_Create
(
*
pp_node
);
input_item_t
*
p_input
=
input_item_NewExt
(
p_sd
,
psz_path
,
input_item_t
*
p_input
=
input_item_NewExt
(
p_sd
,
psz_path
,
psz_path
,
i_options
,
psz_path
,
i_options
,
(
const
char
**
)
ppsz_options
,
(
const
char
**
)
ppsz_options
,
VLC_INPUT_OPTION_TRUSTED
,
-
1
);
VLC_INPUT_OPTION_TRUSTED
,
-
1
);
lua_pop
(
L
,
1
);
if
(
p_input
)
if
(
p_input
)
{
{
vlclua_read_meta_data
(
p_sd
,
L
,
p_input
);
vlclua_read_meta_data
(
p_sd
,
L
,
p_input
);
...
@@ -267,7 +268,6 @@ static int vlclua_node_add_subitem( lua_State *L )
...
@@ -267,7 +268,6 @@ static int vlclua_node_add_subitem( lua_State *L )
lua_setmetatable
(
L
,
-
2
);
lua_setmetatable
(
L
,
-
2
);
vlc_gc_decref
(
p_input
);
vlc_gc_decref
(
p_input
);
}
}
free
(
psz_path
);
while
(
i_options
>
0
)
while
(
i_options
>
0
)
free
(
ppsz_options
[
--
i_options
]
);
free
(
ppsz_options
[
--
i_options
]
);
free
(
ppsz_options
);
free
(
ppsz_options
);
...
@@ -292,13 +292,14 @@ static int vlclua_node_add_node( lua_State *L )
...
@@ -292,13 +292,14 @@ static int vlclua_node_add_node( lua_State *L )
lua_getfield
(
L
,
-
1
,
"title"
);
lua_getfield
(
L
,
-
1
,
"title"
);
if
(
lua_isstring
(
L
,
-
1
)
)
if
(
lua_isstring
(
L
,
-
1
)
)
{
{
char
*
name
=
strdup
(
lua_tostring
(
L
,
-
1
)
);
const
char
*
psz_name
=
lua_tostring
(
L
,
-
1
);
lua_pop
(
L
,
1
);
input_item_node_t
*
p_input_node
=
input_item_node_Create
(
*
pp_node
);
input_item_node_t
*
p_input_node
=
input_item_node_Create
(
*
pp_node
);
input_item_t
*
p_input
=
input_item_NewWithType
(
VLC_OBJECT
(
p_sd
),
input_item_t
*
p_input
=
input_item_NewWithType
(
VLC_OBJECT
(
p_sd
),
"vlc://nop"
,
"vlc://nop"
,
name
,
0
,
NULL
,
0
,
psz_
name
,
0
,
NULL
,
0
,
-
1
,
ITEM_TYPE_NODE
);
-
1
,
ITEM_TYPE_NODE
);
lua_pop
(
L
,
1
);
if
(
p_input
)
if
(
p_input
)
{
{
lua_getfield
(
L
,
-
1
,
"arturl"
);
lua_getfield
(
L
,
-
1
,
"arturl"
);
...
@@ -323,7 +324,6 @@ static int vlclua_node_add_node( lua_State *L )
...
@@ -323,7 +324,6 @@ static int vlclua_node_add_node( lua_State *L )
}
}
lua_setmetatable
(
L
,
-
2
);
lua_setmetatable
(
L
,
-
2
);
}
}
free
(
name
);
}
}
else
else
msg_Err
(
p_sd
,
"node:add_node: the
\"
title
\"
parameter can't be empty"
);
msg_Err
(
p_sd
,
"node:add_node: the
\"
title
\"
parameter can't be empty"
);
...
...
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