Skip to content

Commit

Permalink
Fixed unused warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
orangeduck committed Jan 10, 2014
1 parent 0eaaf4b commit 26b6216
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC = gcc
CFLAGS = -ansi -pedantic -Wall -Werror -Wno-unused -g
CFLAGS = -ansi -pedantic -Wall -Werror -g

TESTS = $(wildcard tests/*.c)

Expand Down
52 changes: 34 additions & 18 deletions mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ static char* mpc_err_char_unescape(char c) {

switch (c) {

case '\a': "bell";
case '\b': "backspace";
case '\f': "formfeed";
case '\r': "carriage return";
case '\v': "vertical tab";
case '\0': "end of input";
case '\n': "newline";
case '\t': "tab";
case ' ' : "space";
case '\a': return "bell";
case '\b': return "backspace";
case '\f': return "formfeed";
case '\r': return "carriage return";
case '\v': return "vertical tab";
case '\0': return "end of input";
case '\n': return "newline";
case '\t': return "tab";
case ' ' : return "space";
default:
char_unescape_buffer[1] = c;
return char_unescape_buffer;
Expand Down Expand Up @@ -392,7 +392,6 @@ static mpc_input_t* mpc_input_new_file(const char* filename, FILE* file) {

static void mpc_input_delete(mpc_input_t* i) {

int j;
free(i->filename);

if (i->type == MPC_INPUT_STRING) { free(i->string); }
Expand Down Expand Up @@ -849,10 +848,6 @@ static void mpc_stack_popr_n(mpc_stack_t* s, int n) {
}
}

static mpc_result_t* mpc_stack_results(mpc_stack_t* s, int n) {
return &s->results[s->results_num-n];
}

static mpc_val_t* mpc_stack_merger_out(mpc_stack_t* s, int n, mpc_fold_t f) {
mpc_val_t* x = f(n, (mpc_val_t**)(&s->results[s->results_num-n]));
mpc_stack_popr_n(s, n);
Expand Down Expand Up @@ -1900,10 +1895,6 @@ static mpc_val_t* mpcf_re_range(mpc_val_t* x) {
return comp ? mpc_noneof(range) : mpc_oneof(range);
}

static mpc_val_t* mpcf_re_invalid(void) {
return mpc_fail("Invalid Regex");
}

mpc_parser_t* mpc_re(const char* re) {

char* err_msg;
Expand Down Expand Up @@ -2114,6 +2105,31 @@ mpc_val_t* mpcf_unescape_regex(mpc_val_t* x) {
return y;
}

mpc_val_t* mpcf_escape_string_raw(mpc_val_t* x) {
mpc_val_t* y = mpcf_escape_new(x, mpc_escape_input_raw_cstr, mpc_escape_output_raw_cstr);
free(x);
return y;
}

mpc_val_t* mpcf_unescape_string_raw(mpc_val_t* x) {
mpc_val_t* y = mpcf_unescape_new(x, mpc_escape_input_raw_cstr, mpc_escape_output_raw_cstr);
free(x);
return y;
}

mpc_val_t* mpcf_escape_char_raw(mpc_val_t* x) {
mpc_val_t* y = mpcf_escape_new(x, mpc_escape_input_raw_cchar, mpc_escape_output_raw_cchar);
free(x);
return y;
}

mpc_val_t* mpcf_unescape_char_raw(mpc_val_t* x) {
mpc_val_t* y = mpcf_unescape_new(x, mpc_escape_input_raw_cchar, mpc_escape_output_raw_cchar);
free(x);
return y;
}


mpc_val_t* mpcf_fst(int n, mpc_val_t** xs) { return xs[0]; }
mpc_val_t* mpcf_snd(int n, mpc_val_t** xs) { return xs[1]; }
mpc_val_t* mpcf_trd(int n, mpc_val_t** xs) { return xs[2]; }
Expand Down
5 changes: 5 additions & 0 deletions mpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,13 @@ mpc_val_t* mpcf_oct(mpc_val_t* x);
mpc_val_t* mpcf_float(mpc_val_t* x);

mpc_val_t* mpcf_escape(mpc_val_t* x);
mpc_val_t* mpcf_escape_regex(mpc_val_t* x);
mpc_val_t* mpcf_escape_string_raw(mpc_val_t* x);
mpc_val_t* mpcf_escape_char_raw(mpc_val_t* x);
mpc_val_t* mpcf_unescape(mpc_val_t* x);
mpc_val_t* mpcf_unescape_regex(mpc_val_t* x);
mpc_val_t* mpcf_unescape_string_raw(mpc_val_t* x);
mpc_val_t* mpcf_unescape_char_raw(mpc_val_t* x);

mpc_val_t* mpcf_fst(int n, mpc_val_t** xs);
mpc_val_t* mpcf_snd(int n, mpc_val_t** xs);
Expand Down
2 changes: 1 addition & 1 deletion tests/regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void test_regex_basic(void) {

void test_regex_range(void) {

mpc_parser_t *re0, *re1, *re2, *re3, *re4;
mpc_parser_t *re0, *re1, *re2, *re3;

re0 = mpc_re("abg[abcdef]");
re1 = mpc_re("y*[a-z]");
Expand Down

0 comments on commit 26b6216

Please sign in to comment.