[PATCH] Replace ad-hoc function with generic one from libosmocore