rs_result rs_job_drive(rs_job_t *job, rs_buffers_t *buf, rs_driven_cb in_cb, void *in_opaque, rs_driven_cb out_cb, void *out_opaque) { rs_result result, iores; rs_bzero(buf, sizeof *buf); do { if (!buf->eof_in && in_cb) { iores = in_cb(job, buf, in_opaque); if (iores != RS_DONE) return iores; } result = rs_job_iter(job, buf); if (result != RS_DONE && result != RS_BLOCKED) return result; if (out_cb) { iores = (out_cb)(job, buf, out_opaque); if (iores != RS_DONE) return iores; } } while (result != RS_DONE); return result; }
rs_result rs_job_free(rs_job_t *job) { if (job->scoop_buf) free(job->scoop_buf); rs_bzero(job, sizeof *job); free(job); return RS_DONE; }
void * rs_alloc_struct0(size_t size, char const *name) { void *p; if (!(p = malloc(size))) { rs_fatal("couldn't allocate instance of %s", name); } rs_bzero(p, size); return p; }
/** * Deep deallocation of checksums. */ void rs_free_sumset(rs_signature_t * psums) { if (psums->block_sigs) free(psums->block_sigs); if (psums->tag_table) free(psums->tag_table); if (psums->targets) free(psums->targets); rs_bzero(psums, sizeof *psums); free(psums); }
void rs_filebuf_free(rs_filebuf_t *fb) { free(fb->buf); rs_bzero(fb, sizeof *fb); free(fb); }
void rs_signature_done(rs_signature_t *sig) { hashtable_free(sig->hashtable); rs_bzero(sig, sizeof(*sig)); }