Commit graph

447 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
09cb4bacf6 Clean up the cryb_sha1(3) man page and add man pages for the SHA-2 functions. 2016-09-17 16:50:12 +02:00
Dag-Erling Smørgrav
9c1988fa17 Add missing third clause to new files. 2016-09-17 16:22:19 +02:00
Dag-Erling Smørgrav
a36c6ba31c Add tests for each library's cryb_foo_version() function.
This may seem stupid, but I've found bugs in the past which would have been caught by unit tests which I didn't write because they seemed stupid.
2016-09-17 16:14:00 +02:00
Dag-Erling Smørgrav
e78c0f811b Remove unneeded #includes. 2016-09-17 16:05:31 +02:00
Dag-Erling Smørgrav
d9b6740247 Implement the full range of BSD endianness conversion functions. 2016-09-15 11:18:01 +02:00
Dag-Erling Smørgrav
1ce9c07b8b Add support for __builtin_bswap16. 2016-09-15 11:09:34 +02:00
Dag-Erling Smørgrav
acb4f9f1bc Import AX_GCC_BUILTIN from the GNU Autoconf Archive. 2016-09-15 11:09:16 +02:00
Dag-Erling Smørgrav
e276f2b407 Ensure that we always have off_t and ssize_t in scope.
POSIX requires <stdio.h> and <unistd.h> to define off_t and ssize_t like <sys/types.h> does, but not all platforms respect that.  Play it safe by always including <sys/types.h>.
2016-09-15 10:15:00 +02:00
Dag-Erling Smørgrav
8d7b6439ae Fix signed / unsigned mismatch. 2016-09-05 15:46:29 +02:00
Dag-Erling Smørgrav
85f75bba42 Rename a few more files. 2016-09-04 16:34:30 +02:00
Dag-Erling Smørgrav
f76b9958f7 Only run Coverity Scan on the "scan" branch. 2016-09-04 16:32:17 +02:00
Dag-Erling Smørgrav
04d737a258 Include <unistd.h> for ssize_t, which is used by the string library. 2016-09-04 16:20:24 +02:00
Dag-Erling Smørgrav
a6eb5d4f68 Respect user's CC 2016-09-04 16:18:13 +02:00
Dag-Erling Smørgrav
d9fbbe245f Bump version 2016-09-04 15:04:26 +02:00
Dag-Erling Smørgrav
06a757e878 Big reorganization and cleanup 2016-09-04 14:56:39 +02:00
Dag-Erling Smørgrav
c030e63ef2 Bump version 2016-03-21 12:35:42 +01:00
Dag-Erling Smørgrav
401465d8ea Move main() from libcryb-test to the test program.
Instead of having libcryb-test provide main() and assume that the test program defines t_prepare() and t_cleanup(), have libcryb-test provide a t_main() function which the test program calls with pointers to its prepare and cleanup functions.
2016-03-15 14:29:44 +01:00
Dag-Erling Smørgrav
c68fd1098d We need <cryb/attributes.h> here for the CRYB_PRINTF() macro. 2016-03-15 14:28:47 +01:00
Dag-Erling Smørgrav
34fe861a36 <cryb/coverage.h> needs to be installed along with libcryb-test. 2016-03-15 14:27:02 +01:00
Dag-Erling Smørgrav
61a83a1fae Cosmetic: use angle brackets instead of double quotes 2016-03-15 14:26:32 +01:00
Dag-Erling Smørgrav
4d1703c77a Don't try to memset NULL if allocation fails.
Always emit UTRACE records, even for failed allocations.
When allocating more than was requested, fill the slop with garbage.
2016-02-19 12:23:17 +01:00
Dag-Erling Smørgrav
1d0f2a4ff3 Reserve room in the label buffer for the terminating NUL. 2016-02-19 12:20:25 +01:00
Dag-Erling Smørgrav
3fbaf4e647 Enable Coverity Scan addon. 2016-02-19 11:41:39 +01:00
Dag-Erling Smørgrav
0917eee32e Move configure to before_script. 2016-02-19 11:15:13 +01:00
Dag-Erling Smørgrav
c044f2580b Fix buffer over-read in percent_decode().
When decoding a trigram, percent_decode() would correctly increment the input pointer by an extra two characters (three total) but would not decrement the input length by the same amount.  This would result in a buffer over-read when decoding unterminated strings.
2016-01-10 23:29:03 +01:00
Dag-Erling Smørgrav
476374323d Vastly improve unit tests for percent-encoding API. 2016-01-10 23:28:04 +01:00
Dag-Erling Smørgrav
e40f2f7d4b Improve and document percent-encoding API.
- Ensure that the output is always NUL-terminated.
- Always include the terminating NUL in the returned length.
- Allow out == NULL, allowing the caller to check how much space is required before allocating.
- Add man page.
2016-01-10 23:25:28 +01:00
Dag-Erling Smørgrav
6eaaac308f Add a t_compare_strn() function which is to t_compare_str() what strncmp() is to
strcmp().
2016-01-10 18:49:19 +01:00
Dag-Erling Smørgrav
d2a98cd870 Generate .xz tarball by default, not .gz 2016-01-09 20:26:40 +01:00
Dag-Erling Smørgrav
e370978433 Run BullseyeCoverage tools quietly 2016-01-09 20:23:33 +01:00
Dag-Erling Smørgrav
9905f08c80 Change tarname to cryb-to to match github project name etc. 2016-01-09 20:16:04 +01:00
Dag-Erling Smørgrav
afe99d57dd Bump internal version number. 2016-01-09 20:12:01 +01:00
Dag-Erling Smørgrav
2237a13d5b Hide the no-op default case when not instrumenting for coverage analysis. 2016-01-09 18:37:36 +01:00
Dag-Erling Smørgrav
e5b9a12a35 Add -Wshadow. 2016-01-09 18:37:05 +01:00
Dag-Erling Smørgrav
da40b1fad8 Add man pages for a few functions. 2016-01-08 17:27:27 +01:00
Dag-Erling Smørgrav
6fd1a01fd2 Activate Travis CI 2015-12-15 21:55:35 +01:00
Dag-Erling Smørgrav
f9c8ce7c65 Build system overhaul 2015-12-14 18:08:22 +01:00
Dag-Erling Smørgrav
278ff6d113 GC empty directory 2015-12-14 17:51:01 +01:00
Dag-Erling Smørgrav
0995671d43 Don't rely on side effects between sequence points 2015-12-14 17:49:49 +01:00
Dag-Erling Smørgrav
f04b77e2a5 typo 2015-12-14 16:05:18 +01:00
Dag-Erling Smørgrav
4d7893004c Prepare for moving to Github 2015-12-14 15:55:38 +01:00
Dag-Erling Smørgrav
d69c5dcdf8 Correct copyright ranges 2015-12-14 15:55:04 +01:00
Dag-Erling Smørgrav
5584b68908 Fix t_malloc_snapshot(): stash the difference between nalloc and nfree,
not the numbers themselves.

