Check-in [cb9ab48b6d]
Overview
Comment:Updated test driver to be completely leak-free
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cb9ab48b6d415bdef0e4282572f37205580d76a4
User & Date: rkeene on 2014-11-25 18:04:13
Other Links: manifest | tags
Context
2014-11-25
18:10
libconfig 0.3.3 check-in: 365b6c155e user: rkeene tags: trunk, 0.3.3
18:04
Updated test driver to be completely leak-free check-in: cb9ab48b6d user: rkeene tags: trunk
18:03
Updated to deal with erroptname more completely check-in: ba3430c2d6 user: rkeene tags: trunk
Changes

Modified test-lc.c from [039acf4416] to [9b3354fc6a].

47
48
49
50
51
52
53







54
55
56
57
58
59







60
61
62
63
64
65
66


67
68
69
70
71
72
73
74
75
76
77
78
79
	lc_register_var("ipaddr", LC_VAR_IP, &ipaddr, 'i');
	lc_register_callback("sally", 0, LC_VAR_STRING, sally_cmd, NULL);
	lc_register_callback("HELP", 'h', LC_VAR_NONE, help_cmd, NULL);
	lc_register_callback("*.ifmodule", 0, LC_VAR_NONE, cmd_ifmodule, NULL);
	lcpret = lc_process_file("testapp", "test.conf", LC_CONF_APACHE);
	if (lcpret < 0) {
		fprintf(stderr, "Error processing config file: %s\n", lc_geterrstr());







		return(EXIT_FAILURE);
	}

	lcpret = lc_process(argc, argv, "testapp", LC_CONF_APACHE, "test.cfg");
	if (lcpret < 0) {
		fprintf(stderr, "Error processing config file: %s\n", lc_geterrstr());







		return(EXIT_FAILURE);
	}

	lc_cleanup();

	if (joeval != NULL) {
		fprintf(stderr, "joeval = \"%s\"\n", joeval);


	} else {
		fprintf(stderr, "joeval = \"(null)\"\n");
	}
	fprintf(stderr, "xval = %llu\n", (unsigned long long) xval);
	fprintf(stderr, "onoff = %i\n", onoff);
	fprintf(stderr, "long = %i\n", onoff2);
	fprintf(stderr, "ip = %08lx\n", (unsigned long) ipaddr);
	for (i = lc_optind; i < argc; i++) {
		fprintf(stderr, "argv[%i] = \"%s\"\n", i, argv[i]);
	}

	return(0);
}







>
>
>
>
>
>
>






>
>
>
>
>
>
>







>
>













47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	lc_register_var("ipaddr", LC_VAR_IP, &ipaddr, 'i');
	lc_register_callback("sally", 0, LC_VAR_STRING, sally_cmd, NULL);
	lc_register_callback("HELP", 'h', LC_VAR_NONE, help_cmd, NULL);
	lc_register_callback("*.ifmodule", 0, LC_VAR_NONE, cmd_ifmodule, NULL);
	lcpret = lc_process_file("testapp", "test.conf", LC_CONF_APACHE);
	if (lcpret < 0) {
		fprintf(stderr, "Error processing config file: %s\n", lc_geterrstr());

		if (joeval != NULL) {
			free(joeval);
		}

		lc_cleanup();

		return(EXIT_FAILURE);
	}

	lcpret = lc_process(argc, argv, "testapp", LC_CONF_APACHE, "test.cfg");
	if (lcpret < 0) {
		fprintf(stderr, "Error processing config file: %s\n", lc_geterrstr());

		if (joeval != NULL) {
			free(joeval);
		}

		lc_cleanup();

		return(EXIT_FAILURE);
	}

	lc_cleanup();

	if (joeval != NULL) {
		fprintf(stderr, "joeval = \"%s\"\n", joeval);

		free(joeval);
	} else {
		fprintf(stderr, "joeval = \"(null)\"\n");
	}
	fprintf(stderr, "xval = %llu\n", (unsigned long long) xval);
	fprintf(stderr, "onoff = %i\n", onoff);
	fprintf(stderr, "long = %i\n", onoff2);
	fprintf(stderr, "ip = %08lx\n", (unsigned long) ipaddr);
	for (i = lc_optind; i < argc; i++) {
		fprintf(stderr, "argv[%i] = \"%s\"\n", i, argv[i]);
	}

	return(0);
}