Skip to content

Commit bddce0d

Browse files
committed
edit pal
1 parent 73beb57 commit bddce0d

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

cutils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ int has_suffix(const char *str, const char *suffix)
8484

8585
static void *dbuf_default_realloc(void *opaque, void *ptr, size_t size)
8686
{
87-
return realloc(ptr, size);
87+
return pal_realloc(ptr, size);
8888
}
8989

9090
void dbuf_init2(DynBuf *s, void *opaque, DynBufReallocFunc *realloc_func)

qjsc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ void namelist_add(namelist_t *lp, const char *name, const char *short_name,
9090
if (lp->count == lp->size) {
9191
size_t newsize = lp->size + (lp->size >> 1) + 4;
9292
namelist_entry_t *a =
93-
realloc(lp->array, sizeof(lp->array[0]) * newsize);
93+
pal_realloc(lp->array, sizeof(lp->array[0]) * newsize);
9494
/* XXX: check for realloc failure */
9595
lp->array = a;
9696
lp->size = newsize;
9797
}
9898
e = &lp->array[lp->count++];
99-
e->name = strdup(name);
99+
e->name = pal_strdup(name);
100100
if (short_name)
101-
e->short_name = strdup(short_name);
101+
e->short_name = pal_strdup(short_name);
102102
else
103103
e->short_name = NULL;
104104
e->flags = flags;
@@ -108,10 +108,10 @@ void namelist_free(namelist_t *lp)
108108
{
109109
while (lp->count > 0) {
110110
namelist_entry_t *e = &lp->array[--lp->count];
111-
free(e->name);
112-
free(e->short_name);
111+
pal_free(e->name);
112+
pal_free(e->short_name);
113113
}
114-
free(lp->array);
114+
pal_free(lp->array);
115115
lp->array = NULL;
116116
lp->size = 0;
117117
}

quickjs-debugger-transport-unix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static void js_transport_close(JSRuntime *rt, void *udata)
8888
return;
8989
close(data->handle);
9090
data->handle = 0;
91-
free(udata);
91+
pal_free(udata);
9292
}
9393

9494
void js_debugger_connect(JSContext *ctx, const char *address)

quickjs-debugger-transport-win.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void js_transport_close(JSRuntime *rt, void *udata)
125125
closesocket(data->handle);
126126
data->handle = 0;
127127

128-
free(udata);
128+
pal_free(udata);
129129

130130
WSACleanup();
131131
}

quickjs-libc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ JSModuleDef *js_module_loader(JSContext *ctx,
581581
const char *module_name, void *opaque)
582582
{
583583
JSModuleDef *m = NULL;
584-
char *module_name_dup = strdup(module_name);
584+
char *module_name_dup = pal_strdup(module_name);
585585
if (has_suffix(module_name_dup, ".module"))
586586
{
587587
size_t module_name_len = strlen(module_name_dup);
@@ -2880,8 +2880,8 @@ static JSValue js_worker_ctor(JSContext *ctx, JSValueConst new_target,
28802880
if (!args)
28812881
goto oom_fail;
28822882
memset(args, 0, sizeof(*args));
2883-
args->filename = strdup(filename);
2884-
args->basename = strdup(basename);
2883+
args->filename = pal_strdup(filename);
2884+
args->basename = pal_strdup(basename);
28852885

28862886
/* ports */
28872887
args->recv_pipe = js_new_message_pipe();

0 commit comments

Comments
 (0)