[vlc-devel] [vlc-commits] macosx: change media type constants from char* to NSString*
david.fuhrmann at googlemail.com
Sat Aug 25 16:04:54 CEST 2012
Am 25.08.2012 um 00:54 schrieb Felix Paul Kühne <fkuehne.videolan at gmail.com>:
> Hello David,
> On 25.08.2012, at 00:45, David Fuhrmann <git at videolan.org> wrote:
>> vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Aug 23 12:51:47 2012 +0200| [0308762a6cf2e211f4ea6ed8c64952156accf4d4] | committer: David Fuhrmann
>> macosx: change media type constants from char* to NSString*
> May I ask for the rationale behind this patch?
> NSString is bigger in memory and slower in comparison than plain chars, so I don't really see the benefit (prove me wrong!).
IMO, the previous code was really hackish and misleading. They was no real chars comparison here, just the comparison of the pointers to the static allocated memory. It worked because the compiler was smart enough to allocate only one memory place for each media type string, but I'm not sure if thats guaranteed by every compiler.
So, I wanted to do it more clear, and I don't wanted to use c-string comparison in an Obj-C-plugin, so I thought that NSString would be suitable. Actually, I planned to use int or something like that, but for the second patch I needed an id object. And now, its consistent with the way the column types are declared in playlist.h.
More information about the vlc-devel