time: add is_leap_year function

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Enable -Wswitch-enum warnings

This compiler option enables warnings about switch statements on enums that
do not exhaustively list every value.  The default case does *not* squelch
the warning.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
synch: minor mutex lock checking optimization

This saves 23 bytes of instructions on amd64 which is not worth it, but we
will need the out label for recursive lock policies anyway.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
synch: remove barrier support

This was added more than half a decade ago and gotten zero use.  To make
matters worse, macOS doesn't seem to have pthread_barrier_t.  So let's just
remove barrier support to aid portability and maintainability.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
synch: improve mutex deadlock panic message

On FreeBSD (and possibly other systems) the strerror(EDEADLK) returns
"Resource deadlock avoided".  This makes sense, but makes for a really
strange panic message:

	PANIC mutex lock failed @ .../obj.c:188: Resource deadlock avoided

The simplest fix is to catch EDEADLK and use a custom string instead.

This could have been done in xstrerror, but I'm not convinced that libc's
string is universally bad.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
int: add str2float and str2double

These functions are similar to str2u* but instead of parsing an unsigned
int, they parse a floating point number.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
build: use the correct g++ executable names on debian

This error snuck in because of test failures in an earlier task.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
sexpr: dump only 7-bit chars as #\foo

isprint(3) on Linux can return true for codepoints >= 256 (not necessarily
wrong), which don't interact well with the %c printf format.  So, at least
for now, let's force any character >= 128 to get printed in hex (#\uXXXX).

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
build: add builds.sr.ht build manifests & script

These build libjeffpc with a variety of gcc and clang versions on FreeBSD
and Debian.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
man: fix lint test manpage paths

When building out-of-tree, the lint invocation would fail because it would
be looking for the manpages in the binary directory.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Added tag v0.22-rc1 for changeset 3b8b413277d9

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
libjeffpc 0.22-rc1

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
sexpr: use %define api.pure instead of %pure-parser

%pure-parser got deprecated a number of years ago.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
buffer: add buffer_delete

Removes arbitrary number of bytes at arbitrary offset into the buffer.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
buffer: add buffer_insert & buffer_insert_c

Like appending, but at any offset - not just at the end of existing data.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
buffer: test appending 1 MB in 1 kB chunks

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
buffer: replace pointless sink append test with one that appends 1kB

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
buffer: rename inner_loop test helper function

It is append-specific.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Ignore .dylib versions of the library

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
error: fall back to abort for assertion_failed

This way porting to new OSes is easier.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Next