[vlc-commits] macosx/sprefs: save 2 of 3 array allocations
Felix Paul Kühne
git at videolan.org
Sun Jun 2 12:36:30 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Jun 2 11:55:55 2019 +0200| [d951d70fba096b330c05a44ba2f3634d13ca30c7] | committer: Felix Paul Kühne
macosx/sprefs: save 2 of 3 array allocations
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d951d70fba096b330c05a44ba2f3634d13ca30c7
---
.../macosx/preferences/VLCSimplePrefsController.m | 29 ++++++++++++++++------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/modules/gui/macosx/preferences/VLCSimplePrefsController.m b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
index c9d163476c..888d039117 100644
--- a/modules/gui/macosx/preferences/VLCSimplePrefsController.m
+++ b/modules/gui/macosx/preferences/VLCSimplePrefsController.m
@@ -299,24 +299,37 @@ create_toolbar_item(NSString *itemIdent, NSString *name, NSString *desc, NSStrin
return toolbarItem;
}
+- (NSArray<NSString *> *)toolbarIdentifiers {
+ static dispatch_once_t onceToken;
+ static NSArray<NSString *> *toolbarIdentifiers = nil;
+
+ dispatch_once(&onceToken, ^{
+ toolbarIdentifiers = @[VLCIntfSettingToolbarIdentifier,
+ VLCAudioSettingToolbarIdentifier,
+ VLCVideoSettingToolbarIdentifier,
+ VLCOSDSettingToolbarIdentifier,
+ VLCInputSettingToolbarIdentifier,
+ VLCMediaLibrarySettingToolbarIdentifier,
+ VLCHotkeysSettingToolbarIdentifier,
+ NSToolbarFlexibleSpaceItemIdentifier];
+ });
+
+ return toolbarIdentifiers;
+}
+
- (NSArray *)toolbarDefaultItemIdentifiers: (NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects:VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
- VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCMediaLibrarySettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier,
- NSToolbarFlexibleSpaceItemIdentifier, nil];
+ return [self toolbarIdentifiers];
}
- (NSArray *)toolbarAllowedItemIdentifiers: (NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects:VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
- VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCMediaLibrarySettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier,
- NSToolbarFlexibleSpaceItemIdentifier, nil];
+ return [self toolbarIdentifiers];
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
- return [NSArray arrayWithObjects:VLCIntfSettingToolbarIdentifier, VLCAudioSettingToolbarIdentifier, VLCVideoSettingToolbarIdentifier,
- VLCOSDSettingToolbarIdentifier, VLCInputSettingToolbarIdentifier, VLCMediaLibrarySettingToolbarIdentifier, VLCHotkeysSettingToolbarIdentifier, nil];
+ return [self toolbarIdentifiers];
}
- (void)initStrings
More information about the vlc-commits
mailing list