[vlc-devel] [vlc-commits] macosx: change media type constants from char* to NSString*

Felix Paul Kühne fkuehne.videolan at gmail.com
Sat Aug 25 17:59:47 CEST 2012


Hi David,

On 25.08.2012, at 16:04, David Fuhrmann <david.fuhrmann at googlemail.com> wrote:

> 
> 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.
No, it's definitely not :D
I saw this after writing this mail TBH. Otherwise, I wouldn't have heckled ;)

> 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.

Ok, makes sense to me.

Thanks!

Felix


More information about the vlc-devel mailing list