@@ -75,18 +75,14 @@ tlog_rec_session_conf_cmd_load(struct tlog_errs **perrs,
7575 conf = json_object_new_object();
7676 if (conf == NULL) {
7777 grc = TLOG_GRC_ERRNO;
78- tlog_errs_pushc(perrs, grc);
79- tlog_errs_pushs(perrs, "Failed creating configuration object");
80- goto cleanup;
78+ TLOG_ERRS_RAISECS(grc, "Failed creating configuration object");
8179 }
8280
8381 /* Get program path */
8482 progpath = strdup(argv[ 0] );
8583 if (progpath == NULL) {
8684 grc = TLOG_GRC_ERRNO;
87- tlog_errs_pushc(perrs, grc);
88- tlog_errs_pushs(perrs, "Failed allocating a copy of program path");
89- goto cleanup;
85+ TLOG_ERRS_RAISECS(grc, "Failed allocating a copy of program path");
9086 }
9187
9288 /* Check for and extract login dash prefix */
@@ -96,15 +92,11 @@ tlog_rec_session_conf_cmd_load(struct tlog_errs **perrs,
9692 val = json_object_new_boolean(true);
9793 if (val == NULL) {
9894 grc = TLOG_GRC_ERRNO;
99- tlog_errs_pushc(perrs, grc);
100- tlog_errs_pushs(perrs, "Failed creating login flag");
101- goto cleanup;
95+ TLOG_ERRS_RAISECS(grc, "Failed creating login flag");
10296 }
10397 grc = tlog_json_object_object_add_path(conf, "login", val);
10498 if (grc != TLOG_RC_OK) {
105- tlog_errs_pushc(perrs, grc);
106- tlog_errs_pushs(perrs, "Failed storing login flag");
107- goto cleanup;
99+ TLOG_ERRS_RAISECS(grc, "Failed storing login flag");
108100 }
109101 val = NULL;
110102 }
@@ -121,11 +113,9 @@ tlog_rec_session_conf_cmd_load(struct tlog_errs **perrs,
121113 shell = strdup(shell_start);
122114 if (shell == NULL) {
123115 grc = TLOG_GRC_ERRNO;
124- tlog_errs_pushc(perrs, grc);
125- tlog_errs_pushs(perrs,
126- "Failed allocating a copy of the shell part "
127- "of the program name");
128- goto cleanup;
116+ TLOG_ERRS_RAISECS(grc,
117+ "Failed allocating a copy of the shell part "
118+ "of the program name");
129119 }
130120 /* Decode and unescape the shell path */
131121 for (dst = src = shell; ;) {
@@ -143,15 +133,11 @@ tlog_rec_session_conf_cmd_load(struct tlog_errs **perrs,
143133 val = json_object_new_string(shell);
144134 if (val == NULL) {
145135 grc = TLOG_GRC_ERRNO;
146- tlog_errs_pushc(perrs, grc);
147- tlog_errs_pushs(perrs, "Failed creating shell path object");
148- goto cleanup;
136+ TLOG_ERRS_RAISECS(grc, "Failed creating shell path object");
149137 }
150138 grc = tlog_json_object_object_add_path(conf, "shell", val);
151139 if (grc != TLOG_RC_OK) {
152- tlog_errs_pushc(perrs, grc);
153- tlog_errs_pushs(perrs, "Failed storing shell path");
154- goto cleanup;
140+ TLOG_ERRS_RAISECS(grc, "Failed storing shell path");
155141 }
156142 val = NULL;
157143 }
@@ -160,31 +146,24 @@ tlog_rec_session_conf_cmd_load(struct tlog_errs **perrs,
160146 progname = strndup(progname_start, progname_end - progname_start);
161147 if (progname == NULL) {
162148 grc = TLOG_GRC_ERRNO;
163- tlog_errs_pushc(perrs, grc);
164- tlog_errs_pushs(perrs, "Failed allocating program name");
165- goto cleanup;
149+ TLOG_ERRS_RAISECS(grc, "Failed allocating program name");
166150 }
167151
168152 /* Extract options and positional arguments */
169153 if (asprintf(&help, tlog_rec_session_conf_cmd_help_fmt, progname) < 0) {
170154 grc = TLOG_GRC_ERRNO;
171- tlog_errs_pushc(perrs, grc);
172- tlog_errs_pushs(perrs, "Failed formatting help message");
173- goto cleanup;
155+ TLOG_ERRS_RAISECS(grc, "Failed formatting help message");
174156 }
175157 grc = tlog_rec_session_conf_cmd_load_args(perrs, conf, help, argc, argv);
176158 if (grc != TLOG_RC_OK) {
177- tlog_errs_pushs(perrs,
178- "Failed extracting configuration "
179- "from options and arguments");
180- goto cleanup;
159+ TLOG_ERRS_RAISES("Failed extracting configuration "
160+ "from options and arguments");
181161 }
182162
183163 /* Validate the result */
184164 grc = tlog_rec_session_conf_validate(perrs, conf, TLOG_CONF_ORIGIN_ARGS);
185165 if (grc != TLOG_RC_OK) {
186- tlog_errs_pushs(perrs, "Validation of loaded configuration failed");
187- goto cleanup;
166+ TLOG_ERRS_RAISES("Validation of loaded configuration failed");
188167 }
189168
190169 *phelp = help;
0 commit comments