ObjFW  Diff

Differences From Artifact [66a93812a2]:

  • File src/OFDictionary.h — part of check-in [b7097a67b6] at 2015-06-14 10:45:10 on branch trunk — Add OF_NONNULL / OF_NULLABLE and use that instead

    Using __nonnull directly doesn't work on systems using glibc, as glibc
    defines __nonnull as a parameterized define. While this does not fix the
    problem of Clang introducing __nonnull even though it conflicts with
    glibc, this at least means it's possible again to compile things with
    versions of Clang that don't support __nonnull on systems with glibc. (user: js, size: 8287) [annotate] [blame] [check-ins using]

To Artifact [77b3d41c42]:

  • File src/OFDictionary.h — part of check-in [d526d938d7] at 2015-11-21 18:35:39 on branch trunk — Remove OF_NULLABLE / OF_NONNULL

    Now that Clang switched to use _Nullable and _Nonnull instead of
    __nullable / __nonnull, there is no longer a conflict with glibc, which
    means we can just define _Nullable / _Nonnull to nothing if they are not
    understood by the compiler (which did not work with __nullable /
    __nonnull due to this conflict).

    This also defines _Null_unspecified to nothing if unavailable. (user: js, size: 8269) [annotate] [blame] [check-ins using]


34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48







-
+








@class OFArray OF_GENERIC(ObjectType);

#ifdef OF_HAVE_BLOCKS
typedef void (^of_dictionary_enumeration_block_t)(id key, id object,
     bool *stop);
typedef bool (^of_dictionary_filter_block_t)(id key, id object);
typedef id OF_NONNULL (^of_dictionary_map_block_t)(id key, id object);
typedef id _Nonnull (^of_dictionary_map_block_t)(id key, id object);
#endif

/*!
 * @class OFDictionary OFDictionary.h ObjFW/OFDictionary.h
 *
 * @brief An abstract class for storing objects in a dictionary.
 *
104
105
106
107
108
109
110
111
112


113
114
115
116
117
118
119
104
105
106
107
108
109
110


111
112
113
114
115
116
117
118
119







-
-
+
+







 *
 * @param keys An array of keys
 * @param objects An array of objects
 * @param count The number of objects in the arrays
 * @return A new autoreleased OFDictionary
 */
+ (instancetype)
    dictionaryWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects
		  forKeys: (KeyType const OF_NONNULL *OF_NONNULL)keys
    dictionaryWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
		  forKeys: (KeyType const _Nonnull *_Nonnull)keys
		    count: (size_t)count;

/*!
 * @brief Creates a new OFDictionary with the specified keys objects.
 *
 * @param firstKey The first key
 * @return A new autoreleased OFDictionary
157
158
159
160
161
162
163
164
165


166
167
168
169
170
171
172
157
158
159
160
161
162
163


164
165
166
167
168
169
170
171
172







-
-
+
+







 *	  and objects.
 *
 * @param keys An array of keys
 * @param objects An array of objects
 * @param count The number of objects in the arrays
 * @return An initialized OFDictionary
 */
- initWithObjects: (ObjectType const OF_NONNULL *OF_NONNULL)objects
	  forKeys: (KeyType const OF_NONNULL *OF_NONNULL)keys
- initWithObjects: (ObjectType const _Nonnull *_Nonnull)objects
	  forKeys: (KeyType const _Nonnull *_Nonnull)keys
	    count: (size_t)count;

/*!
 * @brief Initializes an already allocated OFDictionary with the specified keys
 *	  and objects.
 *
 * @param firstKey The first key