I only changed the variable name, will switch to size_t (although there is still mixed usage of ssize_t/size_t throughout the file)