/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to src/DynamicArray.h

  • Committer: Gustav Hartvigsson
  • Date: 2015-04-10 21:36:10 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150410213610-r1q96ym4nmulpax9
* Added a few skeletal functions to Callback.h
* Re-wrote parts of SDynamicArray to be more sane.
  * removed s_dynamic_array_len() and s_dynamic_array_add()
  * added s_dynamic_array_set() and s_dynamic_array_last_item()
  * use calloc instead of malloc.
* added unsubscribe function to SGlobalNotify.
* Added decumentation in Interface.h
* Made s_dbg_print() more helpful.

-- Testing --
* Made test_case() macro more useful.
* added tests for the dynamic array.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
struct SDynamicArray {
62
62
  SDynamicArrayPrivate * priv;
63
63
  size_t max_size;
64
 
  size_t len;
 
64
  size_t last_item;
65
65
};
66
66
 
67
67
/**
91
91
spointer s_dynamic_array_get (SDynamicArray * self, size_t index);
92
92
 
93
93
/**
94
 
 * Get the length of the array.
 
94
 *
95
95
 */
96
 
size_t s_dynamic_array_len (SDynamicArray * self);
97
 
 
 
96
void s_dynamic_array_set (SDynamicArray * self, size_t index, spointer item);
98
97
 
99
98
/**
100
99
 * Get the size of the array, this is not the same as the length of the array.
105
104
 */
106
105
size_t s_dynamic_array_size (SDynamicArray * self);
107
106
 
108
 
 
109
107
/**
110
 
 * Add an item to the array.
 
108
 * Get the index of the last item in the array.
 
109
 *
 
110
 * @note
 
111
 * This is not the last item added to the array, necessary, it is the index
 
112
 * if the item that has the highest position in the array.
111
113
 */
112
 
void s_dynamic_array_add (SDynamicArray * self, spointer item);
 
114
size_t s_dynamic_array_last_item (SDynamicArray * self);
113
115
 
114
116
/**
115
117
 * Dumps a copy of the array. Must be cast.