[vlc-devel] commit: Skins2: Drop another small heap allocation in favour of the stack. (JP Dinger )
git version control
git at videolan.org
Sat Dec 5 22:35:08 CET 2009
vlc | branch: master | JP Dinger <jpd at videolan.org> | Fri Nov 20 16:00:22 2009 +0100| [dc4b469e50c585d94d7ca7f59918546f29b36cd5] | committer: JP Dinger
Skins2: Drop another small heap allocation in favour of the stack.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dc4b469e50c585d94d7ca7f59918546f29b36cd5
---
modules/gui/skins2/vars/volume.cpp | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/modules/gui/skins2/vars/volume.cpp b/modules/gui/skins2/vars/volume.cpp
index a965dbd..075057d 100644
--- a/modules/gui/skins2/vars/volume.cpp
+++ b/modules/gui/skins2/vars/volume.cpp
@@ -60,11 +60,8 @@ string Volume::getAsStringPercent() const
{
int value = (int)(100. * VarPercent::get());
// 0 <= value <= 100, so we need 4 chars
- char *str = new char[4];
+ char str[4];
snprintf( str, 4, "%d", value );
- string ret = str;
- delete[] str;
-
- return ret;
+ return string(str);
}
More information about the vlc-devel
mailing list