[vlc-devel] commit: Avoid pushing a full structure onto the stack ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Aug 24 14:47:38 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Aug 24 15:35:02 2008 +0300| [94c911fabf7c97ed428a6c2cbd5f831e80f8c3d7] | committer: Rémi Denis-Courmont
Avoid pushing a full structure onto the stack
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=94c911fabf7c97ed428a6c2cbd5f831e80f8c3d7
---
modules/control/telnet.c | 25 +++++++------------------
1 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/modules/control/telnet.c b/modules/control/telnet.c
index 0be9910..cffbdd8 100644
--- a/modules/control/telnet.c
+++ b/modules/control/telnet.c
@@ -142,24 +142,13 @@ struct intf_sys_t
* This code relies upon the fact the url.i_port is 0 if the :PORT
* option is missing from --telnet-host.
*/
-static int getPort(intf_thread_t *p_intf, vlc_url_t url, int i_port)
+static int getPort(intf_thread_t *p_intf, const vlc_url_t *url, int i_port)
{
- // Print error if two different ports have been specified
- if (url.i_port != 0 &&
- i_port != TELNETPORT_DEFAULT &&
- url.i_port != i_port )
- {
- msg_Err( p_intf, "ignoring port %d and using %d", url.i_port,
- i_port);
- }
- if (i_port != TELNETPORT_DEFAULT)
- {
- return i_port;
- }
- if (url.i_port != 0)
- {
- return url.i_port;
- }
+ if (i_port == TELNETPORT_DEFAULT && url->i_port != 0)
+ i_port = url->i_port;
+ if (url->i_port != 0 && url->i_port != i_port)
+ // Print error if two different ports have been specified
+ msg_Warn( p_intf, "ignoring port %d (using %d)", url->i_port, i_port );
return i_port;
}
@@ -190,7 +179,7 @@ static int Open( vlc_object_t *p_this )
// There might be two ports given, resolve any potentially
// conflict
- url.i_port = getPort(p_intf, url, i_telnetport);
+ url.i_port = getPort(p_intf, &url, i_telnetport);
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( !p_intf->p_sys )
More information about the vlc-devel
mailing list