GSoC/GCI Archive
Google Code-in 2012 BRL-CAD

Convert bu_free((char*)...) casts to bu_free((genptr_t)...) casts

completed by: javamonn

mentors: Sean

BRL-CAD provides basic memory management in our libbu utility library similar to malloc() and free() but coincidingly named bu_malloc() and bu_free().

This task involves converting all calls to bu_free() where we cast the first parameter to (char*) or (void*) and making them instead be (genptr_r) casts.


  • bu_free((char *)arbp, "arb_specific");
  • ...becomes...
  • bu_free((genptr_t)arbp, "arb_specific");

While there are probably 1000 places this needs to be fixed, it should be relatively easy to automate with a few careful regular expressions in perl, python, sed, etc.  However, be SURE to check your changes!

You should be able to compile cleanly beforehand and after.  Check the entire source tree.  Submit your changes as a single patch file with all changes, see to get started and for help making patches.