Comment: | Document the block types.
This also removes "bool *stop" from some blocks where it does not make |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e8473b9db87ee5ba6e7ed6c4867c5627 |
User & Date: | js on 2013-03-08 22:44:07 |
Other Links: | manifest | tags |
2013-03-08
| ||
23:00 | Take advantage of realloc(NULL, n) being defined. check-in: e8d6ca16e7 user: js tags: trunk | |
22:44 | Document the block types. check-in: e8473b9db8 user: js tags: trunk | |
2013-03-04
| ||
18:32 | Make old GCCs happy. check-in: 0bb3fc850a user: js tags: trunk | |
Modified src/OFArray.h from [ecde9fadf5] to [b961e68793].
︙ | |||
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + | #import "OFObject.h" #import "OFCollection.h" #import "OFEnumerator.h" #import "OFSerialization.h" #import "OFJSONRepresentation.h" #import "OFBinaryPackRepresentation.h" /*! @file */ @class OFString; enum { OF_SORT_OPTIONS_DESCENDING = 1 }; #ifdef OF_HAVE_BLOCKS /*! * @brief A block for enumerating an OFArray. * * @param object The current object * @param index The index of the current object * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^of_array_enumeration_block_t)(id object, size_t index, bool *stop); /*! * @brief A block for filtering an OFArray. * * @param object The object to inspect * @param index The index of the object to inspect * @return Whether the object should be in the filtered array */ |
︙ |
Modified src/OFCountedSet.h from [6a5aa970ef] to [749e359563].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + + + + + + + + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFSet.h" /*! @file */ #ifdef OF_HAVE_BLOCKS /*! * @brief A block for enumerating an OFCountedSet. * * @param object The current object * @param count The count of the object * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^of_counted_set_enumeration_block_t)(id object, size_t count, bool *stop); #endif /*! * @brief An abstract class for a mutable unordered set of objects, counting how * often it contains an object. |
︙ |
Modified src/OFHTTPServer.h from [37d7fcda08] to [ffe70c28fb].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + | @optional #endif /*! * @brief This method is called when the HTTP server's listening socket * encountered an exception. * * @param server The HTTP server which encountered an exception |
︙ |
Modified src/OFMapTable.h from [e819467858] to [aa28d14053].
︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | + + + + + + + + + + + + + + + + + + - + - | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFEnumerator.h" /*! @file */ /** * @brief A struct describing the functions to be used by the map table. */ typedef struct of_map_table_functions_t { /// The function to retain keys / values void* (*retain)(void *value); /// The function to release keys / values void (*release)(void *value); /// The function to hash keys uint32_t (*hash)(void *value); /// The function to compare keys / values bool (*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 * @param value The current value * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^of_map_table_enumeration_block_t)(void *key, void *value, bool *stop); /*! * @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 */ |
︙ |
Modified src/OFMapTable.m from [f2d7d60333] to [7caa69a7b0].
︙ | |||
595 596 597 598 599 600 601 | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | - - + - + - + - - - - + + + + + | block(_buckets[i]->key, _buckets[i]->value, &stop); } } - (void)replaceValuesUsingBlock: (of_map_table_replace_block_t)block { size_t i; |
︙ |
Modified src/OFMutableArray.h from [48e9f64998] to [6fa55f9480].
︙ | |||
11 12 13 14 15 16 17 18 19 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + + + + + + + - + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFArray.h" /*! @file */ #ifdef OF_HAVE_BLOCKS /*! * @brief A block for replacing values in an OFMutableArray. * * @param object The object to replace * @param index The index of the object to replace * @return The object to replace the object with */ |
︙ |
Modified src/OFMutableArray.m from [53f13e2987] to [f511e7126a].
︙ | |||
372 373 374 375 376 377 378 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | + + + - - + + | } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { [self enumerateObjectsUsingBlock: ^ (id object, size_t index, bool *stop) { id new = block(object, index); if (new != object) |
︙ |
Modified src/OFMutableArray_adjacent.m from [1c467efbfe] to [4bdaba029a].
︙ | |||
348 349 350 351 352 353 354 | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | - - - + + - + - + - - - + + + + | } } - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { id *objects = [_array items]; size_t i, count = [_array count]; |
︙ |
Modified src/OFMutableDictionary.h from [87d84a54c5] to [478ab9b477].
︙ | |||
11 12 13 14 15 16 17 18 19 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + + + + + + + + - + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFDictionary.h" /*! @file */ #ifdef OF_HAVE_BLOCKS /*! * @brief A block for replacing objects in an OFMutableDictionary. * * @param key The key of the object to replace * @param object The object to replace * @return The object to replace the object with */ |
︙ |
Modified src/OFMutableDictionary.m from [e6fd44030a] to [c0b80ff39c].
︙ | |||
196 197 198 199 200 201 202 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | + + + - - + + + | } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block { [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, bool *stop) { id new = block(key, object); if (new != object) { |
︙ |
Modified src/OFMutableDictionary_hashtable.m from [09bf9855b2] to [e4b0cd098c].
︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | - - + + | } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block { @try { [_mapTable replaceValuesUsingBlock: |
︙ |
Modified src/OFSet.h from [bbf8e3f8e2] to [a277fd200b].
︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | + + + + + + + + + + + + + + + + | #endif #include <stdarg.h> #import "OFObject.h" #import "OFCollection.h" #import "OFSerialization.h" /*! @file */ @class OFArray; #ifdef OF_HAVE_BLOCKS /*! * @brief A block for enumerating an OFSet. * * @param object The current object * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^of_set_enumeration_block_t)(id object, bool *stop); /*! * @brief A block for filtering an OFSet. * * @param object The object to inspect * @return Whether the object should be in the filtered set */ typedef bool (^of_set_filter_block_t)(id object); #endif /*! * @brief An abstract class for an unordered set of unique objects. * * @warning Do not mutate objects that are in a set! Changing the hash of |
︙ |
Modified src/OFStream.h from [d1cbeea7d2] to [05795f4687].
︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | + + + + + + + + + + + - - - - + + + + + + + + + + + + + | # define __STDC_CONSTANT_MACROS #endif #include <stdarg.h> #import "OFObject.h" #import "OFString.h" /*! @file */ @class OFStream; @class OFDataArray; @class OFException; #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when data was read from the stream. * * @param stream The stream on which data was read * @param buffer A buffer with the data that has been read * @param length The length of the data that has been read * @param exception An exception which occurred while reading or nil on success * @return A bool whether the same block should be used for the next read */ |
︙ |
Modified src/OFString+XMLUnescaping.h from [f82a708982] to [42752e55c6].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | + + + + + + + + + + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFString.h" /*! @file */ #ifdef __cplusplus extern "C" { #endif extern int _OFString_XMLUnescaping_reference; #ifdef __cplusplus } #endif #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called to replace unknown XML entities in an XML * string. * * @param string The XML string which contains an unknown entity * @param entity The XML entity which is unknown * @return A replacement string for the unknown entity */ typedef OFString* (^of_string_xml_unescaping_block_t)(OFString *string, OFString *entity); #endif /*! * @brief A protocol that needs to be implemented by delegates for * stringByXMLUnescapingWithHandler:. |
︙ |
Modified src/OFString.h from [855049f2d1] to [7dbf74822f].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + + - - | #include <stdarg.h> #include <inttypes.h> #import "OFObject.h" #import "OFSerialization.h" #import "OFJSONRepresentation.h" #import "OFBinaryPackRepresentation.h" /*! @file */ @class OFConstantString; #if defined(__cplusplus) && __cplusplus >= 201103L typedef char16_t of_char16_t; typedef char32_t of_char32_t; #else typedef uint_least16_t of_char16_t; typedef uint_least32_t of_char32_t; #endif typedef of_char32_t of_unichar_t; |
︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | + + + + + + + | OF_STRING_SKIP_EMPTY = 2 }; /* FIXME */ #define OF_STRING_ENCODING_NATIVE OF_STRING_ENCODING_UTF_8 #ifdef OF_HAVE_BLOCKS /*! * @brief A block for enumerating the lines of a string. * * @param line The current line * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^of_string_line_enumeration_block_t)(OFString *line, bool *stop); #endif @class OFArray; @class OFURL; /*! |
︙ |
Modified src/OFTCPSocket.h from [b4d76328d1] to [efe8886d8a].
︙ | |||
28 29 30 31 32 33 34 35 36 37 38 39 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | + + + + + + + + + - - - + + + + + + + + + + + + + + + | #endif #import "OFStreamSocket.h" #ifdef _WIN32 # include <ws2tcpip.h> #endif /*! @file */ @class OFTCPSocket; @class OFString; #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when the socket connected. * * @param socket The socket which connected * @param exception An exception which occurred while connecting the socket or * nil on success */ |
︙ |
Modified src/OFThread.h from [abb9dc92a6] to [b48c7d5a0b].
︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | + + + + + + + | #import "threading.h" /* Haiku used to define this for some unknown reason which causes trouble */ #ifdef protected # undef protected #endif /*! @file */ @class OFDate; @class OFSortedList; @class OFRunLoop; #ifdef OF_HAVE_BLOCKS /*! * @brief A block to be executed in a new thread. * * @return The object which should be returned when the thread is joined */ typedef id (^of_thread_block_t)(void); #endif /*! * @brief A class which provides portable threads. * * To use it, you should create a new class derived from it and reimplement |
︙ |
Modified src/OFThreadPool.h from [0db8d807f8] to [0f1bb8fc11].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | + + + + + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" /*! @file */ #ifdef OF_HAVE_BLOCKS /*! * @brief A block for a job which should be executed in a thread pool. */ typedef void (^of_thread_pool_block_t)(void); #endif @class OFMutableArray; @class OFList; @class OFCondition; @class OFThreadPoolJob; |
︙ |
Modified src/OFTimer.h from [eafb8bd36e] to [ca397382d3].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | + + + + + + + - + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" /*! @file */ @class OFTimer; @class OFDate; @class OFRunLoop; #ifdef OF_HAVE_THREADS @class OFCondition; #endif #ifdef OF_HAVE_BLOCKS /*! * @brief A block to execute when a timer fires. * * @param timer The timer which fired */ |
︙ |
Modified src/exceptions/OFException.h from [8f2a6df5f9] to [20ad317438].
︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + - + | * * @param class_ The class of the object which caused the exception * @return An initialized OFException */ - initWithClass: (Class)class_; /*! |
︙ |
Modified tests/OFArrayTests.m from [4c7095914c] to [4b9f82311d].
︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | - + - | } TEST(@"Detection of mutation during enumeration using blocks", ok) } TEST(@"-[replaceObjectsUsingBlock:]", |
︙ |
Modified tests/OFDictionaryTests.m from [e04f963308] to [d16af2dca7].
︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - + - | TEST(@"Detection of mutation during enumeration using blocks", ok) [dict removeObjectForKey: @""]; } TEST(@"-[replaceObjectsUsingBlock:]", |
︙ |