Check-in [c8032b5a5e]
Overview
Comment:Updated libconfig to reset lc_errno at the start of each function
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c8032b5a5e116180ef88455b57d9ae8a67f23f5d
User & Date: rkeene on 2006-12-17 00:11:53
Other Links: manifest | tags
Context
2006-12-17
02:49
Exposed lc_handle_type() function to public (needs documentation) Updated lc_register_callback documentation check-in: c3d71a3b91 user: rkeene tags: trunk
00:11
Updated libconfig to reset lc_errno at the start of each function check-in: c8032b5a5e user: rkeene tags: trunk
2006-12-16
17:06
Added an lc_seterrstr() function check-in: f953f16a77 user: rkeene tags: trunk
Changes

Modified libconfig.c from [508cc92a36] to [3125d83cbc].

   768    768   }
   769    769   
   770    770   
   771    771   int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags) {
   772    772   	struct lc_varhandler_st *handler = NULL;
   773    773   	const char *lastcomponent_handler = NULL, *lastcomponent_var = NULL;
   774    774   
          775  +	lc_errno = LC_ERR_NONE;
          776  +	lc_err_usererrmsg = NULL;
          777  +
   775    778   	lastcomponent_var = strrchr(var, '.');
   776    779   	if (lastcomponent_var == NULL) {
   777    780   		lastcomponent_var = var;
   778    781   	} else {
   779    782   		lastcomponent_var++;
   780    783   	}
   781    784   
................................................................................
   817    820   
   818    821   	return(-1);
   819    822   }
   820    823   
   821    824   int lc_register_callback(const char *var, char opt, lc_var_type_t type, int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *extra) {
   822    825   	struct lc_varhandler_st *newhandler = NULL;
   823    826   
          827  +	lc_errno = LC_ERR_NONE;
          828  +	lc_err_usererrmsg = NULL;
          829  +
   824    830   	newhandler = malloc(sizeof(*newhandler));
   825    831   
   826    832   	if (newhandler == NULL) {
   827    833   		return(-1);
   828    834   	}
   829    835   
   830    836   	if (var == NULL) {
................................................................................
   843    849   
   844    850   	return(0);
   845    851   }
   846    852   
   847    853   int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt) {
   848    854   	struct lc_varhandler_st *newhandler = NULL;
   849    855   
          856  +	lc_errno = LC_ERR_NONE;
          857  +	lc_err_usererrmsg = NULL;
          858  +
   850    859   	newhandler = malloc(sizeof(*newhandler));
   851    860   
   852    861   	if (newhandler == NULL) {
   853    862   		return(-1);
   854    863   	}
   855    864   
   856    865   	if (var == NULL) {
................................................................................
   869    878   
   870    879   	return(0);
   871    880   }
   872    881   
   873    882   int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type) {
   874    883   	int chkretval = 0;
   875    884   
          885  +	lc_errno = LC_ERR_NONE;
          886  +	lc_err_usererrmsg = NULL;
          887  +
   876    888   	switch (type) {
   877    889   		case LC_CONF_SECTION:
   878    890   			chkretval = lc_process_conf_section(appname, pathname);
   879    891   			break;
   880    892   		case LC_CONF_APACHE:
   881    893   			chkretval = lc_process_conf_apache(appname, pathname);
   882    894   			break;
................................................................................
   966    978   
   967    979   	return(retval);
   968    980   }
   969    981   
   970    982   void lc_cleanup(void) {
   971    983   	struct lc_varhandler_st *handler = NULL, *next = NULL;
   972    984   
          985  +	lc_errno = LC_ERR_NONE;
          986  +	lc_err_usererrmsg = NULL;
          987  +
   973    988   	handler = varhandlers;
   974    989   	while (handler != NULL) {
   975    990   		if (handler->var != NULL) {
   976    991   			free(handler->var);
   977    992   		}
   978    993   
   979    994   		next = handler->_next;
................................................................................
  1020   1035   
  1021   1036   
  1022   1037   lc_err_t lc_geterrno(void) {
  1023   1038   	lc_err_t retval;
  1024   1039   
  1025   1040   	retval = lc_errno;
  1026   1041   
  1027         -	lc_errno = LC_ERR_NONE;
  1028         -
  1029   1042   	return(retval);
  1030   1043   }
  1031   1044   
  1032   1045   void lc_seterrstr(const char *usererrmsg) {
  1033   1046   	lc_err_usererrmsg = strdup(usererrmsg);
  1034   1047   }
  1035   1048