[LibOS] Get rid of qstrtostr()

Used in one place. Needed to remove non-standard use of alloca.
This commit is contained in:
Paweł Marczewski
2020-09-07 17:12:16 +00:00
committed by Dmitrii Kuvaiskii
parent f883d05317
commit d8930fb4ac
2 changed files with 6 additions and 14 deletions
-13
View File
@@ -145,19 +145,6 @@ void* malloc(size_t size);
void free(void* mem);
void* malloc_copy(const void* mem, size_t size);
static inline __attribute__((always_inline)) char* qstrtostr(struct shim_qstr* qstr, bool on_stack) {
int len = qstr->len;
char* buf = on_stack ? __alloca(len + 1) : malloc(len + 1);
if (!buf)
return NULL;
memcpy(buf, qstrgetstr(qstr), len);
buf[len] = 0;
return buf;
}
/* typedef a 32 bit type */
#ifndef UINT4
#define UINT4 uint32_t
+6 -1
View File
@@ -1504,8 +1504,13 @@ retry:
if (!p->port) {
IDTYPE type = IPC_PORT_OWNER | IPC_PORT_LISTEN;
IDTYPE owner = p->vmid;
char* uri = qstrtostr(&p->uri, true);
struct shim_ipc_port* port = NULL;
size_t uri_len = p->uri.len;
char uri[uri_len + 1];
memcpy(&uri, qstrgetstr(&p->uri), uri_len);
uri[uri_len] = 0;
unlock(&range_map_lock);
PAL_HANDLE pal_handle = DkStreamOpen(uri, 0, 0, 0, 0);