ObjFW  Diff

Differences From Artifact [03ba48a726]:

To Artifact [a855386419]:

  • File src/OFMapTable.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: 7574) [annotate] [blame] [check-ins using]


24
25
26
27
28
29
30
31

32
33

34
35

36
37
38

39
40
41
42
43
44
45
24
25
26
27
28
29
30

31
32

33
34

35
36


37
38
39
40
41
42
43
44







-
+

-
+

-
+

-
-
+







/*!
 * @struct of_map_table_functions_t OFMapTable.h ObjFW/OFMapTable.h
 *
 * @brief A struct describing the functions to be used by the map table.
 */
typedef struct {
	/// The function to retain keys / values
	__nonnull void* (*__nullable retain)(__nonnull void *value);
	void *OF_NONNULL (*OF_NULLABLE retain)(void *value);
	/// The function to release keys / values
	void (*__nullable release)(__nonnull void *value);
	void (*OF_NULLABLE release)(void *value);
	/// The function to hash keys
	uint32_t (*__nullable hash)(__nonnull void *value);
	uint32_t (*OF_NULLABLE hash)(void *value);
	/// The function to compare keys / values
	bool (*__nullable equal)(__nonnull void *value1,
	    __nonnull void *value2);
	bool (*OF_NULLABLE equal)(void *value1, void *value2);
} of_map_table_functions_t;

#ifdef OF_HAVE_BLOCKS
/*!
 * @brief A block for enumerating an OFMapTable.
 *
 * @param key The current key
53
54
55
56
57
58
59
60


61
62
63
64
65
66
67
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
67







-
+
+







/*!
 * @brief A block for replacing values in an OFMapTable.
 *
 * @param key The key of the value to replace
 * @param value The value to replace
 * @return The value to replace the value with
 */
typedef __nonnull void* (^of_map_table_replace_block_t)(void *key, void *value);
typedef void *OF_NONNULL (^of_map_table_replace_block_t)(
    void *key, void *value);
#endif

@class OFMapTableEnumerator;

/*!
 * @class OFMapTable OFMapTable.h ObjFW/OFMapTable.h
 *