Skip to content

Commit 106f813

Browse files
committed
refactor: reorder func params
Reorder function parameters to consistently place structs created by other functions as the first parameter. For example: `ordered_array_get(ordered_array_t*, ...);`
1 parent 4512543 commit 106f813

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/ordered_array.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void ordered_array_destroy(ordered_array_t *array)
2626
PANIC("not implemented: ordered_array_destroy");
2727
}
2828

29-
void ordered_array_insert(type_t item, ordered_array_t *array)
29+
void ordered_array_insert(ordered_array_t *array, type_t item)
3030
{
3131
// Check if the array is already at maximum capacity
3232
if (array->size == array->max_size)
@@ -65,16 +65,16 @@ void ordered_array_insert(type_t item, ordered_array_t *array)
6565
}
6666
}
6767

68-
type_t ordered_array_get(uint32_t index, ordered_array_t *array)
68+
type_t ordered_array_get(ordered_array_t *array, uint32_t index)
6969
{
7070
return array->array[index];
7171
}
7272

73-
void ordered_array_remove(uint32_t index, ordered_array_t *array)
73+
void ordered_array_remove(ordered_array_t *array, uint32_t index)
7474
{
7575
for (; index < array->size; index++)
7676
{
7777
array->array[index] = array->array[index + 1];
7878
}
7979
array->size--;
80-
}
80+
}

src/ordered_array.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ ordered_array_t ordered_array_place(uint32_t max_size, compare_predicate_t compa
2626
void ordered_array_destroy(ordered_array_t *array);
2727

2828
// Insert an item into an ordered array.
29-
void ordered_array_insert(type_t item, ordered_array_t *array);
29+
void ordered_array_insert(ordered_array_t *array, type_t item);
3030

3131
// Get the item at the given index in an ordered array.
32-
type_t ordered_array_get(uint32_t index, ordered_array_t *array);
32+
type_t ordered_array_get(ordered_array_t *array, uint32_t index);
3333

3434
// Remove the item at the given index in an ordered array.
35-
void ordered_array_remove(uint32_t index, ordered_array_t *array);
35+
void ordered_array_remove(ordered_array_t *array, uint32_t index);

src/paging.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void switch_directory(page_directory_t *new)
110110
asm volatile("mov %0, %%cr0" :: "r" (cr0));
111111
}
112112

113-
static page_t *get_page(uint32_t address, bool_t create, page_directory_t *dir)
113+
static page_t *get_page(page_directory_t *dir, uint32_t address, bool_t create)
114114
{
115115
// Turn address into an index
116116
uint32_t index = address / PAGE_SIZE;

0 commit comments

Comments
 (0)