Lines Matching defs:hc

54 void BC_free_history(struct BC_history *hc) {
55 if (hc) {
56 if (hc->h_mounts)
57 free(hc->h_mounts);
58 if (hc->h_entries)
59 free(hc->h_entries);
60 free(hc);
554 BC_convert_history(const struct BC_history *hc, struct BC_playlist **ppc)
565 if (hc == NULL) {
576 if ((pc->p_mounts = malloc(sizeof(*pc->p_mounts) * hc->h_nmounts)) == NULL) {
581 for (hm = hc->h_mounts; hm < (hc->h_mounts + hc->h_nmounts); hm++) {
591 if ((pc->p_entries = malloc(sizeof(*pc->p_entries) * hc->h_nentries)) == NULL) {
598 for (he = hc->h_entries; he < (hc->h_entries + hc->h_nentries); he++) {
615 if (he->he_mount_idx >= hc->h_nmounts) {
616 warnx("History entry %ld referenced mount index %d, but there are only %d mounts", (long)(he - hc->h_entries), he->he_mount_idx, hc->h_nmounts);
621 hm = hc->h_mounts + he->he_mount_idx;
709 struct BC_history *hc;
735 if ((hc = calloc(1, sizeof(*hc))) == NULL) {
745 if ((hc->h_mounts = malloc(bc.bc_data1_size)) == NULL) {
747 HC_FREE_ZERO(hc);
750 if ((hc->h_entries = malloc(bc.bc_data2_size)) == NULL) {
752 HC_FREE_ZERO(hc);
755 hc->h_nmounts = bc.bc_data1_size / sizeof(struct BC_history_mount);
756 hc->h_nentries = bc.bc_data2_size / sizeof(struct BC_history_entry);
758 bc.bc_data1 = (uintptr_t) hc->h_mounts;
759 bc.bc_data2 = (uintptr_t) hc->h_entries;
764 HC_FREE_ZERO(hc);
768 if (hc->h_mounts || hc->h_entries) {
769 hc->h_nmounts = bc.bc_data1_size / sizeof(struct BC_history_mount);
770 hc->h_nentries = bc.bc_data2_size / sizeof(struct BC_history_entry);
773 *phc = hc;
1280 BC_print_history(char *fname, struct BC_history *hc)
1294 for (i = 0; i < hc->h_nentries; i++) {
1296 uuid_string(hc->h_mounts[hc->h_entries[i].he_mount_idx].hm_uuid),
1297 hc->h_entries[i].he_offset, hc->h_entries[i].he_length,
1298 hc->h_entries[i].he_pid,
1299 hc->h_entries[i].he_flags & BC_HE_HIT ? " hit" :
1300 hc->h_entries[i].he_flags & BC_HE_WRITE ? " write" :
1301 hc->h_entries[i].he_flags & BC_HE_TAG ? " tag" : " miss",
1302 hc->h_entries[i].he_flags & BC_HE_SHARED ? " shared" : "");