lib/configs: merge new_list_entry() and configs_add_filename()
Introduce configs_refer_filename() which merges the functionality
of new_list_entry() and configs_add_filename() while avoiding
unnecessary string duplication.
The new function takes ownership of the filename pointer directly
instead of using strdup(), which eliminates one allocation per
config file entry. Callers no longer need to free the filename
after adding it to the list, as ownership is transferred to the
list element.
This improves both performance and code clarity by making the
ownership semantics explicit.