userspace/libsinsp: remove duplicated code