aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds-kbdc
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-08 19:34:26 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-08 19:34:26 +0100
commit3e07c8b1657e28f19072b430936e88be040fb319 (patch)
tree079b9c8b4669873578cce9eccd79d53c89467a1f /src/mds-kbdc
parentm + make sure we never lose errno (diff)
downloadmds-3e07c8b1657e28f19072b430936e88be040fb319.tar.gz
mds-3e07c8b1657e28f19072b430936e88be040fb319.tar.bz2
mds-3e07c8b1657e28f19072b430936e88be040fb319.tar.xz
rename pfail to fail
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/mds-kbdc/callables.c2
-rw-r--r--src/mds-kbdc/compile-layout.c26
-rw-r--r--src/mds-kbdc/eliminate-dead-code.c4
-rw-r--r--src/mds-kbdc/include-stack.c6
-rw-r--r--src/mds-kbdc/make-tree.c48
-rw-r--r--src/mds-kbdc/mds-kbdc.c2
-rw-r--r--src/mds-kbdc/parsed.c2
-rw-r--r--src/mds-kbdc/paths.c6
-rw-r--r--src/mds-kbdc/process-includes.c6
-rw-r--r--src/mds-kbdc/raw-data.c10
-rw-r--r--src/mds-kbdc/simplify-tree.c14
-rw-r--r--src/mds-kbdc/tree.c2
-rw-r--r--src/mds-kbdc/validate-tree.c22
13 files changed, 75 insertions, 75 deletions
diff --git a/src/mds-kbdc/callables.c b/src/mds-kbdc/callables.c
index 10eddcc..4c984c1 100644
--- a/src/mds-kbdc/callables.c
+++ b/src/mds-kbdc/callables.c
@@ -142,7 +142,7 @@ int callables_set(const char* restrict name, size_t arg_count, mds_kbdc_tree_t*
list_ptr++;
return 0;
- pfail:
+ fail:
saved_errno = errno;
free(dupname);
free(new_names);
diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c
index 9441802..ccf647c 100644
--- a/src/mds-kbdc/compile-layout.c
+++ b/src/mds-kbdc/compile-layout.c
@@ -58,7 +58,7 @@
/**
* Beginning of failure clause
*/
-#define FAIL_BEGIN pfail: saved_errno = errno
+#define FAIL_BEGIN fail: saved_errno = errno
/**
* End of failure clause
@@ -247,7 +247,7 @@ static int check_set_3_get_2_call(mds_kbdc_tree_t* restrict tree, int is_set, co
FUN_ERROR(tree, ERROR, "‘\\%zu’ does not hold %zu elements", (size_t)*variable_arg, (size_t)*index_arg);/* TODO test */
return 0;
- pfail:
+ fail:
return -1;
#undef FUN_ERROR
#undef F
@@ -470,7 +470,7 @@ static char32_t* parse_function_call(mds_kbdc_tree_t* restrict tree, const char*
*rc = -1;
goto done;
- pfail:
+ fail:
saved_errno = errno;
free(rc);
if (old_arguments)
@@ -586,7 +586,7 @@ static void check_function_call(const mds_kbdc_tree_t* restrict tree, const char
error->end = lineoff + (size_t)(*end - raw);
return;
- pfail:
+ fail:
*rc |= -1;
}
@@ -706,7 +706,7 @@ static char32_t* parse_escape(mds_kbdc_tree_t* restrict tree, const char* restri
*escape = 0;
*end = raw;
return rc;
- pfail:
+ fail:
saved_errno = errno;
free(rc);
return errno = saved_errno, NULL;
@@ -838,7 +838,7 @@ static char32_t* parse_quoted_string(mds_kbdc_tree_t* restrict tree, const char*
free(buf);
return rc;
- pfail:
+ fail:
saved_errno = errno;
free(subrc);
free(old_rc);
@@ -890,7 +890,7 @@ static char32_t* parse_unquoted_string(mds_kbdc_tree_t* restrict tree, const cha
fail_if (rc = malloc(2 * sizeof(char32_t)), rc == NULL);
return rc[0] = buf, rc[1] = -1, rc;
- pfail:
+ fail:
return NULL;
#undef CHAR_ERROR
#undef R
@@ -1026,7 +1026,7 @@ static char32_t* parse_keys(mds_kbdc_tree_t* restrict tree, const char* restrict
free(buf);
return last_value_statement = old_last_value_statement, rc;
- pfail:
+ fail:
saved_errno = errno;
free(subrc);
free(old_rc);
@@ -1079,7 +1079,7 @@ static size_t parse_variable(mds_kbdc_tree_t* restrict tree, const char* restric
if (strlen(dotless + 1) != (size_t)snprintf(NULL, 0, "%zu", var))
return errno = ERANGE, (size_t)0;
return var;
- pfail:
+ fail:
return 0;
bad:
@@ -1224,7 +1224,7 @@ static int get_macro(mds_kbdc_tree_macro_call_t* restrict macro_call,
*macro = NULL;
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1848,7 +1848,7 @@ static int check_name_suffix(struct mds_kbdc_tree_callable* restrict tree)
}
return 0;
- pfail:
+ fail:
return -1;
name_error:
error->start = tree->loc_end;
@@ -2187,7 +2187,7 @@ static int evaluate_element(mds_kbdc_tree_t* restrict node)
}
return bad;
- pfail:
+ fail:
return -1;
}
@@ -2260,7 +2260,7 @@ static int check_nonnul(mds_kbdc_tree_t* restrict tree)
tree = tree->next;
goto again;
- pfail:
+ fail:
return -1;
}
diff --git a/src/mds-kbdc/eliminate-dead-code.c b/src/mds-kbdc/eliminate-dead-code.c
index 0881b20..4916fa4 100644
--- a/src/mds-kbdc/eliminate-dead-code.c
+++ b/src/mds-kbdc/eliminate-dead-code.c
@@ -105,7 +105,7 @@ static int eliminate_if(mds_kbdc_tree_if_t* restrict tree)
if (elimination > elimination_level)
elimination = elimination_level;
return 0;
- pfail:
+ fail:
return -1;
}
@@ -156,7 +156,7 @@ static int eliminate_subtree(mds_kbdc_tree_t* restrict tree)
tree = tree->next;
goto again;
- pfail:
+ fail:
return -1;
#undef E
#undef e
diff --git a/src/mds-kbdc/include-stack.c b/src/mds-kbdc/include-stack.c
index d86374e..bec1425 100644
--- a/src/mds-kbdc/include-stack.c
+++ b/src/mds-kbdc/include-stack.c
@@ -85,7 +85,7 @@ int mds_kbdc_include_stack_dump(size_t ptr)
result->pathname = old_pathname;
result->source_code = old_source_code;
return 0;
- pfail:
+ fail:
result->pathname = old_pathname;
result->source_code = old_source_code;
return -1;
@@ -149,7 +149,7 @@ int mds_kbdc_include_stack_push(const mds_kbdc_tree_include_t* restrict tree, vo
latest_save = NULL;
return 0;
- pfail:
+ fail:
saved_errno = errno;
free(old);
return errno = saved_errno, -1;
@@ -205,7 +205,7 @@ mds_kbdc_include_stack_t* mds_kbdc_include_stack_save(void)
memcpy(latest_save->stack, includes, latest_save->ptr * sizeof(const mds_kbdc_tree_include_t*));
return latest_save;
- pfail:
+ fail:
saved_errno = errno;
free(latest_save->stack);
latest_save = NULL;
diff --git a/src/mds-kbdc/make-tree.c b/src/mds-kbdc/make-tree.c
index bb9d59e..8a7bb1e 100644
--- a/src/mds-kbdc/make-tree.c
+++ b/src/mds-kbdc/make-tree.c
@@ -459,7 +459,7 @@ static int get_pathname(const char* restrict filename)
}
return 1;
- pfail:
+ fail:
saved_errno = errno;
free(cwd);
return errno = saved_errno, -1;
@@ -488,7 +488,7 @@ static int allocate_stacks(void)
fail_if (xmalloc(tree_stack, line_n + max_line_length + 1, mds_kbdc_tree_t**));
return 0;
- pfail:
+ fail:
return -1;
}
@@ -504,7 +504,7 @@ static int read_source_code(void)
fail_if (read_source_lines(result->pathname, result->source_code) < 0);
return 0;
- pfail:
+ fail:
return -1;
}
@@ -545,7 +545,7 @@ static int check_for_premature_end_of_file(void)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -565,7 +565,7 @@ static int check_whether_file_is_empty(void)
NEW_ERROR(0, WARNING, "file is empty");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -592,7 +592,7 @@ static int no_parameters(const char* restrict keyword)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -653,7 +653,7 @@ static int names_1(char** restrict var)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -704,7 +704,7 @@ static int chars(char** restrict var)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -731,7 +731,7 @@ static int quotes(void)
line = line_;
return 0;
- pfail:
+ fail:
return -1;
}
@@ -756,7 +756,7 @@ static int have_more_parameters(void)
return 0;
}
return 1;
- pfail:
+ fail:
return -1;
}
@@ -789,7 +789,7 @@ static int test_for_keyword(const char* restrict keyword)
NEW_ERROR(1, ERROR, "expecting keyword ‘%s’", keyword);
return 0;
- pfail:
+ fail:
return -1;
}
@@ -844,7 +844,7 @@ static int keys(mds_kbdc_tree_t** restrict var)
line = end;
return 0;
- pfail:
+ fail:
return -1;
}
@@ -889,7 +889,7 @@ static int pure_keys(char** restrict var)
end = arg_end, line = end;
return 0;
- pfail:
+ fail:
return -1;
}
@@ -959,7 +959,7 @@ static int sequence(int mapseq, size_t stack_orig)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -984,7 +984,7 @@ static int sequence_fully_popped(size_t stack_orig)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1052,7 +1052,7 @@ static int parse_else(void)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1074,7 +1074,7 @@ static int parse_for(void)
BRANCH("for");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1128,7 +1128,7 @@ static int parse_let(void)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1159,7 +1159,7 @@ static int parse_end(void)
NEXT;
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1218,7 +1218,7 @@ static int parse_map(void)
NEW_ERROR(1, ERROR, "too many parameters");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1283,7 +1283,7 @@ static int parse_macro_call(void)
NEW_ERROR(1, ERROR, "invalid syntax ‘%s’", line);
return 0;
- pfail:
+ fail:
return -1;
}
@@ -1323,7 +1323,7 @@ static int parse_array_elements(void)
}
}
- pfail:
+ fail:
return -1;
}
@@ -1375,7 +1375,7 @@ static int parse_line(void)
*end = prev_end_char;
return 0;
- pfail:
+ fail:
return -1;
#undef p
}
@@ -1442,7 +1442,7 @@ int parse_to_tree(const char* restrict filename, mds_kbdc_parsed_t* restrict res
free(tree_stack);
return 0;
- pfail:
+ fail:
saved_errno = errno;
free(keyword_stack);
free(tree_stack);
diff --git a/src/mds-kbdc/mds-kbdc.c b/src/mds-kbdc/mds-kbdc.c
index ed690a7..33b97b2 100644
--- a/src/mds-kbdc/mds-kbdc.c
+++ b/src/mds-kbdc/mds-kbdc.c
@@ -85,7 +85,7 @@ int main(int argc_, char** argv_)
mds_kbdc_parsed_destroy(&result);
return fatal;
- pfail:
+ fail:
xperror(*argv);
mds_kbdc_parsed_destroy(&result);
return 1;
diff --git a/src/mds-kbdc/parsed.c b/src/mds-kbdc/parsed.c
index a049b9c..8ab483b 100644
--- a/src/mds-kbdc/parsed.c
+++ b/src/mds-kbdc/parsed.c
@@ -150,7 +150,7 @@ mds_kbdc_parse_error_t* mds_kbdc_parsed_new_error(mds_kbdc_parsed_t* restrict th
}
return error;
- pfail:
+ fail:
saved_errno = errno;
free(error);
this->errors_ptr = old_errors_ptr;
diff --git a/src/mds-kbdc/paths.c b/src/mds-kbdc/paths.c
index 552aaae..a14681e 100644
--- a/src/mds-kbdc/paths.c
+++ b/src/mds-kbdc/paths.c
@@ -50,7 +50,7 @@ char* curpath(void)
}
return cwd;
- pfail:
+ fail:
saved_errno = errno;
free(old);
free(cwd);
@@ -104,7 +104,7 @@ char* abspath(const char* path)
free(cwd);
return buf;
- pfail:
+ fail:
saved_errno = errno;
free(cwd);
errno = saved_errno;
@@ -154,7 +154,7 @@ char* relpath(const char* path, const char* base)
free(abs);
free(absbase);
return buf;
- pfail:
+ fail:
saved_errno = errno;
free(abs);
free(absbase);
diff --git a/src/mds-kbdc/process-includes.c b/src/mds-kbdc/process-includes.c
index 18d995f..57e0502 100644
--- a/src/mds-kbdc/process-includes.c
+++ b/src/mds-kbdc/process-includes.c
@@ -135,7 +135,7 @@ static int transfer_errors(mds_kbdc_parsed_t* restrict subresult, mds_kbdc_tree_
free(errors);
return 0;
- pfail:
+ fail:
saved_errno = errno;
while (errors_ptr--)
mds_kbdc_parse_error_free(errors[errors_ptr]);
@@ -223,7 +223,7 @@ static int process_include(mds_kbdc_tree_include_t* restrict tree)
mds_kbdc_parsed_destroy(&subresult);
return 0;
- pfail:
+ fail:
saved_errno = errno;
free(dirname);
free(cwd);
@@ -309,7 +309,7 @@ int process_includes(mds_kbdc_parsed_t* restrict result_)
free(included), included_size = 0;
return errno = saved_errno, r;
- pfail:
+ fail:
return -1;
}
diff --git a/src/mds-kbdc/raw-data.c b/src/mds-kbdc/raw-data.c
index c47269a..359abe8 100644
--- a/src/mds-kbdc/raw-data.c
+++ b/src/mds-kbdc/raw-data.c
@@ -145,7 +145,7 @@ static char* read_file(const char* restrict pathname, size_t* restrict size)
*size = buf_ptr;
return content;
- pfail:
+ fail:
xperror(*argv);
free(old);
free(content);
@@ -325,7 +325,7 @@ static char** line_split(char* content, size_t length)
return lines;
- pfail:
+ fail:
xperror(*argv);
return NULL;
}
@@ -370,7 +370,7 @@ static int expand(char** restrict content, size_t* restrict content_size)
while (++col % 8);
return 0;
- pfail:
+ fail:
return -1;
}
@@ -429,7 +429,7 @@ int read_source_lines(const char* restrict pathname, mds_kbdc_source_code_t* res
source_code->line_count = line_count;
return 0;
- pfail:
+ fail:
xperror(*argv);
free(old);
free(content);
@@ -519,7 +519,7 @@ char* parse_raw_string(const char* restrict string)
*p = '\0';
return rc;
- pfail:
+ fail:
free(rc);
return NULL;
#undef r
diff --git a/src/mds-kbdc/simplify-tree.c b/src/mds-kbdc/simplify-tree.c
index 713a898..c46649e 100644
--- a/src/mds-kbdc/simplify-tree.c
+++ b/src/mds-kbdc/simplify-tree.c
@@ -321,7 +321,7 @@ static int simplify_macro_call(mds_kbdc_tree_macro_call_t* restrict tree)
*/
return 0;
- pfail:
+ fail:
saved_errno = errno;
mds_kbdc_tree_free(dup_arguments);
return errno = saved_errno, -1;
@@ -352,7 +352,7 @@ static int check_value_statement_before_simplification(mds_kbdc_tree_map_t* rest
fail_if (simplify(tree->sequence));
goto again;
- pfail:
+ fail:
return -1;
}
@@ -374,7 +374,7 @@ static int check_value_statement_after_simplification(mds_kbdc_tree_map_t* restr
NEW_ERROR(tree->sequence, ERROR, "bad value type");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -530,7 +530,7 @@ static int simplify_map(mds_kbdc_tree_map_t* restrict tree)
*/
return 0;
- pfail:
+ fail:
saved_errno = errno;
mds_kbdc_tree_free(dup_sequence);
return errno = saved_errno, -1;
@@ -603,7 +603,7 @@ static int simplify_alternation(mds_kbdc_tree_alternation_t* restrict tree)
}
return 0;
- pfail:
+ fail:
return -1;
}
@@ -678,7 +678,7 @@ static mds_kbdc_tree_t* create_permutations(mds_kbdc_tree_t* elements)
return first;
- pfail:
+ fail:
saved_errno = errno;
mds_kbdc_tree_free(first);
mds_kbdc_tree_free(subperms);
@@ -790,7 +790,7 @@ static int simplify_unordered(mds_kbdc_tree_unordered_t* restrict tree)
mds_kbdc_tree_free(arguments);
return 0;
- pfail:
+ fail:
return -1;
}
diff --git a/src/mds-kbdc/tree.c b/src/mds-kbdc/tree.c
index dd0eb68..ac9de2b 100644
--- a/src/mds-kbdc/tree.c
+++ b/src/mds-kbdc/tree.c
@@ -331,7 +331,7 @@ mds_kbdc_tree_t* mds_kbdc_tree_dup(const mds_kbdc_tree_t* restrict this)
node = &(n->next);
goto again;
- pfail:
+ fail:
saved_errno = errno;
mds_kbdc_tree_free(rc);
return errno = saved_errno, NULL;
diff --git a/src/mds-kbdc/validate-tree.c b/src/mds-kbdc/validate-tree.c
index ed96343..eeb5735 100644
--- a/src/mds-kbdc/validate-tree.c
+++ b/src/mds-kbdc/validate-tree.c
@@ -151,7 +151,7 @@ static int validate_function(mds_kbdc_tree_function_t* restrict tree)
def_includes_ptr = includes_ptr;
r = validate_subtree(tree->inner);
return function = NULL, r;
- pfail:
+ fail:
return -1;
}
@@ -193,7 +193,7 @@ static int validate_macro(mds_kbdc_tree_macro_t* restrict tree)
def_includes_ptr = includes_ptr;
r = validate_subtree(tree->inner);
return macro = NULL, r;
- pfail:
+ fail:
return -1;
}
@@ -235,7 +235,7 @@ static int validate_information(mds_kbdc_tree_information_t* restrict tree)
def_includes_ptr = includes_ptr;
r = validate_subtree(tree->inner);
return information = NULL, r;
- pfail:
+ fail:
return -1;
}
@@ -277,7 +277,7 @@ static int validate_assumption(mds_kbdc_tree_assumption_t* restrict tree)
def_includes_ptr = includes_ptr;
r = validate_subtree(tree->inner);
return assumption = NULL, r;
- pfail:
+ fail:
return -1;
}
@@ -305,7 +305,7 @@ static int validate_map(mds_kbdc_tree_map_t* restrict tree)
else if (function)
NEW_ERROR(tree, includes_ptr, ERROR, "mapping-statement inside function definition");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -325,7 +325,7 @@ static int validate_macro_call(mds_kbdc_tree_macro_call_t* restrict tree)
else if (function)
NEW_ERROR(tree, includes_ptr, ERROR, "macro call inside function definition");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -369,7 +369,7 @@ static int validate_return(mds_kbdc_tree_return_t* restrict tree)
if ((function == NULL) && (macro == NULL))
NEW_ERROR(tree, includes_ptr, ERROR, "‘return’ outside function and macro definition");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -385,7 +385,7 @@ static int validate_break(mds_kbdc_tree_break_t* restrict tree)
if (fors == 0)
NEW_ERROR(tree, includes_ptr, ERROR, "‘break’ outside ‘for’");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -401,7 +401,7 @@ static int validate_continue(mds_kbdc_tree_continue_t* restrict tree)
if (fors == 0)
NEW_ERROR(tree, includes_ptr, ERROR, "‘continue’ outside ‘for’");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -417,7 +417,7 @@ static int validate_assumption_data(mds_kbdc_tree_t* restrict tree)
if (assumption == NULL)
NEW_ERROR(tree, includes_ptr, ERROR, "assumption outside assumption clause");
return 0;
- pfail:
+ fail:
return -1;
}
@@ -433,7 +433,7 @@ static int validate_information_data(mds_kbdc_tree_t* restrict tree)
if (information == NULL)
NEW_ERROR(tree, includes_ptr, ERROR, "information outside information clause");
return 0;
- pfail:
+ fail:
return -1;
}