[vlc-commits] dbus: prefer char[][] to *char[]

Rafaël Carré git at videolan.org
Tue Aug 9 03:52:39 CEST 2011


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon Aug  8 21:49:08 2011 -0400| [52957d059bb40fcbd0027266b92714987eeaa9be] | committer: Rafaël Carré

dbus: prefer char[][] to *char[]

makes data smaller:
 no need to store pointers to each item of the array

char *x[] = { "a", "b", "c" };
memory looks like => "a" "b" "c" (&x) &a &b &c

char x[][2] = { "a", "b", "c" };
memory looks like => (&x) "a" "b" "c"

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=52957d059bb40fcbd0027266b92714987eeaa9be
---

 modules/control/dbus/dbus_root.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/control/dbus/dbus_root.c b/modules/control/dbus/dbus_root.c
index 268a212..75b43cb 100644
--- a/modules/control/dbus/dbus_root.c
+++ b/modules/control/dbus/dbus_root.c
@@ -37,13 +37,13 @@
 #include "dbus_root.h"
 #include "dbus_common.h"
 
-static const char* ppsz_supported_uri_schemes[] = {
+static const char const ppsz_supported_uri_schemes[][9] = {
     "file", "http", "https", "rtsp", "realrtsp", "pnm", "ftp", "mtp", "smb",
     "mms", "mmsu", "mmst", "mmsh", "unsv", "itpc", "icyx", "rtmp", "rtp",
     "dccp", "dvd", "vcd", "vcdx"
 };
 
-static const char* ppsz_supported_mime_types[] = {
+static const char const ppsz_supported_mime_types[][26] = {
     "audio/mpeg", "audio/x-mpeg",
     "video/mpeg", "video/x-mpeg",
     "video/mpeg-system", "video/x-mpeg-system",



More information about the vlc-commits mailing list