Make improvements
- Emulator can now test the αcτµαlly pδrταblε εxεcµταblε bootloader - Whipped up a webserver named redbean. It services 150k requests per second on a single core. Bundling assets inside zip enables extremely fast serving for two reasons. The first is that zip central directory lookups go faster than stat() system calls. The second is that both zip and gzip content-encoding use DEFLATE, therefore, compressed responses can be served via the sendfile() system call which does an in-kernel copy directly from the zip executable structure. Also note that red bean zip executables can be deployed easily to all platforms, since these native executables work on Linux, Mac, BSD, and Windows. - Address sanitizer now works very well
This commit is contained in:
@@ -17,16 +17,20 @@
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/limits.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
/**
|
||||
* Copies string, returning pointer to where copying ended.
|
||||
*
|
||||
* @see strcpy(), mempcpy()
|
||||
* Copies string and advances destination pointer.
|
||||
* @asyncsignalsafe
|
||||
*/
|
||||
char *stpcpy(char *dst, const char *src) {
|
||||
dst = memccpy(dst, src, '\0', SIZE_MAX);
|
||||
return dst - 1;
|
||||
char c;
|
||||
for (;;) {
|
||||
c = *src;
|
||||
*dst = c;
|
||||
if (!c) break;
|
||||
++src;
|
||||
++dst;
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -471,8 +471,6 @@ char *_strncpy(char *, const char *, size_t) asm("strncpy") memcpyesque;
|
||||
|
||||
#else /* hosted/sse2/unbloat */
|
||||
|
||||
#define memmove(DEST, SRC, SIZE) __memcpy((DEST), (SRC), (SIZE))
|
||||
|
||||
#define mempcpy(DEST, SRC, SIZE) \
|
||||
({ \
|
||||
void *Rdi, *Dest = (DEST); \
|
||||
@@ -513,21 +511,6 @@ char *_strncpy(char *, const char *, size_t) asm("strncpy") memcpyesque;
|
||||
|
||||
#endif /* hosted/sse2/unbloat */
|
||||
|
||||
#if __STDC_VERSION__ + 0 >= 201112
|
||||
#define strlen(s) \
|
||||
chooseexpr((typescompatible(typeof(s), const char[]) && \
|
||||
isconstant(((const char *)(s))[0])), \
|
||||
sizeof(s) - 1, \
|
||||
_Generic(*(s), wchar_t \
|
||||
: wcslen, char16_t \
|
||||
: strlen16, default \
|
||||
: _strlen)(s))
|
||||
#else
|
||||
#define strlen(s) \
|
||||
chooseexpr(isconstant(s) && typescompatible(typeof(s), const char[]), \
|
||||
__builtin_strlen(s), _strlen(s))
|
||||
#endif /* C11+ */
|
||||
|
||||
#define pututf16(BUF, SIZE, CH, AWESOME) __pututf16(BUF, SIZE, CH, AWESOME)
|
||||
#define getutf16(BUF, CHPTR) __getutf16(BUF, CHPTR)
|
||||
size_t _strlen(const char *s) asm("strlen") strlenesque;
|
||||
|
||||
@@ -42,10 +42,6 @@ $(LIBC_STR_A).pkg: \
|
||||
$(LIBC_STR_A_OBJS) \
|
||||
$(foreach x,$(LIBC_STR_A_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/libc/str/lz4cpy.o: \
|
||||
OVERRIDE_CFLAGS += \
|
||||
$(NO_MAGIC)
|
||||
|
||||
LIBC_STR_LIBS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)))
|
||||
LIBC_STR_SRCS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)_SRCS))
|
||||
LIBC_STR_HDRS = $(foreach x,$(LIBC_STR_ARTIFACTS),$($(x)_HDRS))
|
||||
|
||||
Reference in New Issue
Block a user