Moved buffer management functions to libhutils