From eb28beff1b3f191438da105569965b47fad622fc Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 5 May 2018 19:46:57 -0400 Subject: [PATCH] Migrated alloc.m functions. --- darwin/OLD_uipriv_darwin.h | 4 ---- darwin/alloc.m | 10 +++++----- darwin/button.m | 2 +- darwin/checkbox.m | 2 +- darwin/combobox.m | 2 +- darwin/editablecombo.m | 2 +- darwin/entry.m | 2 +- darwin/main.m | 4 ++-- darwin/slider.m | 2 +- darwin/uipriv_darwin.h | 5 +++++ darwin/window.m | 2 +- 11 files changed, 19 insertions(+), 18 deletions(-) diff --git a/darwin/OLD_uipriv_darwin.h b/darwin/OLD_uipriv_darwin.h index 5c277669..53898c6c 100644 --- a/darwin/OLD_uipriv_darwin.h +++ b/darwin/OLD_uipriv_darwin.h @@ -1,7 +1,3 @@ -// alloc.m -extern NSMutableArray *delegates; -extern void initAlloc(void); -extern void uninitAlloc(void); // autolayout.m extern NSLayoutConstraint *mkConstraint(id view1, NSLayoutAttribute attr1, NSLayoutRelation relation, id view2, NSLayoutAttribute attr2, CGFloat multiplier, CGFloat c, NSString *desc); diff --git a/darwin/alloc.m b/darwin/alloc.m index fbafc153..e20f67f3 100644 --- a/darwin/alloc.m +++ b/darwin/alloc.m @@ -3,12 +3,12 @@ #import "uipriv_darwin.h" static NSMutableArray *allocations; -NSMutableArray *delegates; +NSMutableArray *uiprivDelegates; -void initAlloc(void) +void uiprivInitAlloc(void) { allocations = [NSMutableArray new]; - delegates = [NSMutableArray new]; + uiprivDelegates = [NSMutableArray new]; } #define UINT8(p) ((uint8_t *) (p)) @@ -20,12 +20,12 @@ void initAlloc(void) #define CCHAR(p) ((const char **) (p)) #define TYPE(p) CCHAR(UINT8(p) + sizeof (size_t)) -void uninitAlloc(void) +void uiprivUninitAlloc(void) { NSMutableString *str; NSValue *v; - [delegates release]; + [uiprivDelegates release]; if ([allocations count] == 0) { [allocations release]; return; diff --git a/darwin/button.m b/darwin/button.m index 7256007b..c3a6e075 100644 --- a/darwin/button.m +++ b/darwin/button.m @@ -104,7 +104,7 @@ uiButton *uiNewButton(const char *text) if (buttonDelegate == nil) { buttonDelegate = [[buttonDelegateClass new] autorelease]; - [delegates addObject:buttonDelegate]; + [uiprivDelegates addObject:buttonDelegate]; } [buttonDelegate registerButton:b]; uiButtonOnClicked(b, defaultOnClicked, NULL); diff --git a/darwin/checkbox.m b/darwin/checkbox.m index c844718e..d5a3d6e0 100644 --- a/darwin/checkbox.m +++ b/darwin/checkbox.m @@ -120,7 +120,7 @@ uiCheckbox *uiNewCheckbox(const char *text) if (checkboxDelegate == nil) { checkboxDelegate = [[checkboxDelegateClass new] autorelease]; - [delegates addObject:checkboxDelegate]; + [uiprivDelegates addObject:checkboxDelegate]; } [checkboxDelegate registerCheckbox:c]; uiCheckboxOnToggled(c, defaultOnToggled, NULL); diff --git a/darwin/combobox.m b/darwin/combobox.m index 7af7b4a6..cc2f330a 100644 --- a/darwin/combobox.m +++ b/darwin/combobox.m @@ -136,7 +136,7 @@ uiCombobox *uiNewCombobox(void) if (comboboxDelegate == nil) { comboboxDelegate = [[comboboxDelegateClass new] autorelease]; - [delegates addObject:comboboxDelegate]; + [uiprivDelegates addObject:comboboxDelegate]; } [comboboxDelegate registerCombobox:c]; uiComboboxOnSelected(c, defaultOnSelected, NULL); diff --git a/darwin/editablecombo.m b/darwin/editablecombo.m index 305f503f..7b1a1134 100644 --- a/darwin/editablecombo.m +++ b/darwin/editablecombo.m @@ -177,7 +177,7 @@ uiEditableCombobox *uiNewEditableCombobox(void) if (comboboxDelegate == nil) { comboboxDelegate = [[editableComboboxDelegateClass new] autorelease]; - [delegates addObject:comboboxDelegate]; + [uiprivDelegates addObject:comboboxDelegate]; } [comboboxDelegate registerCombobox:c]; uiEditableComboboxOnChanged(c, defaultOnChanged, NULL); diff --git a/darwin/entry.m b/darwin/entry.m index dc311ec6..99630264 100644 --- a/darwin/entry.m +++ b/darwin/entry.m @@ -216,7 +216,7 @@ static uiEntry *finishNewEntry(Class class) if (entryDelegate == nil) { entryDelegate = [[entryDelegateClass new] autorelease]; - [delegates addObject:entryDelegate]; + [uiprivDelegates addObject:entryDelegate]; } [entryDelegate registerEntry:e]; uiEntryOnChanged(e, defaultOnChanged, NULL); diff --git a/darwin/main.m b/darwin/main.m index cb225255..b11beb68 100644 --- a/darwin/main.m +++ b/darwin/main.m @@ -119,7 +119,7 @@ const char *uiInit(uiInitOptions *o) delegate = [uiprivAppDelegate new]; [uiprivNSApp() setDelegate:delegate]; - initAlloc(); + uiprivInitAlloc(); loadFutures(); loadUndocumented(); @@ -148,7 +148,7 @@ void uiUninit(void) [delegate release]; [uiprivNSApp() setDelegate:nil]; [app release]; - uninitAlloc(); + uiprivUninitAlloc(); } } diff --git a/darwin/slider.m b/darwin/slider.m index a959264b..6f5c5a76 100644 --- a/darwin/slider.m +++ b/darwin/slider.m @@ -138,7 +138,7 @@ uiSlider *uiNewSlider(int min, int max) if (sliderDelegate == nil) { sliderDelegate = [[sliderDelegateClass new] autorelease]; - [delegates addObject:sliderDelegate]; + [uiprivDelegates addObject:sliderDelegate]; } [sliderDelegate registerSlider:s]; uiSliderOnChanged(s, defaultOnChanged, NULL); diff --git a/darwin/uipriv_darwin.h b/darwin/uipriv_darwin.h index 17723511..ce79ac42 100644 --- a/darwin/uipriv_darwin.h +++ b/darwin/uipriv_darwin.h @@ -82,4 +82,9 @@ extern NSTextField *uiprivNewEditableTextField(void); @end extern uiWindow *uiprivWindowFromNSWindow(NSWindow *); +// alloc.m +extern NSMutableArray *uiprivDelegates; +extern void uiprivInitAlloc(void); +extern void uiprivUninitAlloc(void); + #import "OLD_uipriv_darwin.h" diff --git a/darwin/window.m b/darwin/window.m index 0ade558d..f40df704 100644 --- a/darwin/window.m +++ b/darwin/window.m @@ -387,7 +387,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar) if (windowDelegate == nil) { windowDelegate = [[windowDelegateClass new] autorelease]; - [delegates addObject:windowDelegate]; + [uiprivDelegates addObject:windowDelegate]; } [windowDelegate registerWindow:w]; uiWindowOnClosing(w, defaultOnClosing, NULL);