dte test coverage


Directory: ./
File: src/util/intern.h
Date: 2024-12-21 16:03:22
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 2 2 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 #ifndef UTIL_INTERN_H
2 #define UTIL_INTERN_H
3
4 #include <stddef.h>
5 #include <string.h>
6 #include "macros.h"
7 #include "string-view.h"
8
9 const void *mem_intern(const void *data, size_t len) NONNULL_ARGS_AND_RETURN;
10 void free_interned_strings(void);
11
12 383 static inline const char *str_intern(const char *str)
13 {
14 383 return mem_intern(str, strlen(str));
15 }
16
17 8 static inline StringView strview_intern(const char *str)
18 {
19 8 size_t len = strlen(str);
20 8 return string_view(mem_intern(str, len), len);
21 }
22
23 #endif
24