Merge topic branch t/overflow into master This series implements a new memory allocation API which checks for overflows. The first part of the series just renames the main allocation functions. Later patches in the series implement allocators which take two size_t arguments (like calloc(3)) and check whether the multiplication overflows by employing the __builtin_mul_overflow() primitive supported by gcc and clang. This requires us to bump the lowest supported gcc and clang version. * refs/heads/t/overflow: build: Compile with -ftrapv. string: Introduce arr_zalloc(). string: Introduce arr_alloc(). string: Introduce arr_realloc() and check for integer overflow. string: Rename para_calloc() -> zalloc(). string: Rename para_malloc() -> alloc(). string: Overhaul para_strdup().
Rename ->{pre,post}_select methods to ->{pre,post}_monitor. The word "monitor" is neutral and continues to be correct after the switch from select(2) to poll(2). Pure rename, nothing to see here.
string: Introduce arr_alloc(). Change all callers of alloc() which pass a product of two integers as the allocation size to call the new function instead. This function aborts if the multiplication overflows. With arr_alloc() in place, alloc() reduces to a trivial wrapper which calls new arr_alloc() with the first argument equal to one.
string: Rename para_calloc() -> zalloc(). Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes.
string: Rename para_malloc() -> alloc(). Just because it's shorter and matches the naming of the new allocators we are about to introduce. The bulk of this patch was created with sed -i 's/para_malloc/alloc/g' *.c *.h yy/mp.y
Shorten copyright notice. The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
doxygen: Add \ref to references. This way doxygen issues a warning if the file/function/structure no longer exists and a stale reference remains.
Merge branch 'refs/heads/t/lopsub' The bulk of the changes in this release is the conversion of all command line parsers from gengetopt to lopsub. The series also contains a few cleanups that have become possible due to the switch from gengetopt to lopsub. The patches towards the end of the series rename para_fade to para_mixer. Naturally, the merge conflicted rather heavily against the other topic branches that have been merged since the lopsub branch was started. Conflicting files: Makefile.real afh.c afh_recv.c configure.ac osx_write.c write.c The resolutions for these conflicts were recorded with git rerere and have been tested for quite some time. Cooking for three weeks. * refs/heads/t/lopsub: (74 commits) audioc: Avoid double free in audioc_i9e_line_handler(). audiod: Avoid uninitialized memory access. Simplify mixer setup. mixer: Implement non-linear time scale for fading. mixer: Allow arbitrary relative time for sleep subcommand. Convert para_fade to subcommands, rename it to para_mixer. build: Create .dep files only during compilation. build: Simplify definition of $m4_lls_deps. build: Rename command list variables. build: Combine $(CFLAGS) and $(STRICT_CFLAGS). build: Let .d files depend only on .c. build: Don't create phony targets for dependencies. build: Remove duplicate dependency. build: Remove cmdline_dir and friends. build: Remove some unused variables from Makefile.real. build: Remove m4/gengetopt. Remove gengetopt and help2man checks from configure.ac. Remove man_util.bash. Remove ggo.c and ggo.h. manual: Do not mention gengetopt and help2man any more. ...
Convert filters to lopsub. This replaces the *_filter.m4 gengetopt files by the filter_cmd lopsub suite, where each filter is realized as a subcommand. Due to this change, para_filter needs to be linked with -llopsub. The filter structure is now stored in the user_data pointer provided by lopsub, allowing to get rid of the global filters[] array, the FILTER_ENUM macro and the corresponding enumeration constants. The removal of the ->goo_help member of struct filter makes this structure constant. Hence ->init() of struct filter can also go away. We still can tell whether a filter is supported by checking the user_data pointer: if it is NULL, the filter is unsupported. The new filter_supported() helper in filter_common.c is provided for convenience. Parsing of the filter command line options is now performed generically, and the ->parse_config() method is renamed to ->setup(), an optional function which is supposed to perform semantic checks and the one-time setup of the filter, if any. It is accompanied by ->teardown() which replaces ->free_config(). The conversion of the individual filters is easy since most filters have a simple syntax or take no arguments at all. The resample_filter, however, needs a different way to copy the wav parameters from the lopsub parse result to the wav parms structure. A suitable macro, LLS_COPY_WAV_PARMS is added to check_wav.h for this purpose. The old COPY_WAV_PARMS needs to stay until para_write, the only other user of the macro, has been converted as well. The section heading of the manual page has changed slightly, causing t0005 to fail. Hence this test needs a slight adjustment.
aacdec: Decode only one frame per iteration. This improves latency and helps to avoid buffer underruns on slow machines.
aacdec: Combine aac_open() and aacdec_open(). Both functions are short, and they are only called once at startup. Thus, there is no reason to spread out the initialization over two functions, so let's combine them.
aacdec: Make "initialized" a boolean. It improves code readability, they say.
aacdec: Make frame_info local to ->post_select(). We don't need to preserve this value across multiple calls to ->post_select().
aacdec: Remove pointless assignment. No need to set "ret" here as the jump to "next_buffer" overwrites its content anyway.
aacdec: Remove pointless check and improve comment. "consumed" is always less than "len" here because of the check a few lines earlier.
aacdec: Rename buffer variables. The naming of the three buffers was inconsistent. This patch unifies the names.
aacdec: Remove pointless variable p.
aacdec: Remove check which is always true. Just prior to the test we set ret to consumed, so it is known to be non-negative.
aacdec: Kill pointless label. The "out" and "err" labels are equivalent if ret is negative, which is the case for the only jump to "out".
aacdec: Remove superfluous assignment. Jumping to the success label sets ret to consumed. ret is not used if there are samples available, so this is safe.