- ret = find_protostr(protostr, sizeof(protostr), fhdr, hdrfn, sym);
- if (ret != 0) {
+static void build_pp_cache(FILE *fhdr)
+{
+ long pos;
+ int ret;
+
+ pos = ftell(fhdr);
+ rewind(fhdr);
+
+ ret = do_protostrs(fhdr, hdrfn);
+ if (ret < 0)
+ exit(1);
+
+ qsort(pp_cache, pp_cache_size, sizeof(pp_cache[0]), pp_name_cmp);
+ fseek(fhdr, pos, SEEK_SET);
+}
+
+static const struct parsed_proto *proto_parse(FILE *fhdr, const char *sym,
+ int quiet)
+{
+ const struct parsed_proto *pp_ret;
+ struct parsed_proto pp_search;
+ char *p;
+
+ if (pp_cache == NULL)
+ build_pp_cache(fhdr);
+
+ if (sym[0] == '_') // && strncmp(fname, "stdc", 4) == 0)
+ sym++;
+
+ strcpy(pp_search.name, sym);
+ p = strchr(pp_search.name, '@');
+ if (p != NULL)
+ *p = 0;
+
+ pp_ret = bsearch(&pp_search, pp_cache, pp_cache_size,
+ sizeof(pp_cache[0]), pp_name_cmp);
+ if (pp_ret == NULL && !quiet)