23
23
# include <limits.h>
24
24
#endif
25
25
26
- #ifdef FEAT_GUI_MACVIM
27
- #include <objc/objc-runtime.h> /* for objc_*() and sel_*() */
28
- #endif
29
-
30
26
/* Maximum number of commands from + or -c arguments. */
31
27
#define MAX_ARG_CMDS 10
32
28
180
176
// Cocoa needs an NSAutoreleasePool in place or it will leak memory.
181
177
// This particular pool will hold autorelease objects created during
182
178
// initialization.
183
- id autoreleasePool = objc_msgSend (objc_msgSend (
184
- objc_getClass ("NSAutoreleasePool" ),sel_getUid ("alloc" )
185
- ), sel_getUid ("init" ));
179
+ void * autoreleasePool = gui_macvim_new_autoreleasepool ();
186
180
#endif
187
181
188
182
/*
@@ -1066,13 +1060,11 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
1066
1060
#ifdef FEAT_GUI_MACVIM
1067
1061
// The autorelease pool might have filled up quite a bit during
1068
1062
// initialization, so purge it before entering the main loop.
1069
- objc_msgSend (autoreleasePool , sel_getUid ( "release" ) );
1063
+ gui_macvim_release_autoreleasepool (autoreleasePool );
1070
1064
1071
1065
// The main loop sets up its own autorelease pool, but to be safe we still
1072
1066
// realloc this one here.
1073
- autoreleasePool = objc_msgSend (objc_msgSend (
1074
- objc_getClass ("NSAutoreleasePool" ),sel_getUid ("alloc" )
1075
- ), sel_getUid ("init" ));
1067
+ autoreleasePool = gui_macvim_new_autoreleasepool ();
1076
1068
#endif
1077
1069
1078
1070
/*
@@ -1081,7 +1073,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
1081
1073
main_loop (FALSE, FALSE);
1082
1074
1083
1075
#ifdef FEAT_GUI_MACVIM
1084
- objc_msgSend (autoreleasePool , sel_getUid ( "release" ) );
1076
+ gui_macvim_release_autoreleasepool (autoreleasePool );
1085
1077
#endif
1086
1078
1087
1079
return 0 ;
@@ -1152,9 +1144,7 @@ main_loop(cmdwin, noexmode)
1152
1144
#ifdef FEAT_GUI_MACVIM
1153
1145
// Cocoa needs an NSAutoreleasePool in place or it will leak memory.
1154
1146
// This particular pool gets released once every loop.
1155
- id autoreleasePool = objc_msgSend (objc_msgSend (
1156
- objc_getClass ("NSAutoreleasePool" ),sel_getUid ("alloc" )
1157
- ), sel_getUid ("init" ));
1147
+ void * autoreleasePool = gui_macvim_new_autoreleasepool ();
1158
1148
#endif
1159
1149
1160
1150
if (stuff_empty ())
@@ -1404,7 +1394,7 @@ main_loop(cmdwin, noexmode)
1404
1394
#ifdef FEAT_GUI_MACVIM
1405
1395
// TODO! Make sure there are no continue statements that will cause
1406
1396
// this not to be called or MacVim will leak memory!
1407
- objc_msgSend (autoreleasePool , sel_getUid ( "release" ) );
1397
+ gui_macvim_release_autoreleasepool (autoreleasePool );
1408
1398
#endif
1409
1399
}
1410
1400
}
0 commit comments