[DVDnav-discuss] [PATCH] Make vmcmd table constants

Diego 'Flameeyes' Pettenò flameeyes at gmail.com
Sat Jan 5 02:42:08 CET 2008


The attached patch replaces the tables in vm/vmcmd.c with constant
tables. The constant tables will be moved to .rodata, so they'll use
less memory (they'll be memory mapped from the library file - or from
the executable if using static library).

Please note that NULL can't be used with arrays of arrays so they were
replaced by empty literals ("") and the checks were changed accordingly.

You might find a waste of space in system_reg_abbr_table, but that's
actually minimal and only present for 32-bit (or less) systems, as on
64-bit systems the size of the pointer is 8 like the size of the empty
strings I've added.

system_reg_table has too varied strings, so using an array of array
there might be a bit of a waste because of padding. Maybe using glib's
way (with two arrays, of characters with the strings and one of offsets)
could be an option, considering they are used just in one place; I'll
consider it for a new patch.

For more details about the reasoning for using arrays of arrays rather
than arrays of strings, I'd point to two blog entries I've written
(tinyurl'd or the lines would be way too long for my mailer to work with
:P): http://tinyurl.com/34vryr and http://tinyurl.com/3aa2ll .

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libdvdnav-constantise.patch
Type: text/x-patch
Size: 3186 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/dvdnav-discuss/attachments/20080105/584782dd/attachment.bin>
-------------- next part --------------

-- 
Diego "Flameeyes" Petten?
http://farragut.flameeyes.is-a-geek.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/dvdnav-discuss/attachments/20080105/584782dd/attachment.pgp>


More information about the DVDnav-discuss mailing list