MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / preload_parse

Function preload_parse

tinyemu/fs_net.c:2414–2434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2412}
2413
2414static int preload_parse(FSDevice *fs, const char *fname, BOOL is_new)
2415{
2416 FSINode *n;
2417 char *buf;
2418 size_t size;
2419
2420 n = inode_search_path(fs, fname);
2421 if (!n || n->type != FT_REG || n->u.reg.state != REG_STATE_LOADED)
2422 return -1;
2423 /* transform to zero terminated string */
2424 size = n->u.reg.size;
2425 buf = malloc(size + 1);
2426 file_buffer_read(&n->u.reg.fbuf, 0, (uint8_t *)buf, size);
2427 buf[size] = '\0';
2428 if (is_new)
2429 preload_parse_str(fs, buf);
2430 else
2431 preload_parse_str_old(fs, buf);
2432 free(buf);
2433 return 0;
2434}
2435
2436
2437

Callers 1

kernel_load_cbFunction · 0.85

Calls 4

inode_search_pathFunction · 0.85
file_buffer_readFunction · 0.85
preload_parse_strFunction · 0.85
preload_parse_str_oldFunction · 0.85

Tested by

no test coverage detected