class FastMmapedFile
Constants
- MAP_SHARED
Public Class Methods
to_metrics(p1)
click to toggle source
VALUE method_to_metrics(VALUE UNUSED(self), VALUE file_list) { struct hashmap map; hashmap_setup(&map); if (!aggregate_files(&map, file_list)) { // all entries in map are now copies that need to be disposed hashmap_destroy(&map); raise_last_exception(); return Qnil; } entry_t **sorted_entries; if (!sort_map_entries(&map, &sorted_entries)) { hashmap_destroy(&map); raise_last_exception(); return Qnil; } VALUE rv = rb_str_new("", 0); if (!entries_to_string(rv, sorted_entries, hashmap_size(&map))) { free(sorted_entries); hashmap_destroy(&map); raise_last_exception(); return Qnil; } RB_GC_GUARD(file_list); // ensure file list is not GCed before this point free(sorted_entries); hashmap_destroy(&map); return rv; }