-/* we suppose both tab are already created */
-static void copy_tab(int src_tab[], int dest_tab[], unsigned min_tab_size, unsigned index_offset) {
- for (unsigned i = 0; i < min_tab_size; i++) {
+/* we suppose both tabs are already created */
+static void copy_tab(int src_tab[], int dest_tab[], unsigned src_tab_size, unsigned index_offset) {
+ /* FIXME: I think it's worth doing some sanity checks on the array size:
+ * dest_tab_size >= src_tab_size */
+ if (src_tab == NULL || dest_tab == NULL) {
+ printf("Please ensure you have created both arrays beforehand\n");
+ return;
+ }
+ for (unsigned i = 0; i < src_tab_size; i++) {