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

Function compose_path

tinyemu/fs_utils.c:44–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42const uint8_t encrypted_file_magic[4] = { 0xfb, 0xa2, 0xe9, 0x01 };
43
44char *compose_path(const char *path, const char *name)
45{
46 int path_len, name_len;
47 char *d, *q;
48
49 if (path[0] == '\0') {
50 d = strdup(name);
51 } else {
52 path_len = strlen(path);
53 name_len = strlen(name);
54 d = malloc(path_len + 1 + name_len + 1);
55 q = d;
56 memcpy(q, path, path_len);
57 q += path_len;
58 if (path[path_len - 1] != '/')
59 *q++ = '/';
60 memcpy(q, name, name_len + 1);
61 }
62 return d;
63}
64
65char *compose_url(const char *base_url, const char *name)
66{

Callers 1

compose_urlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected