Beispiel #1
0
/* Sends the run info to add_to_percentages or to add_to_runs. */
void
add_run(struct text *txt0, size_t i0,
	struct text *txt1, size_t i1,
	size_t size
) {
	if (is_set_option('p')) {
		add_to_percentages(txt0, txt1, size);
	}
	else {
		add_to_runs(txt0, i0, txt1, i1, size);
	}
}
Beispiel #2
0
void
add_run(struct text *txt0, unsigned int i0,
	struct text *txt1, unsigned int i1,
	unsigned int size
) {
	/*	Adds the run of given size to our collection.
	*/
	register struct run *r = (struct run *)malloc(sizeof (struct run));

	if (!r) fatal("out of memory");
	set_chunk(&r->rn_cn0, txt0, i0 - txt0->tx_start, size);
	set_chunk(&r->rn_cn1, txt1, i1 - txt1->tx_start, size);
	r->rn_size = size;

	if (option_set('p') ? add_to_percentages(r) : add_to_runs(r)) {
		/* OK */
	}
	else	fatal("out of memory");
}
Beispiel #3
0
void
add_run(struct text *txt0, size_t i0,
	struct text *txt1, size_t i1,
	size_t size
) {
	/*	Adds the run of given size to our collection.
	*/
	struct run *r = new(struct run);

	set_chunk(&r->rn_chunk0, txt0, i0 - txt0->tx_start, size);
	set_chunk(&r->rn_chunk1, txt1, i1 - txt1->tx_start, size);
	r->rn_size = size;

#ifdef	DB_RUN
	db_run_info("Added", r, 0);
#endif	/* DB_RUN */

	if (is_set_option('p')) {
		add_to_percentages(r);
	}
	else {
		add_to_runs(r);
	}
}