add_ref(): take a (struct ref_entry *) parameter