cvs commit: ALFS/nALFS/src handlers.h handlers.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Tue Feb 24 19:55:34 PST 2004


kpfleming    04/02/24 20:55:34

  Modified:    nALFS/src handlers.h handlers.c
  Log:
  separate change_to_base_dir back into separate alloc_/change_ functions
  
  Revision  Changes    Path
  1.21      +2 -0      ALFS/nALFS/src/handlers.h
  
  Index: handlers.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- handlers.h	24 Feb 2004 06:30:11 -0000	1.20
  +++ handlers.h	25 Feb 2004 03:55:33 -0000	1.21
  @@ -145,6 +145,8 @@
   
   char *alloc_base_dir(element_s *el);
   
  +const char *alloc_base_dir_new(const element_s * const element);
  +
   int change_to_base_dir(const element_s * const element, const char * const local_base, 
   		       const int default_root);
   
  
  
  
  1.25      +25 -14    ALFS/nALFS/src/handlers.c
  
  Index: handlers.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- handlers.c	24 Feb 2004 06:30:11 -0000	1.24
  +++ handlers.c	25 Feb 2004 03:55:34 -0000	1.25
  @@ -422,16 +422,11 @@
   	return xstrdup("/");
   }
   
  -int change_to_base_dir(const element_s * const element,
  -		       const char * const local_base,
  -		       const int default_root)
  +/* Used by syntax 3.0+ handlers. */
  +const char *alloc_base_dir_new(const element_s * const element)
   {
  -	const element_s *s;
  -	char *dir;
  -	int result;
  -
  -	if (local_base)
  -		return change_current_dir(local_base);
  +	const element_s *s;	
  +	const char *dir;
   
   	for (s = element->parent; s; s = s->parent) {
   		if (!s->handler)
  @@ -440,11 +435,27 @@
   			continue;
   
   		dir  = s->handler->alloc_data(s, HDATA_BASE);
  -		if (dir) {
  -			result = change_current_dir(dir);
  -			xfree(dir);
  -			return result;
  -		}
  +		if (dir)
  +			return dir;
  +	}
  +
  +	return NULL;
  +}
  +
  +int change_to_base_dir(const element_s * const element,
  +		       const char * const local_base,
  +		       const int default_root)
  +{
  +	const char *dir;
  +	int result;
  +
  +	if (local_base)
  +		return change_current_dir(local_base);
  +
  +	if ((dir = alloc_base_dir_new(element)) != NULL) {
  +		result = change_current_dir(dir);
  +		xfree(dir);
  +		return result;
   	}
   
   	if (default_root) {
  
  
  



More information about the alfs-log mailing list