Lines Matching refs:h
92 struct srcfile *h; in find_srcfile() local
97 hlist_for_each_entry (h, &srcfile_htab[hval], hash_nd) { in find_srcfile()
98 if (!strcmp(fn, h->fn)) { in find_srcfile()
100 list_move(&h->nd, &srcfile_list); in find_srcfile()
101 return h; in find_srcfile()
109 h = list_entry(srcfile_list.prev, struct srcfile, nd); in find_srcfile()
110 free_srcfile(h); in find_srcfile()
119 h = malloc(sizeof(struct srcfile)); in find_srcfile()
120 if (!h) in find_srcfile()
123 h->fn = strdup(fn); in find_srcfile()
124 if (!h->fn) in find_srcfile()
127 h->maplen = st.st_size; in find_srcfile()
128 sz = (h->maplen + page_size - 1) & ~(page_size - 1); in find_srcfile()
129 h->map = mmap(NULL, sz, PROT_READ, MAP_SHARED, fd, 0); in find_srcfile()
131 if (h->map == (char *)-1) { in find_srcfile()
135 h->numlines = countlines(h->map, h->maplen); in find_srcfile()
136 h->lines = calloc(h->numlines, sizeof(char *)); in find_srcfile()
137 if (!h->lines) in find_srcfile()
139 fill_lines(h->lines, h->numlines, h->map, h->maplen); in find_srcfile()
140 list_add(&h->nd, &srcfile_list); in find_srcfile()
141 hlist_add_head(&h->hash_nd, &srcfile_htab[hval]); in find_srcfile()
142 map_total_sz += h->maplen; in find_srcfile()
144 return h; in find_srcfile()
147 munmap(h->map, sz); in find_srcfile()
149 zfree(&h->fn); in find_srcfile()
151 free(h); in find_srcfile()