Commit Graph
357 Commits
Author SHA1 Message Date
lassik 08027cac9b Add some missing system includes
Uncovered by Linux build
2019-08-10 01:02:27 +03:00
lassik 10763df501 Add fallthrough comments to switch cases
Some versions of GCC warn otherwise, which is good.
2019-08-10 01:01:40 +03:00
lassik 2ec07684d2 Get OS name from uname()
This implies that OS names have changed. Unix-like OS names are now
capitalized. "macos" is now "Darwin". Windows is now all-lowecase "windows".
"win32" is gone. "win64" was not used in the original code despite a reference
to it.
2019-08-10 00:35:16 +03:00
lassik be6a18175f Add const qualifier to some symbol/keyword functions 2019-08-10 00:30:20 +03:00
lassik 3751d83390 Remove unneeded prototypes using sockaddr_in 2019-08-10 00:16:30 +03:00
lassik e9d6ca265c Unify preprocessor checks for win32
<https://sourceforge.net/p/predef/wiki/OperatingSystems/> says that _WIN32 is
always defined for both 32-bit and 64-bit versions of Windows.
2019-08-10 00:12:33 +03:00
lassik 267cd00146 Remove unnecessary ifdef about unsetenv() return value
Posix now mandates that unsetenv() must return -1 and set errno on error.
2019-08-10 00:05:31 +03:00
lassik 95a1c1032c Remove ifdef about memrchr() on MacOS
MacOS doesn't have memrchr() so there was an ifdef with a custom
implementation for it. Get rid of the ifdef by always using the custom
implementation.
2019-08-10 00:02:14 +03:00
lassik daaa5aaed0 Break down timefuncs.c to unix and windows 2019-08-09 23:56:18 +03:00
lassik 8a7ce61575 Replace uses of alloca() with malloc()
Gets rid of more #ifdef magic.
2019-08-09 23:45:10 +03:00
lassik 41f6dbc1a2 Assume 64-bit pointers for now
To get rid of ifdef complexity. Put 32-bit support back in later.
2019-08-09 23:35:50 +03:00
lassik d95a4660ad Fix missing NULL definition on FreeBSD 2019-08-09 23:31:27 +03:00
lassik b0203bb89e Add more missing stdint.h includes 2019-08-09 23:31:21 +03:00
lassik a28aff6892 Add missing stdint.h includes 2019-08-09 23:25:20 +03:00
lassik 1d96278313 Break down dirpath.c into fs_*.c by OS
I much prefer this to using ifdefs. Requires a little help from the build
system but I find it worth it.
2019-08-09 23:12:19 +03:00
lassik 99feb308bd Hoist argcount() into its own header file
Muffles compiler warnings about unused function.
2019-08-09 22:08:44 +03:00
lassik 2610213b42 Do not include bswap* all over the place 2019-08-09 22:04:55 +03:00
lassik a7296eeca5 Remove unused 64-bit byte swap 2019-08-09 22:03:36 +03:00
lassik 4f047eb187 Replace BSD bzero() with standard memset() 2019-08-09 21:57:26 +03:00
lassik 2b65fe4cef Remove unnecessary MacOS-specific includes 2019-08-09 21:56:23 +03:00
lassik e19fe0b8bd Remove time.string and time.fromstring builtins
They are of dubious value, and the C implementation uses #if.
2019-08-09 21:50:52 +03:00
lassik 36e2057616 Do not include count_bits() all over the place 2019-08-09 21:41:37 +03:00
lassik c84c71adcc Get rid of INLINE and STATIC_INLINE
Nowadays compilers have good optimizers that know when to inline static
functions depending on the user's chosen optimization level (and speed vs size
optimization). We don't need to annotate functions manually.
2019-08-09 21:35:20 +03:00
lassik 12fb30462b Simplify endian (byte order) detection
The following:

    #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
    #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__

are apparently semi-standard nowadays.
2019-08-09 21:30:30 +03:00
lassik 5817003816 Replace index_t with uintptr_t 2019-08-09 21:13:48 +03:00
lassik c0ef0c2549 Remove more useless typedefs 2019-08-09 21:11:40 +03:00
lassik 36fd757689 Replace ptrint_t with standard intptr_t 2019-08-09 21:07:16 +03:00
lassik b35ab48437 Replace "preferred int type" with intptr_t 2019-08-09 21:04:19 +03:00
lassik d6a4029dde Replace idiosyncratic C types with standard ones
For number types, we rely on classic C types (char, short, int, long) to be
the correct sizes. For precise bit widths, use standard intN_t and uintN_t.
For size_t, just use system size_t.
2019-08-09 21:00:03 +03:00
lassik d5d7406276 Remove unused Boehm GC hooks 2019-08-09 20:37:42 +03:00
lassik 10ffed569e Fix build errors and warnings for OpenBSD 2019-08-09 20:20:17 +03:00
lassik b7b4269455 Replace strcpy() and strcat() with safer functions 2019-08-09 20:14:42 +03:00
lassik b5946dea77 Remove unused INITFILE config option 2019-08-09 20:11:02 +03:00
lassik bb78dc0634 Fix compiler warnings (clang -Wextra) 2019-08-09 19:53:35 +03:00
lassik 7d93f262a7 Set C compiler options -Wextra -std=gnu99 2019-08-09 19:50:21 +03:00
lassik 45a7ec7bc4 Remove include protections
Since we no longer have recursive includes, we don't need them. Removing the
protections uncovered a couple of accidental double-includes: good.
2019-08-09 19:47:22 +03:00
lassik fe4550dad7 Replace cvalue_t with struct 2019-08-09 19:36:20 +03:00
lassik b48261f21c Replace fltype_t with struct 2019-08-09 19:33:04 +03:00
lassik c9f5e4faeb Replace symbol_t with struct 2019-08-09 19:30:15 +03:00
lassik 193ced5e73 Replace cons_t with struct 2019-08-09 19:28:14 +03:00
lassik d6f1579e17 Replace cprim_t with struct 2019-08-09 19:26:48 +03:00
lassik fdcdd865b4 Replace function_t with struct 2019-08-09 19:26:48 +03:00
lassik ece07d2e1a Replace cvtable_t with struct 2019-08-09 19:26:48 +03:00
lassik 428e7a3825 Replace builtinspec_t with struct 2019-08-09 19:26:48 +03:00
lassik e54797e4eb Replace fl_exception_context_t with struct 2019-08-09 19:26:48 +03:00
lassik 262ace1efd Replace fl_readstate_t with struct 2019-08-09 19:26:42 +03:00
lassik b561f9d4b0 Replace gensym_t with struct 2019-08-09 19:26:33 +03:00
lassik f2fb37e520 Replace ios_t with struct 2019-08-09 19:26:20 +03:00
lassik 41cf0e7b2c Replace htable_t with struct 2019-08-09 19:26:09 +03:00
lassik 79d44c0780 Get rid of almost all recursive includes
Simple rule: include files should never include include files.

"Notes on Programming in C", Rob Pike, February 21, 1989
<https://www.lysator.liu.se/c/pikestyle.html>
2019-08-09 19:00:17 +03:00