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
769
770
771
772
773
774



775
776
777
778
779
780
781
}


int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags) {
	struct lc_varhandler_st *handler = NULL;
	const char *lastcomponent_handler = NULL, *lastcomponent_var = NULL;




	lastcomponent_var = strrchr(var, '.');
	if (lastcomponent_var == NULL) {
		lastcomponent_var = var;
	} else {
		lastcomponent_var++;
	}








>
>
>







768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
}


int lc_process_var(const char *var, const char *varargs, const char *value, lc_flags_t flags) {
	struct lc_varhandler_st *handler = NULL;
	const char *lastcomponent_handler = NULL, *lastcomponent_var = NULL;

	lc_errno = LC_ERR_NONE;
	lc_err_usererrmsg = NULL;

	lastcomponent_var = strrchr(var, '.');
	if (lastcomponent_var == NULL) {
		lastcomponent_var = var;
	} else {
		lastcomponent_var++;
	}

817
818
819
820
821
822
823



824
825
826
827
828
829
830

	return(-1);
}

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) {
	struct lc_varhandler_st *newhandler = NULL;




	newhandler = malloc(sizeof(*newhandler));

	if (newhandler == NULL) {
		return(-1);
	}

	if (var == NULL) {







>
>
>







820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836

	return(-1);
}

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) {
	struct lc_varhandler_st *newhandler = NULL;

	lc_errno = LC_ERR_NONE;
	lc_err_usererrmsg = NULL;

	newhandler = malloc(sizeof(*newhandler));

	if (newhandler == NULL) {
		return(-1);
	}

	if (var == NULL) {
843
844
845
846
847
848
849



850
851
852
853
854
855
856

	return(0);
}

int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt) {
	struct lc_varhandler_st *newhandler = NULL;




	newhandler = malloc(sizeof(*newhandler));

	if (newhandler == NULL) {
		return(-1);
	}

	if (var == NULL) {







>
>
>







849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865

	return(0);
}

int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt) {
	struct lc_varhandler_st *newhandler = NULL;

	lc_errno = LC_ERR_NONE;
	lc_err_usererrmsg = NULL;

	newhandler = malloc(sizeof(*newhandler));

	if (newhandler == NULL) {
		return(-1);
	}

	if (var == NULL) {
869
870
871
872
873
874
875



876
877
878
879
880
881
882

	return(0);
}

int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type) {
	int chkretval = 0;




	switch (type) {
		case LC_CONF_SECTION:
			chkretval = lc_process_conf_section(appname, pathname);
			break;
		case LC_CONF_APACHE:
			chkretval = lc_process_conf_apache(appname, pathname);
			break;







>
>
>







878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894

	return(0);
}

int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type) {
	int chkretval = 0;

	lc_errno = LC_ERR_NONE;
	lc_err_usererrmsg = NULL;

	switch (type) {
		case LC_CONF_SECTION:
			chkretval = lc_process_conf_section(appname, pathname);
			break;
		case LC_CONF_APACHE:
			chkretval = lc_process_conf_apache(appname, pathname);
			break;
966
967
968
969
970
971
972



973
974
975
976
977
978
979

	return(retval);
}

void lc_cleanup(void) {
	struct lc_varhandler_st *handler = NULL, *next = NULL;




	handler = varhandlers;
	while (handler != NULL) {
		if (handler->var != NULL) {
			free(handler->var);
		}

		next = handler->_next;







>
>
>







978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994

	return(retval);
}

void lc_cleanup(void) {
	struct lc_varhandler_st *handler = NULL, *next = NULL;

	lc_errno = LC_ERR_NONE;
	lc_err_usererrmsg = NULL;

	handler = varhandlers;
	while (handler != NULL) {
		if (handler->var != NULL) {
			free(handler->var);
		}

		next = handler->_next;
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035


lc_err_t lc_geterrno(void) {
	lc_err_t retval;

	retval = lc_errno;

	lc_errno = LC_ERR_NONE;

	return(retval);
}

void lc_seterrstr(const char *usererrmsg) {
	lc_err_usererrmsg = strdup(usererrmsg);
}








<
<







1035
1036
1037
1038
1039
1040
1041


1042
1043
1044
1045
1046
1047
1048


lc_err_t lc_geterrno(void) {
	lc_err_t retval;

	retval = lc_errno;



	return(retval);
}

void lc_seterrstr(const char *usererrmsg) {
	lc_err_usererrmsg = strdup(usererrmsg);
}