Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107169603
D44301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D44301.diff
View Options
diff --git a/contrib/libdiff/lib/diff_internal.h b/contrib/libdiff/lib/diff_internal.h
--- a/contrib/libdiff/lib/diff_internal.h
+++ b/contrib/libdiff/lib/diff_internal.h
@@ -148,7 +148,7 @@
int diff_output_match_function_prototype(char *prototype, size_t prototype_size,
int *last_prototype_idx,
const struct diff_result *result,
- const struct diff_chunk_context *cc);
+ int chunk_start_line);
struct diff_output_info *diff_output_info_alloc(void);
diff --git a/contrib/libdiff/lib/diff_output.c b/contrib/libdiff/lib/diff_output.c
--- a/contrib/libdiff/lib/diff_output.c
+++ b/contrib/libdiff/lib/diff_output.c
@@ -255,7 +255,8 @@
static bool
is_function_prototype(unsigned char ch)
{
- return (isalpha((unsigned char)ch) || ch == '_' || ch == '$');
+ return (isalpha((unsigned char)ch) || ch == '_' || ch == '$' ||
+ ch == '-' || ch == '+');
}
#define begins_with(s, pre) (strncmp(s, pre, sizeof(pre)-1) == 0)
@@ -263,7 +264,7 @@
int
diff_output_match_function_prototype(char *prototype, size_t prototype_size,
int *last_prototype_idx, const struct diff_result *result,
- const struct diff_chunk_context *cc)
+ int chunk_start_line)
{
struct diff_atom *start_atom, *atom;
const struct diff_data *data;
@@ -271,9 +272,9 @@
const char *state = NULL;
int rc, i, ch;
- if (result->left->atoms.len > 0 && cc->left.start > 0) {
+ if (result->left->atoms.len > 0 && chunk_start_line > 0) {
data = result->left;
- start_atom = &data->atoms.head[cc->left.start - 1];
+ start_atom = &data->atoms.head[chunk_start_line - 1];
} else
return DIFF_RC_OK;
diff --git a/contrib/libdiff/lib/diff_output_unidiff.c b/contrib/libdiff/lib/diff_output_unidiff.c
--- a/contrib/libdiff/lib/diff_output_unidiff.c
+++ b/contrib/libdiff/lib/diff_output_unidiff.c
@@ -301,10 +301,21 @@
else
right_start = cc->right.start + 1;
+ /* Got the absolute line numbers where to start printing, and the index
+ * of the interesting (non-context) chunk.
+ * To print context lines above the interesting chunk, nipping on the
+ * previous chunk index may be necessary.
+ * It is guaranteed to be only context lines where left == right, so it
+ * suffices to look on the left. */
+ const struct diff_chunk *first_chunk;
+ int chunk_start_line;
+ first_chunk = &result->chunks.head[cc->chunk.start];
+ chunk_start_line = diff_atom_root_idx(result->left,
+ first_chunk->left_start);
if (show_function_prototypes) {
rc = diff_output_match_function_prototype(state->prototype,
sizeof(state->prototype), &state->last_prototype_idx,
- result, cc);
+ result, chunk_start_line);
if (rc)
return rc;
}
@@ -344,17 +355,6 @@
*typep = DIFF_LINE_HUNK;
}
- /* Got the absolute line numbers where to start printing, and the index
- * of the interesting (non-context) chunk.
- * To print context lines above the interesting chunk, nipping on the
- * previous chunk index may be necessary.
- * It is guaranteed to be only context lines where left == right, so it
- * suffices to look on the left. */
- const struct diff_chunk *first_chunk;
- int chunk_start_line;
- first_chunk = &result->chunks.head[cc->chunk.start];
- chunk_start_line = diff_atom_root_idx(result->left,
- first_chunk->left_start);
if (cc->left.start < chunk_start_line) {
rc = diff_output_lines(outinfo, dest, " ",
&result->left->atoms.head[cc->left.start],
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 4:43 AM (20 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15761277
Default Alt Text
D44301.diff (3 KB)
Attached To
Mode
D44301: libdiff: Improve function prototype detection.
Attached
Detach File
Event Timeline
Log In to Comment