char buf[BUFSIZ];
static feature_t feature;
- while(fgets(buf, sizeof(buf), fp) != NULL)
+ while (fgets(buf, sizeof(buf), fp) != NULL)
{
int braceline = 0;
braceline = (*cp == '}');
}
if (!normalize(buf))
- {
- /*
- * What this is for is to include trailing C } lines in chunk
- * listings even though we're ignoring them for comparison
- * purposes (in order not to be fooled by variance in indent
- * styles). This is a kluge, but it means we will capture
- * entire C functions that differ only by brace placement.
- */
- if (remove_braces && braceline)
- extend_current_chunk(file->length);
continue;
- }
/* maybe we can get the file type from the first line? */
if (linecount == 1 && buf[0] == '#')
sort_count++;
}
-void extend_current_chunk(limit)
-/* bump the end-line number on the last chunk, if there is one */
+void extend_current_chunk(linenum_t linenumber)
+/* set the end-line number on the last chunk, if there is one */
{
if (sort_count > 0)
- sort_buffer[sort_count-1].hash.end++;
+ sort_buffer[sort_count-1].hash.end = linenumber;
if (chunk_count > 0)
- chunk_buffer[chunk_count-1].end++;
+ chunk_buffer[chunk_count-1].end = linenumber;
}
static void write_options(char *buf)
extern void report_time(char *legend, ...);
struct filehdr_t *register_file(const char *file, linenum_t length);
extern void corehook(struct hash_t hash, struct filehdr_t *file);
-extern void extend_current_chunk(int);
+extern void extend_current_chunk(linenum_t);
extern void dump_array(const char *legend,
struct sorthash_t *obarray, int hashcount);
extern void dump_flags(const int flags, FILE *fp);
}
if (accepted && accepted < shredsize)
hook(emit_chunk(display, linenumber), file);
+ else if (accepted)
+ /*
+ * What this is for is to include trailing C } lines in chunk
+ * listings even though we're ignoring them for comparison
+ * purposes (in order not to be fooled by variance in indent
+ * styles). This is a kluge, but it means we will capture
+ * entire C functions that differ only by brace placement.
+ */
+ extend_current_chunk(linenumber);
free(display);
fclose(fp);