r31954 - trunk/stream/stream_bd.c
Author: reimar Date: Tue Aug 10 15:28:18 2010 New Revision: 31954 Log: Avoid pointless additional string pointers. Modified: trunk/stream/stream_bd.c Modified: trunk/stream/stream_bd.c ============================================================================== --- trunk/stream/stream_bd.c Tue Aug 10 15:26:19 2010 (r31953) +++ trunk/stream/stream_bd.c Tue Aug 10 15:28:18 2010 (r31954) @@ -31,10 +31,10 @@ #include "stream.h" static const int BD_UNIT_SIZE = 6144; -static const char *BD_UKF_PATH = "/%s/AACS/Unit_Key_RO.inf"; -static const char *BD_M2TS_PATH = "/%s/BDMV/STREAM/%05d.m2ts"; +static const char BD_UKF_PATH[] = "/%s/AACS/Unit_Key_RO.inf"; +static const char BD_M2TS_PATH[] = "/%s/BDMV/STREAM/%05d.m2ts"; -static const char *DEFAULT_BD_DEVICE = "/mnt/bd"; +static const char DEFAULT_BD_DEVICE[] = "/mnt/bd"; static const struct stream_priv_s { int title;
On Tue, Aug 10, 2010 at 03:28:18PM +0200, reimar wrote:
Log: Avoid pointless additional string pointers.
--- trunk/stream/stream_bd.c Tue Aug 10 15:26:19 2010 (r31953) +++ trunk/stream/stream_bd.c Tue Aug 10 15:28:18 2010 (r31954) @@ -31,10 +31,10 @@
-static const char *BD_UKF_PATH = "/%s/AACS/Unit_Key_RO.inf"; -static const char *BD_M2TS_PATH = "/%s/BDMV/STREAM/%05d.m2ts"; +static const char BD_UKF_PATH[] = "/%s/AACS/Unit_Key_RO.inf"; +static const char BD_M2TS_PATH[] = "/%s/BDMV/STREAM/%05d.m2ts";
I'm curious, what are the advantages of this change? Diego
On Thu, Aug 12, 2010 at 01:31:42PM +0200, Diego Biurrun wrote:
On Tue, Aug 10, 2010 at 03:28:18PM +0200, reimar wrote:
Log: Avoid pointless additional string pointers.
--- trunk/stream/stream_bd.c Tue Aug 10 15:26:19 2010 (r31953) +++ trunk/stream/stream_bd.c Tue Aug 10 15:28:18 2010 (r31954) @@ -31,10 +31,10 @@
-static const char *BD_UKF_PATH = "/%s/AACS/Unit_Key_RO.inf"; -static const char *BD_M2TS_PATH = "/%s/BDMV/STREAM/%05d.m2ts"; +static const char BD_UKF_PATH[] = "/%s/AACS/Unit_Key_RO.inf"; +static const char BD_M2TS_PATH[] = "/%s/BDMV/STREAM/%05d.m2ts";
I'm curious, what are the advantages of this change?
With optimizations probably none, but if the compiler did not optimize or it wasn't static, it would save the memory for a dereference and doing the actual dereference. In particular since the pointer themselves would not have been stored in rodata like this due to a missing const, making this solution also simpler.
participants (3)
-
Diego Biurrun -
reimar -
Reimar Döffinger