ObjFW  Diff

Differences From Artifact [78089d079f]:

  • File src/OFBlock.h — part of check-in [f78e4e4714] at 2010-10-05 20:01:08 on branch trunk — Remove -[autorelease] from OFBlock.

    The reason is that a block might be an NSBlock on OS X where it would
    add the block to an NSAutoreleasePool. This change forces the developer
    to use [OFAutoreleasePool addObject: block], which will also work if
    the block is an NSBlock. Thus, this change is to force developers to
    write portable code. (user: js, size: 1831) [annotate] [blame] [check-ins using]

To Artifact [5c02ac3636]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "objfw-defs.h"

#ifdef OF_OBJFW_RUNTIME
# import <objfw-rt.h>
#else
# import <objc/objc.h>
#endif

/// \cond internal
typedef struct __of_block_literal {
	Class isa;
	int flags;
	int reserved;
	void (*invoke)(void *, ...);











|
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12






13
14
15
16
17
18
19
/*
 * Copyright (c) 2008 - 2010
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "OFObject.h"







/// \cond internal
typedef struct __of_block_literal {
	Class isa;
	int flags;
	int reserved;
	void (*invoke)(void *, ...);
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
# define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x)))
#endif
#ifndef Block_release
# define Block_release(x) _Block_release((const void*)(x))
#endif

/// \cond internal
@interface OFBlock
{
	Class isa;
}

+ (Class)class;
- copy;
- (void)release;
@end

@interface OFStackBlock: OFBlock
@end

@interface OFGlobalBlock: OFBlock
@end

@interface OFMallocBlock: OFBlock
@end
/// \endcond







|
<
<
<
<
<
<
<











59
60
61
62
63
64
65
66







67
68
69
70
71
72
73
74
75
76
77
# define Block_copy(x) ((__typeof__(x))_Block_copy((const void*)(x)))
#endif
#ifndef Block_release
# define Block_release(x) _Block_release((const void*)(x))
#endif

/// \cond internal
@interface OFBlock: OFObject







@end

@interface OFStackBlock: OFBlock
@end

@interface OFGlobalBlock: OFBlock
@end

@interface OFMallocBlock: OFBlock
@end
/// \endcond