cvs commit: ALFS/nALFS/src handlers.c libXML-tree.c logging.c logging.h parser.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Sat Mar 13 23:28:29 PST 2004


kpfleming    04/03/14 00:28:29

  Modified:    nALFS/src handlers.c libXML-tree.c logging.c logging.h
                        parser.c
  Log:
  minor cleanups and optimizations
  add const specifiers to quell compiler warnings
  
  Revision  Changes    Path
  1.30      +2 -2      ALFS/nALFS/src/handlers.c
  
  Index: handlers.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- handlers.c	14 Mar 2004 06:58:36 -0000	1.29
  +++ handlers.c	14 Mar 2004 07:28:28 -0000	1.30
  @@ -234,7 +234,7 @@
   
   	(void) data;
   
  -	handler_info = (handler_info_s *)lookup_symbol(handle, "handler_info");
  +	handler_info = (handler_info_s *) lookup_symbol(handle, "handler_info");
   
   	if (handler_info == NULL) {
   		return 0;
  @@ -406,7 +406,7 @@
   
   int option_in_string(const char * const option, const char * const string)
   {
  -	const char *tmp;
  +	char *tmp;
   	const char *tok;
   
   	tmp = xstrdup(string);
  
  
  
  1.22      +4 -10     ALFS/nALFS/src/libXML-tree.c
  
  Index: libXML-tree.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/libXML-tree.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- libXML-tree.c	14 Mar 2004 06:58:36 -0000	1.21
  +++ libXML-tree.c	14 Mar 2004 07:28:29 -0000	1.22
  @@ -90,7 +90,7 @@
    * XML_DOCB_DOCUMENT_NODE=     21
    */
   
  -static unsigned int element_id;
  +static unsigned int element_id = 0;
   
   static const struct handler_attribute *find_handler_attribute(const handler_info_s *handler,
   							      const char *name)
  @@ -236,16 +236,13 @@
   {
   	handler_info_s *handler = element->handler;
   	handler_info_s *parent = element->parent->handler;
  -	int result;
  +	int result = 0;
   
   	/* If the element's parent wants to validate its children */
   	if (parent->valid_child) {
   		result = parent->valid_child(element->parent, element);
  -		if (!result) {
  -			Nprint_warn("<%s>: <%s> not valid here.", parent->name, handler->name);
  -			return -1;
  -		}
  -	} else {
  +	}
  +	if (!result) {
   		Nprint_warn("<%s>: <%s> not valid here.", parent->name, handler->name);
   		return -1;
   	}
  @@ -377,9 +374,6 @@
   	char resolved_path[PATH_MAX];
   	element_s *el, *profile, *prev = NULL;
   	xmlNodePtr child;
  -
  -
  -	element_id = 0;
   
   	profile = init_new_element();
   
  
  
  
  1.17      +5 -9      ALFS/nALFS/src/logging.c
  
  Index: logging.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/logging.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- logging.c	2 Mar 2004 04:06:57 -0000	1.16
  +++ logging.c	14 Mar 2004 07:28:29 -0000	1.17
  @@ -775,7 +775,7 @@
   	}
   }
   
  -static INLINE logs_t *start_package_logging(element_s *el)
  +static INLINE logs_t *start_package_logging(const element_s * const el)
   {
   	logs_t *l;
   
  @@ -802,9 +802,7 @@
   	return l;
   }
   
  -
  -
  -void log_end_time(element_s *el, int status)
  +void log_end_time(const element_s * const el, const int status)
   {
   	char time_str[DATE_FORMAT_LEN + 1];
   	time_t t;
  @@ -821,7 +819,7 @@
   	logs_add_end_time(logs, el->name, time_str, status);
   }
   
  -void log_start_time(element_s *el)
  +void log_start_time(const element_s * const el)
   {
   	char time_str[DATE_FORMAT_LEN + 1];
   	time_t t;
  @@ -838,9 +836,7 @@
   	logs_add_start_time(logs, el->name, time_str);
   }
   
  -
  -
  -void start_logging_element(element_s *el)
  +void start_logging_element(const element_s * const el)
   {
   	if (!*opt_log_backend) { // Logging off.
   		Debug_logging("start_logging_element: log_backend is off");
  @@ -857,7 +853,7 @@
   	}
   }
   
  -void end_logging_element(element_s *el, int status)
  +void end_logging_element(const element_s * const el, const int status)
   {
   	if (logs == NULL) { // No open file for logging.
   		Debug_logging("end_logging_element: logs is NULL");
  
  
  
  1.5       +4 -4      ALFS/nALFS/src/logging.h
  
  Index: logging.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/logging.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- logging.h	30 Oct 2003 04:37:40 -0000	1.4
  +++ logging.h	14 Mar 2004 07:28:29 -0000	1.5
  @@ -43,11 +43,11 @@
   
   void log_stopped_execution(void);
   
  -void log_end_time(element_s *el, int status);
  -void log_start_time(element_s *el);
  +void log_end_time(const element_s * const el, const int status);
  +void log_start_time(const element_s * const el);
   
  -void start_logging_element(element_s *el);
  -void end_logging_element(element_s *el, int i);
  +void start_logging_element(const element_s * const el);
  +void end_logging_element(const element_s * const el, const int status);
   
   
   #endif /* H_LOGGING_ */
  
  
  
  1.14      +4 -7      ALFS/nALFS/src/parser.c
  
  Index: parser.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/parser.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- parser.c	14 Mar 2004 06:58:36 -0000	1.13
  +++ parser.c	14 Mar 2004 07:28:29 -0000	1.14
  @@ -59,6 +59,7 @@
   	new->hide_children = 1;
   
   	new->handler = NULL;
  +	new->handler_data = NULL;
   
   	new->parent = NULL;
   	new->children = NULL;
  @@ -82,7 +83,7 @@
   		child = tmp;
   	}
   
  -	if (el->handler && el->handler->free)
  +	if (el->handler_data)
   		el->handler->free(el);
   
   	xfree(el->name);
  @@ -96,12 +97,8 @@
   		  element_s *profile)
   {
   	/* Parent<->Child */
  -	if (parent) {
  -		/* el->parent is set at parsing time */
  -
  -		if (parent->children == NULL) {
  -			parent->children = el;
  -		}
  +	if (parent->children == NULL) {
  +		parent->children = el;
   	}
   
   	/* Previous<->Next */
  
  
  



More information about the alfs-log mailing list