Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
Data Structures | Functions
MutableArray.h File Reference

Mutable arrays. More...

#include <Objectively/Array.h>

Go to the source code of this file.

Data Structures

struct  MutableArray
 Mutable arrays. More...
 

Functions

OBJECTIVELY_EXPORT Class_MutableArray (void)
 
OBJECTIVELY_EXPORT void quicksort (ident base, size_t count, size_t size, Comparator comparator, ident data)
 A portability wrapper around reentrant qsort. More...
 

Detailed Description

Mutable arrays.

Definition in file MutableArray.h.

Function Documentation

◆ _MutableArray()

OBJECTIVELY_EXPORT Class * _MutableArray ( void  )

Definition at line 349 of file MutableArray.c.

349 {
350 static Class *clazz;
351 static Once once;
352
353 do_once(&once, {
354 clazz = _initialize(&(const ClassDef) {
355 .name = "MutableArray",
356 .superclass = _Array(),
357 .instanceSize = sizeof(MutableArray),
358 .interfaceOffset = offsetof(MutableArray, interface),
359 .interfaceSize = sizeof(MutableArrayInterface),
361 });
362 });
363
364 return clazz;
365}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
Definition: Class.c:91
static void initialize(Class *clazz)
Definition: MutableArray.c:323
long Once
The Once type.
Definition: Once.h:37
#define do_once(once, block)
Executes the given block at most one time.
Definition: Once.h:43
Class * _Array(void)
The Array archetype.
Definition: Array.c:470
ClassDefs are passed to _initialize via an archetype to initialize a Class.
Definition: Class.h:41
The runtime representation of a Class.
Definition: Class.h:95
Mutable arrays.
Definition: MutableArray.h:40

◆ quicksort()

OBJECTIVELY_EXPORT void quicksort ( ident  base,
size_t  count,
size_t  size,
Comparator  comparator,
ident  data 
)

A portability wrapper around reentrant qsort.

Parameters
baseThe base of the array to sort.
countThe count of elements in the array
sizeThe size of each element in the array.
comparatorThe Comparator to sort with.
dataUser data.

Definition at line 67 of file MutableArray.c.

67 {
68 qsort_r(base, count, size, _quicksort, comparator);
69}
static int _quicksort(const void *a, const void *b, void *data)
GNU qsort_r.
Definition: MutableArray.c:63