src/video/cocoa/SDL_cocoaclipboard.m
changeset 9087 eef2e43f60d1
parent 8986 1c81316ac642
child 9619 b94b6d0bff0f
     1.1 --- a/src/video/cocoa/SDL_cocoaclipboard.m	Sun Aug 17 14:57:52 2014 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoaclipboard.m	Sun Aug 17 15:07:00 2014 -0700
     1.3 @@ -37,34 +37,28 @@
     1.4  
     1.5  int
     1.6  Cocoa_SetClipboardText(_THIS, const char *text)
     1.7 +{ @autoreleasepool
     1.8  {
     1.9      SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    1.10 -    NSAutoreleasePool *pool;
    1.11      NSPasteboard *pasteboard;
    1.12      NSString *format = GetTextFormat(_this);
    1.13  
    1.14 -    pool = [[NSAutoreleasePool alloc] init];
    1.15 -
    1.16      pasteboard = [NSPasteboard generalPasteboard];
    1.17      data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil];
    1.18      [pasteboard setString:[NSString stringWithUTF8String:text] forType:format];
    1.19  
    1.20 -    [pool release];
    1.21 -
    1.22      return 0;
    1.23 -}
    1.24 +}}
    1.25  
    1.26  char *
    1.27  Cocoa_GetClipboardText(_THIS)
    1.28 +{ @autoreleasepool
    1.29  {
    1.30 -    NSAutoreleasePool *pool;
    1.31      NSPasteboard *pasteboard;
    1.32      NSString *format = GetTextFormat(_this);
    1.33      NSString *available;
    1.34      char *text;
    1.35  
    1.36 -    pool = [[NSAutoreleasePool alloc] init];
    1.37 -
    1.38      pasteboard = [NSPasteboard generalPasteboard];
    1.39      available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]];
    1.40      if ([available isEqualToString:format]) {
    1.41 @@ -82,10 +76,8 @@
    1.42          text = SDL_strdup("");
    1.43      }
    1.44  
    1.45 -    [pool release];
    1.46 -
    1.47      return text;
    1.48 -}
    1.49 +}}
    1.50  
    1.51  SDL_bool
    1.52  Cocoa_HasClipboardText(_THIS)
    1.53 @@ -101,13 +93,11 @@
    1.54  
    1.55  void
    1.56  Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data)
    1.57 +{ @autoreleasepool
    1.58  {
    1.59 -    NSAutoreleasePool *pool;
    1.60      NSPasteboard *pasteboard;
    1.61      NSInteger count;
    1.62  
    1.63 -    pool = [[NSAutoreleasePool alloc] init];
    1.64 -
    1.65      pasteboard = [NSPasteboard generalPasteboard];
    1.66      count = [pasteboard changeCount];
    1.67      if (count != data->clipboard_count) {
    1.68 @@ -116,9 +106,7 @@
    1.69          }
    1.70          data->clipboard_count = count;
    1.71      }
    1.72 -
    1.73 -    [pool release];
    1.74 -}
    1.75 +}}
    1.76  
    1.77  #endif /* SDL_VIDEO_DRIVER_COCOA */
    1.78