Here is the blend file that i used to test the diff: material_order.blend
Fixed boundary checks,
added comments for missing parts.
Added range checks,
use give_matarrar() instead of direct call for Mesh->mat
fixed selection for EditFont
Was able to build the documentation and fixed a broken list.
This isn't a report we can use,
added null pointer checks (not sure if that is realy necessary)
Removed obsolete function
simplified material reorder by using generic function BLI_array_permute()
CMAKE builds on builder.blender.org are still missing CUDA compute kernel 5.2 for me.