[Xquartz-changes] xserver: Branch 'master' - 2 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Tue May 3 10:55:08 PDT 2011


 hw/xquartz/X11Application.h |    3 ++-
 hw/xquartz/sanitizedCocoa.h |   39 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit 3ac220d6cc386c9ab9995e5b83463c40330e18c2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue May 3 10:54:09 2011 -0700

    XQuartz: prefs_copy_url and prefs_get_copy return retained objects
    
    No functional change.  This just annotates the return policy.
    
    Found-by: clang static analyzer
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 256ff18..619f32f 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -43,11 +43,12 @@
 - (void) set_controller:controller;
 - (void) set_window_menu:(NSArray *)list;
 
+- (CFPropertyListRef) prefs_get_copy:(NSString *)key CF_RETURNS_RETAINED;
 - (int) prefs_get_integer:(NSString *)key default:(int)def;
 - (const char *) prefs_get_string:(NSString *)key default:(const char *)def;
 - (float) prefs_get_float:(NSString *)key default:(float)def;
 - (int) prefs_get_boolean:(NSString *)key default:(int)def;
-- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def;
+- (NSURL *) prefs_copy_url:(NSString *)key default:(NSURL *)def NS_RETURNS_RETAINED;
 - (NSArray *) prefs_get_array:(NSString *)key;
 - (void) prefs_set_integer:(NSString *)key value:(int)value;
 - (void) prefs_set_float:(NSString *)key value:(float)value;
commit bac8d12555dd44b2139be0696629910cd4d8c782
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue May 3 10:36:19 2011 -0700

    XQuartz: Ensure that {CF,NS}_RETURNS{,_NOT}_RETAINED are defined
    
    These will be used in subsequent patches to denote proper retain counts in XQuartz
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/hw/xquartz/sanitizedCocoa.h b/hw/xquartz/sanitizedCocoa.h
index 58de64c..5a2a282 100644
--- a/hw/xquartz/sanitizedCocoa.h
+++ b/hw/xquartz/sanitizedCocoa.h
@@ -16,7 +16,8 @@
 #define BOOL         OSX_BOOL
 #define EventType    HIT_EventType
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
+#import <Foundation/Foundation.h>
 
 #undef Cursor
 #undef WindowPtr
@@ -24,4 +25,40 @@
 #undef BOOL
 #undef EventType
 
+#ifndef __has_feature
+#define __has_feature(x) 0 // Compatibility with non-clang compilers.
+#endif
+
+#ifndef NS_RETURNS_RETAINED
+#if __has_feature(attribute_ns_returns_retained)
+#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
+#else
+#define NS_RETURNS_RETAINED
+#endif
+#endif
+
+#ifndef NS_RETURNS_NOT_RETAINED
+#if __has_feature(attribute_ns_returns_not_retained)
+#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained))
+#else
+#define NS_RETURNS_NOT_RETAINED
+#endif
+#endif
+
+#ifndef CF_RETURNS_RETAINED
+#if __has_feature(attribute_cf_returns_retained)
+#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
+#else
+#define CF_RETURNS_RETAINED
+#endif
+#endif
+
+#ifndef CF_RETURNS_NOT_RETAINED
+#if __has_feature(attribute_cf_returns_not_retained)
+#define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained))
+#else
+#define CF_RETURNS_NOT_RETAINED
+#endif
+#endif
+
 #endif  /* _XQ_SANITIZED_COCOA_H_ */


More information about the Xquartz-changes mailing list