struct NestedLoopList list; switch ((*arg_ptr).ptr_type) { case 0: /* array */ { struct NestedLoopArrayArg* array_ptr = (*arg_ptr).ptr; int length; struct ElementType* type_ptr int elem_size; void* data_arr; struct Element* elem_arr; int src; Element* dst; int i; length = (*array_ptr).length; type_ptr = (*array_ptr).type_ptr; elem_size = type_ptr.size; data_arr = (*array_ptr).ptr; elem_arr = (struct Element*)calloc(length, sizeof(struct Element)); /* Convert the pointer to an int since ++ and other */ /* arithmentic operators are overloaded for pointers */ src = (int)data_arr; dst = elem_arr; for (i=length; i--; ) { (*dst).type_ptr = type_ptr; (*dst).ptr = (void*)src; src += elem_size; dst++; } list.length = length; list.ptr = elem_arr; list.free_ptr = 1; list.free_elems = 0; break; } case 1: /* mixed array */ { struct NestedLoopMixedArg* mixed_ptr = (*arg_ptr).ptr; list.length = (*mixed_ptr).length list.ptr = (*mixed_ptr).ptr; list.free_ptr = 0; list.free_elems = 0; break; } case 2: /* func */ { struct NestedLoopFuncArg* func = (*arg_ptr).ptr; (*(*func_ptr).ptr)(&list, (*func_ptr).pad); break; } }