ObjFW  Check-in [1a9f18064e]

Overview
Comment:Don't reserve ivars for class clusters

Subclasses of these often inherit methods (e.g. mutable class from
immutable class), which breaks.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1a9f18064ec69fb58a83ecf9b5803c376235cec75a6f98dff5b8510f1b6e6c36
User & Date: js on 2019-09-30 21:27:19
Other Links: manifest | tags
Context
2019-09-30
22:46
Add OFDNSResponse check-in: da8eb2d43a user: js tags: trunk
21:27
Don't reserve ivars for class clusters check-in: 1a9f18064e user: js tags: trunk
2019-09-29
20:53
Reduce ivar scopes check-in: e0a330b377 user: js tags: trunk
Changes

Modified src/OFArray.h from [5c29d52144] to [3219a87afc].

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 * @brief An abstract class for storing objects in an array.
 *
 * @note Subclasses must implement @ref count and @ref objectAtIndex:.
 */
@interface OFArray OF_GENERIC(ObjectType): OFObject <OFCopying,
    OFMutableCopying, OFCollection, OFSerialization, OFJSONRepresentation,
    OFMessagePackRepresentation>
{
	OF_RESERVE_IVARS(4)
}

#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
/*!
 * @brief The objects of the array as a C array.
 *
 * The result is valid until the autorelease pool is released. If you want to







<
<
<
<







88
89
90
91
92
93
94




95
96
97
98
99
100
101
 * @brief An abstract class for storing objects in an array.
 *
 * @note Subclasses must implement @ref count and @ref objectAtIndex:.
 */
@interface OFArray OF_GENERIC(ObjectType): OFObject <OFCopying,
    OFMutableCopying, OFCollection, OFSerialization, OFJSONRepresentation,
    OFMessagePackRepresentation>




#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
/*!
 * @brief The objects of the array as a C array.
 *
 * The result is valid until the autorelease pool is released. If you want to

Modified src/OFCountedSet.h from [2ecebf0177] to [4abf7110e4].

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 *	 of @ref OFSet and @ref OFMutableSet that need to be implemented.
 */
