Comment: | Add OF_ENSURE.
This is to be used when the condition includes a statement that needs to |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
417b213d4150b3b2adc42af9f9ac45f7 |
User & Date: | js on 2012-07-16 23:49:50 |
Other Links: | manifest | tags |
2012-07-17
| ||
00:02 | Implement introspection for the ObjFW runtime. check-in: 9df84ee33d user: js tags: trunk | |
2012-07-16
| ||
23:49 | Add OF_ENSURE. check-in: 417b213d41 user: js tags: trunk | |
22:44 | Don't require extra parentheses for OF_(UN)LIKELY. check-in: ff8b2a6c29 user: js tags: trunk | |
Modified src/OFAutoreleasePool.m from [6326631fd1] to [6cf9fdd824].
︙ | |||
14 15 16 17 18 19 20 | 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 | - - + + + - - | * file. */ #include "config.h" #include <stdlib.h> |
︙ | |||
86 87 88 89 90 91 92 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + | pool = objc_autoreleasePoolPush(); if (first == NULL) #ifdef OF_COMPILER_TLS first = pool; #else |
︙ | |||
132 133 134 135 136 137 138 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + | ignoreRelease = YES; #ifdef OF_COMPILER_TLS if (first == pool) first = NULL; #else if (of_tlskey_get(firstKey) == pool) |
︙ |
Modified src/OFBlock.m from [badbea4cd4] to [a204e2796b].
︙ | |||
16 17 18 19 20 21 22 | 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 | - - + | #include "config.h" #include <stdint.h> #include <stdlib.h> #include <string.h> |
︙ | |||
197 198 199 200 201 202 203 | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | - + - + | if (object_getClass((id)block) == (Class)&_NSConcreteMallocBlock) { #if defined(OF_ATOMIC_OPS) of_atomic_inc_int(&block->flags); #else unsigned hash = SPINLOCK_HASH(block); |
︙ | |||
224 225 226 227 228 229 230 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | - + - + - + | block->descriptor->dispose_helper(block); free(block); } #else unsigned hash = SPINLOCK_HASH(block); |
︙ |
Modified src/OFDate.m from [2b9c35d972] to [c0e29e0a91].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - | #define _GNU_SOURCE #include <stdint.h> #include <limits.h> #include <time.h> #include <math.h> #include <float.h> |
︙ | |||
215 216 217 218 219 220 221 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + | - init { struct timeval t; self = [super init]; |
︙ | |||
621 622 623 624 625 626 627 | 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | - + | } - (double)timeIntervalSinceNow { struct timeval t; double seconds_; |
Modified src/OFObject.m from [edc6b04857] to [8f2badf8fb].
︙ | |||
725 726 727 728 729 730 731 | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | - + - + | } - retain { #if defined(OF_ATOMIC_OPS) of_atomic_inc_32(&PRE_IVAR->retainCount); #elif defined(OF_THREADS) |
︙ | |||
749 750 751 752 753 754 755 | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | - + - + | { #if defined(OF_ATOMIC_OPS) if (of_atomic_dec_32(&PRE_IVAR->retainCount) <= 0) [self dealloc]; #elif defined(OF_THREADS) size_t c; |
︙ |
Modified src/OFStreamObserver.m from [6213636312] to [46e892e905].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - - + + + | */ #include "config.h" #define OF_STREAM_OBSERVER_M #define __NO_EXT_QNX |
︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | + + | #if defined(HAVE_SYS_SELECT_H) || defined(_WIN32) # import "OFStreamObserver_select.h" #endif #import "OFInitializationFailedException.h" #import "OFNotImplementedException.h" #import "OFOutOfRangeException.h" #import "macros.h" enum { QUEUE_ADD = 0, QUEUE_REMOVE = 1, QUEUE_READ = 0, QUEUE_WRITE = 2 }; |
︙ | |||
192 193 194 195 196 197 198 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - + - + - + - + - + - + - + - + | [queueInfo addItem: &qi]; [queueFDs addItem: &fd]; } @finally { [mutex unlock]; } #ifndef _WIN32 |
︙ |
Modified src/OFStreamObserver_kqueue.m from [5e762c9efc] to [0f25fb90be].
︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | + + | #import "OFStreamObserver_kqueue.h" #import "OFDataArray.h" #import "OFAutoreleasePool.h" #import "OFInitializationFailedException.h" #import "OFOutOfMemoryException.h" #import "macros.h" #define EVENTLIST_SIZE 64 @implementation OFStreamObserver_kqueue - init { self = [super init]; |
︙ | |||
135 136 137 138 139 140 141 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + | return NO; } for (i = 0; i < events; i++) { if (eventList[i].ident == cancelFD[0]) { char buffer; |
︙ |
Modified src/OFStreamObserver_poll.m from [106a17bb8d] to [17f5ac1ccb].
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + + | * file. */ #include "config.h" #define __NO_EXT_QNX |
︙ | |||
146 147 148 149 150 151 152 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - + | } for (i = 0; i < nFDs; i++) { if (FDsCArray[i].revents & POLLIN) { if (FDsCArray[i].fd == cancelFD[0]) { char buffer; |
︙ |
Modified src/OFStreamObserver_select.m from [17f835ff3b] to [937ba60b81].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | - + + | */ #include "config.h" #define __NO_EXT_QNX #include <string.h> |
︙ | |||
103 104 105 106 107 108 109 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + - + | [pool release]; return NO; } if (FD_ISSET(cancelFD[0], &readFDs_)) { char buffer; #ifndef _WIN32 |
︙ |
Modified src/macros.h from [8665430981] to [f51fb05aa2].
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | + + | * file. */ #import "OFObject.h" #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #if defined(OF_APPLE_RUNTIME) # import <objc/runtime.h> #endif #ifdef _PSP # define INTMAX_MAX LONG_LONG_MAX |
︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + + + + + + + | # define OF_X86_ASM # elif defined(__ppc__) || defined(__PPC__) # define OF_PPC_ASM # elif defined(__arm__) || defined(__ARM__) # define OF_ARM_ASM # endif #endif #define OF_ENSURE(cond) \ if (!(cond)) { \ fprintf(stderr, "Failed to ensure condition in " \ __FILE__ ":%d:\n" #cond "\n", __LINE__); \ abort(); \ } #ifdef OF_OBJFW_RUNTIME # define objc_lookUpClass objc_lookup_class #endif #ifndef _WIN32 # define OF_PATH_DELIMITER '/' |
︙ |
Modified src/runtime/property.m from [343585f1c5] to [677b6f2060].
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - - + | * file. */ #include "config.h" #include <string.h> |
︙ | |||
47 48 49 50 51 52 53 | 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - + - - + - + - - + | objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, BOOL atomic) { if (atomic) { id *ptr = (id*)(void*)((char*)self + offset); #ifdef OF_THREADS unsigned hash = SPINLOCK_HASH(ptr); |
︙ | |||
128 129 130 131 132 133 134 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - + - - - + - + - - - + | objc_getPropertyStruct(void *dest, const void *src, ptrdiff_t size, BOOL atomic, BOOL strong) { if (atomic) { #ifdef OF_THREADS unsigned hash = SPINLOCK_HASH(src); |