DuQuad  v1.0
Quadratic Programming Optimizations
 All Data Structures Files Functions Variables Typedefs Macros
general_functions.c
Go to the documentation of this file.
1 /*
2  * general_functions.c
3  *
4  * Created on: Oct 4, 2014
5  * Author: sverre
6  */
7 
8 #include "general_functions.h"
9 
11 {
12  return (real_t*)calloc(size, sizeof(real_t));
13 }
14 
15 
16 void free_pointer(real_t * pointer)
17 {
18  free((void*)pointer);
19  pointer = NULL;
20 
21 }
22 
23 void initArray(struct Array *a, uint32_t initialSize) {
24  a->array = (real_t *)malloc(initialSize * sizeof(real_t));
25  a->used = 0;
26  a->size = initialSize;
27 }
28 
29 void insertArray(struct Array *a, real_t element) {
30  if (a->used == a->size) {
31  a->size *= 2;
32  a->array = (real_t *)realloc(a->array, a->size * sizeof(real_t));
33  }
34  a->array[a->used++] = element;
35 }
36 
37 void freeArray(struct Array *a) {
38  free(a->array);
39  a->array = NULL;
40  a->used = a->size = 0;
41 }
void free_pointer(real_t *pointer)
void insertArray(struct Array *a, real_t element)
unsigned int uint32_t
Definition: typedefs.h:19
void initArray(struct Array *a, uint32_t initialSize)
real_t * vector_alloc(uint32_t size)
uint32_t used
Definition: qp_structs.h:75
uint32_t size
Definition: qp_structs.h:76
float64_t real_t
Definition: typedefs.h:25
real_t * array
Definition: qp_structs.h:74
void freeArray(struct Array *a)