MCPcopy Create free account
hub / github.com/coreboot/coreboot / fmd_create

Function fmd_create

util/cbfstool/fmd.c:290–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290struct flashmap_descriptor *fmd_create(FILE *stream)
291{
292 assert(stream);
293
294 yyin = stream;
295
296 struct flashmap_descriptor *ret = NULL;
297 if (yyparse() == 0)
298 ret = res;
299
300 yylex_destroy();
301 yyin = NULL;
302 res = NULL;
303
304 if (ret) {
305 // This hash table is used to store the declared name of each
306 // section and ensure that each is globally unique.
307 if (!hcreate(fmd_count_nodes(ret))) {
308 perror("E: While initializing hashtable");
309 fmd_cleanup(ret);
310 return NULL;
311 }
312
313 // Even though we haven't checked that the root node (ret) has
314 // a size field as required by this function, the parser
315 // warrants that it does because the grammar requires it.
316 if (!validate_and_complete_info(ret)) {
317 hdestroy();
318 fmd_cleanup(ret);
319 return NULL;
320 }
321
322 hdestroy();
323 }
324
325 return ret;
326}
327
328void fmd_cleanup(struct flashmap_descriptor *victim)
329{

Callers 1

mainFunction · 0.85

Calls 4

fmd_count_nodesFunction · 0.85
perrorFunction · 0.85
fmd_cleanupFunction · 0.85

Tested by

no test coverage detected