Commit Graph

6 Commits

Author SHA1 Message Date
Dan Cross cf766e3e67 Trivial clang-format changes
Changes from a clang-format run.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
2018-10-12 10:12:45 +10:00
Dan Cross d8c32639e4 Trivial whitespace cleanups
Delete trailing whitespace at the ends of lines;
ensure files have newlines at the end.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
2018-10-11 21:36:35 +10:00
Dan Cross 1c7849b724 Fix a bug in stralloc_starts() and add a test.
strcalloc_starts() should have tested the return value
of `memcmp` against 0 for equality.  Fixed and added a
test case.

As an aside, one might wonder how bugs like that are
creeping into well-tested code imported from other
projects?  The answer, specific to stralloc, is that
the original code was very specific to qmail, and used
a number of additional functions specific to qmail.

Rather than import half of qmail, the version imported
into Magicka has been reworked to, instead, use
standard C functions.  The process of modifying the
code gave rise to the opportunity for bugs to creep in.
Now that a unit testing framework is in place, we can
test things in isolation more easily and hopefully
catch such things BEFORE they are published to the
master repository.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
2018-10-11 21:36:29 +10:00
Andrew Pamment 15d09ed57a Fix a couple of bugs, one in stralloc and one uninitialized ptr vector 2018-10-11 15:25:00 +10:00
Dan Cross 77bf763939 Start using stralloc.
Clean up a few web page generation functions.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
2018-10-11 13:58:03 +10:00
Dan Cross 9a7ceeee3d Import a (modernized) version of djb's `stralloc` library.
Lots of code in Magicka is involved in dynamic string manipulation.
`stralloc` isn't a bad library for this sort of thing.

Note that this is complements, but doesn't replace, existing string
utilities.

Signed-off-by: Dan Cross <patchdev@fat-dragon.org>
2018-10-11 11:45:12 +10:00