diff options
| author | Mosder <xmosder12@gmail.com> | 2026-08-04 23:41:26 +0200 |
|---|---|---|
| committer | Mosder <xmosder12@gmail.com> | 2026-08-04 23:41:26 +0200 |
| commit | 4b1b1e5802f1b5161c4df4aeab575108380bdf4d (patch) | |
| tree | e52061fd02b41f99d8fe3aa74fc0229940a6c8b1 /include | |
| parent | aafb4d4c8f5ccc7974b313e7b529dc405704fb01 (diff) | |
refactor: added void to argument-less functions, removed uwanted reference in array docs, added template files for array tests. TODO: write array tests
Diffstat (limited to 'include')
| -rw-r--r-- | include/moslib/ds/array.h | 22 | ||||
| -rw-r--r-- | include/moslib/tester.h | 4 |
2 files changed, 13 insertions, 13 deletions
diff --git a/include/moslib/ds/array.h b/include/moslib/ds/array.h index a9fb00b..aac2304 100644 --- a/include/moslib/ds/array.h +++ b/include/moslib/ds/array.h @@ -30,24 +30,24 @@ // // To append/push to the array use: // -// size_t index = arr_append(&array, item); +// size_t index = arr_append(array, item); // // or: // -// size_t index = arr_push(&array, item); +// size_t index = arr_push(array, item); // // It returns the index of the newly appended/pushed item. // // To insert into specific index of the array and push items after it to the right use: // -// size_t index = arr_insert(&array, i, item); +// size_t index = arr_insert(array, i, item); // // It returns the index of the newly inserted item // If index is greater or equal to array length then it functions identically to arr_append/arr_push. // // To put into specific index (and update if value exists) use: // -// size_t zerod = arr_put(&array, i, item); +// size_t zerod = arr_put(array, i, item); // // If index is greater or equal to array length it will extend the length to the put item and it will // zero all items between previously last item to the new item. @@ -55,10 +55,10 @@ // // If you want to add more items than 1 at once, you can use these: // -// size_t index = arr_append_n(&array, items, n_items); -// size_t index = arr_push_n(&array, items, n_items); -// size_t index = arr_insert_n(&array, i, items, n_items); -// size_t zerod = arr_put_n(&array, i, items, n_items); +// size_t index = arr_append_n(array, items, n_items); +// size_t index = arr_push_n(array, items, n_items); +// size_t index = arr_insert_n(array, i, items, n_items); +// size_t zerod = arr_put_n(array, i, items, n_items); // // They work the same way as their counterparts without n, but accept an array of items instead. // @@ -66,7 +66,7 @@ // // To concatenate two dynamic arrays of the same type use: // -// size_t index = arr_concat(&array1, array2); +// size_t index = arr_concat(array1, array2); // // First array will be the destination. // Returns index of the first item of array2 in array1. @@ -117,7 +117,7 @@ // // You can also set length: // -// size_t deleted = arr_set_len(&array, new_len); +// size_t deleted = arr_set_len(array, new_len); // // If it's bigger than current length - it will zero new items. // If it's smaller than current length - it will delete items. @@ -131,7 +131,7 @@ // // You can also set capacity: // -// size_t new_cap = arr_cap(&array, target_cap); +// size_t new_cap = arr_cap(array, target_cap); // // When target_cap is lower than array length it will set capacity to array length. // Returns the new capacity. diff --git a/include/moslib/tester.h b/include/moslib/tester.h index 9c3ea04..52a9f14 100644 --- a/include/moslib/tester.h +++ b/include/moslib/tester.h @@ -73,14 +73,14 @@ typedef void Test; // this is just for nice indication that a function is a test typedef struct Tester Tester; typedef struct TestGroup TestGroup; -typedef Test (*TestFn)(); +typedef Test (*TestFn)(void); // Initalize new tester // You can skip this and just define it as NULL - it will initalize automatically // // Returns: // pointer to the new tester -extern Tester *new_tester(); +extern Tester *new_tester(void); // Add new test group to the tester // |