In t_malloc_printstats(), show information about mapped allocations.

In t_malloc_leaked(), check for leaked mapped allocations.  Note that
they would show up anyway since the metadata are allocated from the
bucket allocator, but this makes them more visible.
2015-11-02 19:45:12 +00:00
Dag-Erling Smørgrav
7b48030ada Revert accidental commit 2015-11-02 19:34:54 +00:00
Dag-Erling Smørgrav
955cbc3013 Add t_malloc_snapshot() which writes a snapshot of the allocator state to
a caller-provided buffer.  Use it to warn about leaks in each individual
test case.  Note that we can't fail a test case for leaking, because
individual test cases in a unit may modify shared state which is cleaned
up at the end of the series.
2015-11-02 19:34:03 +00:00
Dag-Erling Smørgrav
3e88a08c10 Clean up a bit and add more test cases, including comprehensive tests for
string_append_{cs,string}().
2015-10-13 21:44:37 +00:00
Dag-Erling Smørgrav
fd515ccd79 Clear up confusion between lengths and sizes.
Fix a harmless bug in string_shrink().
2015-10-13 21:42:57 +00:00
Dag-Erling Smørgrav
0a9f2c21fe When running a test, make sure it didn't leave allocation failure enabled.
Add predicates for null and non-null pointers.
Staticize some internal allocator state.
2015-10-13 21:39:47 +00:00
Dag-Erling Smørgrav
4fa82f7c7b Simplify existing tests:
- Set t_malloc_fatal so we don't have to check for allocation failures
  (the driver will catch the SIGABRT).
- Use string_dup_cs() instead of string_new() + string_append_cs().
2015-10-13 20:22:07 +00:00
Dag-Erling Smørgrav
454603d4f1 Add <unistd.h> to more files. FreeBSD's namespace pollution hides these
errors.
2015-10-12 11:45:26 +00:00