@interface OFCountedSet OF_GENERIC(ObjectType):
    OFMutableSet OF_GENERIC(ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief Returns how often the object is in the set.
 *
 * @return How often the object is in the set
 */
- (size_t)countForObject: (ObjectType)object;








<
<
<
<







44
45
46
47
48
49
50




51
52
53
54
55
56
57
 *	 of @ref OFSet and @ref OFMutableSet that need to be implemented.
 */
@interface OFCountedSet OF_GENERIC(ObjectType):
    OFMutableSet OF_GENERIC(ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif




/*!
 * @brief Returns how often the object is in the set.
 *
 * @return How often the object is in the set
 */
- (size_t)countForObject: (ObjectType)object;

Modified src/OFDictionary.h from [0bdd64401a] to [2fc9d82347].

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@interface OFDictionary OF_GENERIC(KeyType, ObjectType): OFObject <OFCopying,
    OFMutableCopying, OFCollection, OFSerialization, OFJSONRepresentation,
    OFMessagePackRepresentation>
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define KeyType id
# define ObjectType id
#endif
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief An array of all keys.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(KeyType) *allKeys;

/*!
 * @brief An array of all objects.







<
<
<
<







58
59
60
61
62
63
64




65
66
67
68
69
70
71
@interface OFDictionary OF_GENERIC(KeyType, ObjectType): OFObject <OFCopying,
    OFMutableCopying, OFCollection, OFSerialization, OFJSONRepresentation,
    OFMessagePackRepresentation>
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define KeyType id
# define ObjectType id
#endif




/*!
 * @brief An array of all keys.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(KeyType) *allKeys;

/*!
 * @brief An array of all objects.

Modified src/OFMutableArray.h from [34a09a316e] to [97f317cd8c].

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 *	 @ref replaceObjectAtIndex:withObject:, @ref removeObjectAtIndex: as
 *	 well as all methods of @ref OFArray that need to be implemented.
 */
@interface OFMutableArray OF_GENERIC(ObjectType): OFArray OF_GENERIC(ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief Creates a new OFMutableArray with enough memory to hold the specified
 *	  number of objects.
 *
 * @param capacity The initial capacity for the OFMutableArray
 * @return A new autoreleased OFMutableArray
 */







<
<
<
<







42
43
44
45
46
47
48




49
50
51
52
53
54
55
 *	 @ref replaceObjectAtIndex:withObject:, @ref removeObjectAtIndex: as
 *	 well as all methods of @ref OFArray that need to be implemented.
 */
@interface OFMutableArray OF_GENERIC(ObjectType): OFArray OF_GENERIC(ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif




/*!
 * @brief Creates a new OFMutableArray with enough memory to hold the specified
 *	  number of objects.
 *
 * @param capacity The initial capacity for the OFMutableArray
 * @return A new autoreleased OFMutableArray
 */

Modified src/OFMutableDictionary.h from [e6550bad92] to [43070c71d1].

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 */
@interface OFMutableDictionary OF_GENERIC(KeyType, ObjectType):
    OFDictionary OF_GENERIC(KeyType, ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define KeyType id
# define ObjectType id
#endif
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief Creates a new OFMutableDictionary with enough memory to hold the
 *	  specified number of objects.
 *
 * @param capacity The initial capacity for the OFMutableDictionary
 * @return A new autoreleased OFMutableDictionary
 */







<
<
<
<







43
44
45
46
47
48
49




50
51
52
53
54
55
56
 */
@interface OFMutableDictionary OF_GENERIC(KeyType, ObjectType):
    OFDictionary OF_GENERIC(KeyType, ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define KeyType id
# define ObjectType id
#endif




/*!
 * @brief Creates a new OFMutableDictionary with enough memory to hold the
 *	  specified number of objects.
 *
 * @param capacity The initial capacity for the OFMutableDictionary
 * @return A new autoreleased OFMutableDictionary
 */

Modified src/OFMutableSet.h from [ec355518ec] to [9b1889a14f].

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 * @note Subclasses must implement @ref addObject:, @ref removeObject: as well
 *	 as all methods of @ref OFSet that need to be implemented.
 */
@interface OFMutableSet OF_GENERIC(ObjectType): OFSet OF_GENERIC(ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief Creates a new OFMutableSet with enough memory to hold the specified
 *	  number of objects.
 *
 * @param capacity The initial capacity for the OFMutableSet
 * @return A new autoreleased OFMutableSet
 */







<
<
<
<







27
28
29
30
31
32
33




34
35
36
37
38
39
40
 * @note Subclasses must implement @ref addObject:, @ref removeObject: as well
 *	 as all methods of @ref OFSet that need to be implemented.
 */
@interface OFMutableSet OF_GENERIC(ObjectType): OFSet OF_GENERIC(ObjectType)
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif




/*!
 * @brief Creates a new OFMutableSet with enough memory to hold the specified
 *	  number of objects.
 *
 * @param capacity The initial capacity for the OFMutableSet
 * @return A new autoreleased OFMutableSet
 */

Modified src/OFMutableString.h from [721df996ad] to [b9fb78b26e].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

/*!
 * @class OFMutableString OFString.h ObjFW/OFString.h
 *
 * @brief A class for storing and modifying strings.
 */
@interface OFMutableString: OFString
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief Sets the character at the specified index.
 *
 * @param character The character to set
 * @param index The index where to set the character
 */
- (void)setCharacter: (of_unichar_t)character







<
<
<
<







21
22
23
24
25
26
27




28
29
30
31
32
33
34

/*!
 * @class OFMutableString OFString.h ObjFW/OFString.h
 *
 * @brief A class for storing and modifying strings.
 */
@interface OFMutableString: OFString




/*!
 * @brief Sets the character at the specified index.
 *
 * @param character The character to set
 * @param index The index where to set the character
 */
- (void)setCharacter: (of_unichar_t)character

Modified src/OFSet.h from [f80d14d494] to [9f71c62224].

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 *	 @ref objectEnumerator.
 */
@interface OFSet OF_GENERIC(ObjectType): OFObject <OFCollection, OFCopying,
    OFMutableCopying, OFSerialization>
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief An array of all objects in the set.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *allObjects;

/*!
 * @brief An arbitrary object in the set.







<
<
<
<







65
66
67
68
69
70
71




72
73
74
75
76
77
78
 *	 @ref objectEnumerator.
 */
@interface OFSet OF_GENERIC(ObjectType): OFObject <OFCollection, OFCopying,
    OFMutableCopying, OFSerialization>
#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
# define ObjectType id
#endif




/*!
 * @brief An array of all objects in the set.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(ObjectType) *allObjects;

/*!
 * @brief An arbitrary object in the set.

Modified src/OFString.h from [6ace318746] to [122f8a653b].

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*!
 * @class OFString OFString.h ObjFW/OFString.h
 *
 * @brief A class for handling strings.
 */
@interface OFString: OFObject <OFCopying, OFMutableCopying, OFComparing,
    OFSerialization, OFJSONRepresentation, OFMessagePackRepresentation>
{
	OF_RESERVE_IVARS(4)
}

/*!
 * @brief The length of the string in Unicode codepoints.
 */
@property (readonly, nonatomic) size_t length;

/*!
 * @brief The OFString as a UTF-8 encoded C string.







<
<
<
<







117
118
119
120
121
122
123




124
125
126
127
128
129
130
/*!
 * @class OFString OFString.h ObjFW/OFString.h
 *
 * @brief A class for handling strings.
 */
@interface OFString: OFObject <OFCopying, OFMutableCopying, OFComparing,
    OFSerialization, OFJSONRepresentation, OFMessagePackRepresentation>




/*!
 * @brief The length of the string in Unicode codepoints.
 */
@property (readonly, nonatomic) size_t length;

/*!
 * @brief The OFString as a UTF-8 encoded C string.