From 8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 27 Dec 2025 03:05:05 +0000 Subject: Do away with memcpy/memset/memcmp Now everything is either explicitly a rep thing, or explicitly some other small run of reasonably efficient instructions. No library calls or function call overhead of any kind. Code size remains nice and small. Ban a few other bad libc functions while we're at it. More can be added later if we decide that's a useful idea. This will require some discipline and workarounds to cope with Clang's tendency to shove mem* calls in places you don't want them even when you tell it not to. Well, c'est la vie. I'm a little nervous that the __builtin_memmove() usage in shuntvars() could still one day emit actual library calls. It appears we're not importing memmove() from anywhere at the moment, though. So I guess it's good enough for now. Also I had to get rid of alloca() in con_.c but that was kind of bad anyway, so that's fine. --- src/portalisg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/portalisg.c') diff --git a/src/portalisg.c b/src/portalisg.c index d7851eb..d0f5923 100644 --- a/src/portalisg.c +++ b/src/portalisg.c @@ -37,7 +37,9 @@ static con_cmdcbv2 disconnect_cb; DEF_FEAT_CCMD_HERE(sst_portal_resetisg, "Remove \"ISG\" state and disconnect from the server", 0) { // TODO(compat): OE? guess it might work by accident due to cdecl, find out - disconnect_cb(&(struct con_cmdargs){0}); + struct con_cmdargs args; // {0} does a memset(), even with -ffreestanding. + args.argc = 0; // we only actually have to init this one member. + disconnect_cb(&args); *isg_flag = false; } -- cgit v1.2.3-54-g00ecf