summaryrefslogtreecommitdiff
path: root/stage3/shell.c
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2024-01-09 21:22:14 +0100
committerLizzy Fleckenstein <lizzy@vlhl.dev>2024-01-09 21:26:23 +0100
commitc6e1454fbb872aed5d445d458958943556271529 (patch)
tree4951f6a95e4ddead170a355940822f8c86b6ed63 /stage3/shell.c
parent59f22bc7ce5bbadf62722f3db5c93b45e86e4cca (diff)
downloadcuddles-c6e1454fbb872aed5d445d458958943556271529.tar.xz
rename some functions to not use standard names
this avoids confusion when some of those functions differ subtly from their standard versions. free -> kfree realloc -> krealloc malloc -> kmalloc rationale: kmalloc() behaves different from malloc() in that it will never return NULL. it will panic on OOM. try_kmalloc behaves like the usual malloc. memcpy -> lmemcpy memcpy_r -> rmemcpy rationale: by design, lmemcpy() and rmemcpy() allow memory areas to overlap. the 'l' and 'r' indicate the direction of the copy operation.
Diffstat (limited to 'stage3/shell.c')
-rw-r--r--stage3/shell.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/stage3/shell.c b/stage3/shell.c
index c2fd377..0d24859 100644
--- a/stage3/shell.c
+++ b/stage3/shell.c
@@ -29,7 +29,7 @@ static void cmd_cat(str arg)
print(S("\n"));
} else {
print(f);
- free(f.data);
+ kfree(f.data);
}
}
@@ -47,7 +47,7 @@ static void cmd_font(str arg)
else
print(S("font: invalid file size\n"));
- free(f.data);
+ kfree(f.data);
}
}
@@ -86,7 +86,7 @@ static void cmd_img(str arg)
(void *) (f.data + 2 * sizeof(u32)));
}
- free(f.data);
+ kfree(f.data);
}
}
@@ -122,7 +122,7 @@ static void cmd_run(str arg)
shell_run_cmd(cmd);
}
- free(f.data);
+ kfree(f.data);
}
}
@@ -138,11 +138,11 @@ static void cmd_loadkeys(str arg)
print(S("\n"));
} else {
if (f.len == 256)
- memcpy(keymap, f.data, 256);
+ lmemcpy(keymap, f.data, 256);
else
print(S("loadkeys: invalid file size\n"));
- free(f.data);
+ kfree(f.data);
}
}
@@ -165,11 +165,11 @@ static void cmd_love(str arg)
if (start < 0 || start + arg.len > f.len) {
print(S("love: argument too long (owo it's too big for me)\n"));
} else {
- memcpy(f.data+start, arg.data, arg.len);
+ lmemcpy(f.data+start, arg.data, arg.len);
print(f);
}
- free(f.data);
+ kfree(f.data);
}
}
@@ -220,11 +220,11 @@ static void cmd_ls(str arg)
print(S(" files"));
}
print_char('\n');
- free(d.data[i].name.data);
+ kfree(d.data[i].name.data);
}
if (d.data != nil)
- free(d.data);
+ kfree(d.data);
}
void cmd_shutdown(str arg)
@@ -313,7 +313,7 @@ static void cmd_choose(str arg)
print_char('\n');
}
- free(f.data);
+ kfree(f.data);
}
}