[vlc-devel] commit: some cleaning. ( Rémi Duraffort )
git version control
git at videolan.org
Fri Jan 2 19:06:14 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jan 2 19:05:22 2009 +0100| [303113c7964055549f5335b9c8c6401567e0e515] | committer: Rémi Duraffort
some cleaning.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=303113c7964055549f5335b9c8c6401567e0e515
---
modules/codec/realvideo.c | 3 +-
modules/control/telnet.c | 3 +-
modules/demux/rawvid.c | 3 +-
modules/gui/skins2/commands/cmd_change_skin.cpp | 5 +---
modules/gui/skins2/controls/ctrl_generic.cpp | 10 +-------
modules/gui/skins2/controls/ctrl_text.cpp | 25 ++++------------------
modules/gui/skins2/controls/ctrl_tree.cpp | 10 +-------
modules/gui/skins2/controls/ctrl_video.cpp | 5 +---
modules/gui/skins2/src/generic_layout.cpp | 5 +---
modules/gui/skins2/src/generic_window.cpp | 5 +---
modules/gui/skins2/src/tooltip.cpp | 10 +-------
modules/gui/skins2/src/vout_window.cpp | 10 +-------
modules/misc/lua/libs/playlist.c | 2 +-
13 files changed, 21 insertions(+), 75 deletions(-)
diff --git a/modules/codec/realvideo.c b/modules/codec/realvideo.c
index 60e43fb..6e5c512 100644
--- a/modules/codec/realvideo.c
+++ b/modules/codec/realvideo.c
@@ -435,8 +435,7 @@ static void Close( vlc_object_t *p_this )
vlc_mutex_unlock( &rm_mutex );
- if ( p_sys )
- free( p_sys );
+ free( p_sys );
}
/*****************************************************************************
diff --git a/modules/control/telnet.c b/modules/control/telnet.c
index 7a693db..ab7e31d 100644
--- a/modules/control/telnet.c
+++ b/modules/control/telnet.c
@@ -502,14 +502,13 @@ static void Run( intf_thread_t *p_intf )
if (fd == -1)
continue;
- telnet_client_t *cl = malloc( sizeof( telnet_client_t ));
+ telnet_client_t *cl = calloc( 1, sizeof( telnet_client_t ));
if (cl == NULL)
{
net_Close (fd);
continue;
}
- memset( cl, 0, sizeof(telnet_client_t) );
cl->i_tel_cmd = 0;
cl->fd = fd;
cl->buffer_write = NULL;
diff --git a/modules/demux/rawvid.c b/modules/demux/rawvid.c
index 2062f93..9492b9c 100644
--- a/modules/demux/rawvid.c
+++ b/modules/demux/rawvid.c
@@ -380,8 +380,7 @@ static int Open( vlc_object_t * p_this )
return VLC_SUCCESS;
error:
- if( p_sys )
- free( p_sys );
+ free( p_sys );
return VLC_EGENERIC;
}
diff --git a/modules/gui/skins2/commands/cmd_change_skin.cpp b/modules/gui/skins2/commands/cmd_change_skin.cpp
index 0f389ad..ce31e23 100644
--- a/modules/gui/skins2/commands/cmd_change_skin.cpp
+++ b/modules/gui/skins2/commands/cmd_change_skin.cpp
@@ -48,10 +48,7 @@ void CmdChangeSkin::execute()
// Everything went well
msg_Info( getIntf(), "new theme successfully loaded (%s)",
m_file.c_str() );
- if( pOldTheme )
- {
- delete pOldTheme;
- }
+ delete pOldTheme;
}
else if( pOldTheme )
{
diff --git a/modules/gui/skins2/controls/ctrl_generic.cpp b/modules/gui/skins2/controls/ctrl_generic.cpp
index 7d4796f..77e0e8e 100644
--- a/modules/gui/skins2/controls/ctrl_generic.cpp
+++ b/modules/gui/skins2/controls/ctrl_generic.cpp
@@ -45,10 +45,7 @@ CtrlGeneric::CtrlGeneric( intf_thread_t *pIntf, const UString &rHelp,
CtrlGeneric::~CtrlGeneric()
{
- if( m_pPosition )
- {
- delete m_pPosition;
- }
+ delete m_pPosition;
if( m_pVisible )
{
m_pVisible->delObserver( this );
@@ -60,10 +57,7 @@ void CtrlGeneric::setLayout( GenericLayout *pLayout,
const Position &rPosition )
{
m_pLayout = pLayout;
- if( m_pPosition )
- {
- delete m_pPosition;
- }
+ delete m_pPosition;
m_pPosition = new Position( rPosition );
onPositionChange();
}
diff --git a/modules/gui/skins2/controls/ctrl_text.cpp b/modules/gui/skins2/controls/ctrl_text.cpp
index 09e79c3..e32da13 100644
--- a/modules/gui/skins2/controls/ctrl_text.cpp
+++ b/modules/gui/skins2/controls/ctrl_text.cpp
@@ -104,18 +104,9 @@ CtrlText::CtrlText( intf_thread_t *pIntf, VarText &rVariable,
CtrlText::~CtrlText()
{
m_rVariable.delObserver( this );
- if( m_pTimer )
- {
- delete m_pTimer;
- }
- if( m_pImg )
- {
- delete m_pImg;
- }
- if( m_pImgDouble )
- {
- delete m_pImgDouble;
- }
+ delete m_pTimer;
+ delete m_pImg;
+ delete m_pImgDouble;
}
@@ -224,10 +215,7 @@ void CtrlText::displayText( const UString &rText )
{
// Create the images ('normal' and 'double') from the text
// 'Normal' image
- if( m_pImg )
- {
- delete m_pImg;
- }
+ delete m_pImg;
m_pImg = m_rFont.drawString( rText, m_color );
if( !m_pImg )
{
@@ -235,10 +223,7 @@ void CtrlText::displayText( const UString &rText )
}
// 'Double' image
const UString doubleStringWithSep = rText + SEPARATOR_STRING + rText;
- if( m_pImgDouble )
- {
- delete m_pImgDouble;
- }
+ delete m_pImgDouble;
m_pImgDouble = m_rFont.drawString( doubleStringWithSep, m_color );
// Update the current image used, as if the control size had changed
diff --git a/modules/gui/skins2/controls/ctrl_tree.cpp b/modules/gui/skins2/controls/ctrl_tree.cpp
index 0c27d34..c2c5cdb 100644
--- a/modules/gui/skins2/controls/ctrl_tree.cpp
+++ b/modules/gui/skins2/controls/ctrl_tree.cpp
@@ -81,10 +81,7 @@ CtrlTree::~CtrlTree()
{
m_rTree.getPositionVar().delObserver( this );
m_rTree.delObserver( this );
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
}
int CtrlTree::itemHeight()
@@ -729,10 +726,7 @@ void CtrlTree::makeImage()
{
stats_TimerStart( getIntf(), "[Skins] Playlist image",
STATS_TIMER_SKINS_PLAYTREE_IMAGE );
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
// Get the size of the control
const Position *pPos = getPosition();
diff --git a/modules/gui/skins2/controls/ctrl_video.cpp b/modules/gui/skins2/controls/ctrl_video.cpp
index ccd7366..424a314 100644
--- a/modules/gui/skins2/controls/ctrl_video.cpp
+++ b/modules/gui/skins2/controls/ctrl_video.cpp
@@ -51,10 +51,7 @@ CtrlVideo::~CtrlVideo()
VarBox &rVoutSize = VlcProc::instance( getIntf() )->getVoutSizeVar();
rVoutSize.delObserver( this );
- if( m_pVout )
- {
- delete m_pVout;
- }
+ delete m_pVout;
}
diff --git a/modules/gui/skins2/src/generic_layout.cpp b/modules/gui/skins2/src/generic_layout.cpp
index 68a1651..3b8e65e 100644
--- a/modules/gui/skins2/src/generic_layout.cpp
+++ b/modules/gui/skins2/src/generic_layout.cpp
@@ -54,10 +54,7 @@ GenericLayout::GenericLayout( intf_thread_t *pIntf, int width, int height,
GenericLayout::~GenericLayout()
{
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
list<Anchor*>::const_iterator it;
for( it = m_anchorList.begin(); it != m_anchorList.end(); it++ )
{
diff --git a/modules/gui/skins2/src/generic_window.cpp b/modules/gui/skins2/src/generic_window.cpp
index 6cac778..e96f832 100644
--- a/modules/gui/skins2/src/generic_window.cpp
+++ b/modules/gui/skins2/src/generic_window.cpp
@@ -62,10 +62,7 @@ GenericWindow::~GenericWindow()
{
m_pVarVisible->delObserver( this );
- if( m_pOsWindow )
- {
- delete m_pOsWindow;
- }
+ delete m_pOsWindow;
}
diff --git a/modules/gui/skins2/src/tooltip.cpp b/modules/gui/skins2/src/tooltip.cpp
index 5774453..a0798b8 100644
--- a/modules/gui/skins2/src/tooltip.cpp
+++ b/modules/gui/skins2/src/tooltip.cpp
@@ -51,10 +51,7 @@ Tooltip::~Tooltip()
VarManager::instance( getIntf() )->getTooltipText().delObserver( this );
SKINS_DELETE( m_pTimer );
SKINS_DELETE( m_pOsTooltip );
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
}
@@ -106,10 +103,7 @@ void Tooltip::makeImage( const UString &rText )
int h = m_rFont.getSize() + 8;
// Create the image of the tooltip
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
m_pImage = OSFactory::instance( getIntf() )->createOSGraphics( w, h );
m_pImage->fillRect( 0, 0, w, h, 0xffffd0 );
m_pImage->drawRect( 0, 0, w, h, 0x000000 );
diff --git a/modules/gui/skins2/src/vout_window.cpp b/modules/gui/skins2/src/vout_window.cpp
index 81fabae..ea38033 100644
--- a/modules/gui/skins2/src/vout_window.cpp
+++ b/modules/gui/skins2/src/vout_window.cpp
@@ -39,10 +39,7 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
VoutWindow::~VoutWindow()
{
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
// Get the VlcProc
VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
@@ -61,10 +58,7 @@ void VoutWindow::resize( int width, int height )
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
// Recreate the image
- if( m_pImage )
- {
- delete m_pImage;
- }
+ delete m_pImage;
m_pImage = pOsFactory->createOSGraphics( width, height );
// Draw a black rectangle
m_pImage->fillRect( 0, 0, width, height, 0 );
diff --git a/modules/misc/lua/libs/playlist.c b/modules/misc/lua/libs/playlist.c
index 02d7144..0a2cf8d 100644
--- a/modules/misc/lua/libs/playlist.c
+++ b/modules/misc/lua/libs/playlist.c
@@ -280,7 +280,7 @@ static int vlclua_playlist_get( lua_State *L )
}
}
#else
-# warning Don't access playlist iternal, broken code here.
+# warning "Don't access playlist iternal, broken code here."
abort();
#endif
if( !p_item )
More information about the vlc-devel
mailing list