Some miscellaneous cleanup of warnings and clang static analyzer suggestions. Mostly removing unused variables or dead stores.
One behavior change is 3 instances of memset where only the first part of the struct was being set to 0, rather than the entire struct. The memset call's length was set to sizeof(somepointer) rather than sizeof(pointerstruct*optional_arraylength)
There are still some warnings due to ignoring constness as well as some false positives where the analyzer doesn't understand libical's custom assertion, but I left those alone.