Sharing similar code between Item_func_ifnull and Item_func_if