Lines Matching refs:library
77 struct library_info *library; in get_library() local
103 library = calloc(1, sizeof(*library)); in get_library()
104 if (!library) { in get_library()
108 library->name = malloc(strlen(name) + 1); in get_library()
109 if (!library->name) { in get_library()
113 strcpy(library->name, name); in get_library()
114 library->mappings = malloc(INIT_MAPPINGS * sizeof(struct mapping_info *)); in get_library()
115 if (!library->mappings) { in get_library()
119 library->mappings_count = 0; library->mappings_size = INIT_MAPPINGS; in get_library()
120 pm_memusage_zero(&library->total_usage); in get_library()
122 libraries[libraries_count++] = library; in get_library()
124 return library; in get_library()
127 struct mapping_info *get_mapping(struct library_info *library, struct process_info *proc) { in get_mapping() argument
131 for (i = 0; i < library->mappings_count; i++) { in get_mapping()
132 if (library->mappings[i]->proc == proc) in get_mapping()
133 return library->mappings[i]; in get_mapping()
136 if (library->mappings_count >= library->mappings_size) { in get_mapping()
137 library->mappings = realloc(library->mappings, in get_mapping()
138 2 * library->mappings_size * sizeof(struct mapping*)); in get_mapping()
139 if (!library->mappings) { in get_mapping()
143 library->mappings_size = 2 * library->mappings_size; in get_mapping()
154 library->mappings[library->mappings_count++] = mapping; in get_mapping()