| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "gwion_util.h" | ||
| 2 | #include "gwion_ast.h" | ||
| 3 | |||
| 4 | 752 | m_str code_name_set(MemPool p, const m_str name, const m_str file) { | |
| 5 | 752 | const m_str search = strrchr(name, '@'); | |
| 6 |
2/2✓ Branch 0 taken 348 times.
✓ Branch 1 taken 404 times.
|
752 | const m_str is_file = search ? search + 1 : name; |
| 7 |
2/2✓ Branch 0 taken 467 times.
✓ Branch 1 taken 285 times.
|
752 | if(!strcmp(is_file, file)) { |
| 8 | 467 | return mstrdup(p, name); | |
| 9 | } | ||
| 10 | 285 | const size_t len = strlen(name) + strlen(file) + 2; | |
| 11 | 285 | const m_str str = (const m_str)_mp_malloc(p, len); | |
| 12 | 285 | sprintf(str, "%s$%s", name, file); | |
| 13 | 285 | return str; | |
| 14 | } | ||
| 15 | |||
| 16 | ✗ | m_str code_name(const m_str name, const bool b) { | |
| 17 | ✗ | const m_str str = strchr(name, '$'); | |
| 18 | ✗ | return (b && str) ? (str + 1) : name; | |
| 19 | } | ||
| 20 |