diff --git a/lib/diff_output.c b/lib/diff_output.c index 3047221..4fa8900 100644 --- a/lib/diff_output.c +++ b/lib/diff_output.c @@ -280,7 +280,7 @@ diff_output_match_function_prototype(char *prototype, size_t prototype_size, if (result->left->atoms.len > 0 && cc->left.start > 0) { data = result->left; - start_atom = &data->atoms.head[cc->left.start - 1]; + start_atom = &data->atoms.head[cc->left.start + 3]; } else return DIFF_RC_OK; diff --git a/test/expect124.diff b/test/expect124.diff new file mode 100644 index 0000000..2ae051a --- /dev/null +++ b/test/expect124.diff @@ -0,0 +1,9 @@ +--- test124.left-p.txt ++++ test124.right-p.txt +@@ -11,5 +11,5 @@ return_test(int test) { + + struct testfile * + return_test(int test) { +- return NULL; ++ return test*2; + } diff --git a/test/test124.left-p.txt b/test/test124.left-p.txt new file mode 100644 index 0000000..2c57789 --- /dev/null +++ b/test/test124.left-p.txt @@ -0,0 +1,15 @@ +static void +doSomethingThenPrintHello(int test) +{ + test = test << 4; + if (test % 8 == 6) { + return; + } + + print("goodbye\n"); +} + +struct testfile * +return_test(int test) { + return NULL; +} diff --git a/test/test124.right-p.txt b/test/test124.right-p.txt new file mode 100644 index 0000000..9f2252e --- /dev/null +++ b/test/test124.right-p.txt @@ -0,0 +1,15 @@ +static void +doSomethingThenPrintHello(int test) +{ + test = test << 4; + if (test % 8 == 6) { + return; + } + + print("goodbye\n"); +} + +struct testfile * +return_test(int test) { + return test*2; +}