sort_count++;
}
+void extend_current_chunk(void)
+/* bump the end-line number on the last chunk, if there is one */
+{
+ if (sort_count > 0)
+ sort_buffer[sort_count-1].hash.end++;
+}
+
static void write_scf(const char *tree, FILE *ofp)
/* generate shred file for given tree */
{
/* main.c functions */
extern void report_time(char *legend, ...);
extern void corehook(struct hash_t hash, const char *file);
+extern void extend_current_chunk(void);
extern void dump_array(const char *legend,
struct sorthash_t *obarray, int hashcount);
accepted = linecount = 0;
while(fgets(buf, sizeof(buf), fp) != NULL)
{
+ int braceline = 0;
+
linecount++;
+ if (remove_braces)
+ {
+ char *cp;
+
+ for (cp = buf; *cp && isspace(*cp); cp++)
+ continue;
+ 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();
continue;
+ }
accepted++;
/* create new shred */