#include "objfw-defs.h"
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include "macros.h"
import "OFOnce.h"
import "OFBlock.h"
import "OFObject+KeyValueCoding.h"
Go to the source code of this file.
|
void * | OFAllocMemory (size_t count, size_t size) |
| Allocates memory for the specified number of items of the specified size.
|
|
void * | OFAllocZeroedMemory (size_t count, size_t size) |
| Allocates memory for the specified number of items of the specified size and initializes it with zeros.
|
|
void * | OFResizeMemory (void *pointer, size_t count, size_t size) |
| Resizes memory to the specified number of items of the specified size.
|
|
void | OFFreeMemory (void *pointer) |
| Frees memory allocated by OFAllocMemory, OFAllocZeroedMemory or OFResizeMemory.
|
|
void | OFHashInit (unsigned long *hash) |
| Initializes the specified hash.
|
|
uint16_t | OFRandom16 (void) |
| Returns 16 bit or non-cryptographical randomness.
|
|
uint32_t | OFRandom32 (void) |
| Returns 32 bit or non-cryptographical randomness.
|
|
uint64_t | OFRandom64 (void) |
| Returns 64 bit or non-cryptographical randomness.
|
|
◆ OFComparator
A comparator to compare two objects.
- Parameters
-
left | The left object |
right | The right object |
- Returns
- The order of the objects
◆ OFCompareFunction
A function to compare two objects.
- Parameters
-
left | The left object |
right | The right object |
context | Context passed along for comparing |
- Returns
- The order of the objects
◆ OFByteOrder
An enum for representing endianness.
Enumerator |
---|
OFByteOrderBigEndian | Most significant byte first (big endian)
|
OFByteOrderLittleEndian | Least significant byte first (little endian)
|
OFByteOrderNative | Native byte order of the system
|
◆ OFComparisonResult
A result of a comparison.
Enumerator |
---|
OFOrderedAscending | The left object is smaller than the right
|
OFOrderedSame | Both objects are equal
|
OFOrderedDescending | The left object is bigger than the right
|
◆ OFAllocMemory()
void * OFAllocMemory |
( |
size_t | count, |
|
|
size_t | size ) |
|
extern |
Allocates memory for the specified number of items of the specified size.
To free the allocated memory, use OFFreeMemory.
- Parameters
-
count | The number of items to allocate |
size | The size of each item to allocate |
- Returns
- A pointer to the allocated memory. May return NULL if the specified size or count is 0.
- Exceptions
-
◆ OFAllocZeroedMemory()
void * OFAllocZeroedMemory |
( |
size_t | count, |
|
|
size_t | size ) |
|
extern |
Allocates memory for the specified number of items of the specified size and initializes it with zeros.
To free the allocated memory, use OFFreeMemory.
- Parameters
-
size | The size of each item to allocate |
count | The number of items to allocate |
- Returns
- A pointer to the allocated memory. May return NULL if the specified size or count is 0.
- Exceptions
-
◆ OFFreeMemory()
void OFFreeMemory |
( |
void * | pointer | ) |
|
|
extern |
◆ OFHashInit()
void OFHashInit |
( |
unsigned long * | hash | ) |
|
|
extern |
Initializes the specified hash.
- Parameters
-
hash | A pointer to the hash to initialize |
◆ OFRandom16()
uint16_t OFRandom16 |
( |
void | | ) |
|
|
extern |
Returns 16 bit or non-cryptographical randomness.
- Returns
- 16 bit or non-cryptographical randomness
◆ OFRandom32()
uint32_t OFRandom32 |
( |
void | | ) |
|
|
extern |
Returns 32 bit or non-cryptographical randomness.
- Returns
- 32 bit or non-cryptographical randomness
◆ OFRandom64()
uint64_t OFRandom64 |
( |
void | | ) |
|
|
extern |
Returns 64 bit or non-cryptographical randomness.
- Returns
- 64 bit or non-cryptographical randomness
◆ OFResizeMemory()
void * OFResizeMemory |
( |
void * | pointer, |
|
|
size_t | count, |
|
|
size_t | size ) |
|
extern |
Resizes memory to the specified number of items of the specified size.
To free the allocated memory, use OFFreeMemory.
If the pointer is NULL, this is equivalent to allocating memory. If the size or number of items is 0, this is equivalent to freeing memory.
- Parameters
-
pointer | A pointer to the already allocated memory |
size | The size of each item to resize to |
count | The number of items to resize to |
- Returns
- A pointer to the resized memory chunk
- Exceptions
-