cvs commit: ALFS/nALFS/src handlers.c

Kevin P. Fleming kpfleming at linuxfromscratch.org
Tue Feb 3 17:35:07 PST 2004


jamie at linuxfromscratch.org wrote:

>   +char *alloc_base_dir_force(element_s *el)

You know, this brings to mind something that I wanted to do before... 
Every handler that exists in standard nALFS uses the same technique of 
allocating a copy of the base directory path, chdir()-ing to it, then 
freeing the copy. I don't think any of them do anything else useful with 
that copy.

How about instead of alloc_base_dir_force instead we have 
chdir_base_dir_force, and it takes care of the whole thing? No extra 
copy of the string needs to be made, and testing the chdir() result can 
be done inside the function as well.




More information about the alfs-log mailing list