1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
*
* 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.QPL included in
* the packaging of this file.
*
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
*
* 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.QPL included in
* the packaging of this file.
*
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
{
OFObject *instance;
size_t instanceSize;
instanceSize = class_getInstanceSize(class);
if OF_UNLIKELY (extraAlignment > 1)
extraAlignment = ((instanceSize + extraAlignment - 1) &
~(extraAlignment - 1)) - extraAlignment;
instance = calloc(1, PRE_IVARS_ALIGN + instanceSize +
extraAlignment + extraSize);
if OF_UNLIKELY (instance == nil) {
object_setClass((id)&allocFailedException,
[OFAllocFailedException class]);
|
|
|
>
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
{
OFObject *instance;
size_t instanceSize;
instanceSize = class_getInstanceSize(class);
if OF_UNLIKELY (extraAlignment > 1)
extraAlignment = OFRoundUpToPowerOf2(extraAlignment,
PRE_IVARS_ALIGN + instanceSize) -
PRE_IVARS_ALIGN - instanceSize;
instance = calloc(1, PRE_IVARS_ALIGN + instanceSize +
extraAlignment + extraSize);
if OF_UNLIKELY (instance == nil) {
object_setClass((id)&allocFailedException,
[OFAllocFailedException class]);
|