For the number of branches, there is a global parameter to set it without changing default defines, see:
* https://www.kamailio.org/wiki/cookbooks/5.5.x/core#max_branches
At least that part of the patch is not needed.
Then, for acc, maybe it would be better to make them modparam (e.g., acc_extra_size, cdr_extra_size) and allocate the arrays in mod init.