GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/vm/vm_name.c Lines: 8 8 100.0 %
Date: 2020-09-22 13:02:15 Branches: 3 4 75.0 %

Line Branch Exec Source
1
#include "gwion_util.h"
2
#include "gwion_ast.h"
3
4
860
m_str code_name_set(MemPool p, const m_str name, const m_str file) {
5
860
  const size_t len = strlen(name) + strlen(file) + 2;
6
860
  m_str str = (const m_str)_mp_malloc(p, len);
7
860
  sprintf(str, "%s$%s", name, file);
8
860
  return str;
9
}
10
11
20
m_str code_name(const m_str name, const m_bool b) {
12
20
  const m_str str = strchr(name, '$');
13

20
  return (b && str) ?  (str + 1) : name;
14
}