Consolidate EOF error codes. Currently we have ~15 error codes which indicate an EOF condition. One should suffice, so drop all codes except the generic E_EOF and use that everywhere.
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.
sched: Use integer value for select timeout. This modifies the public struct sched so that users pass in the default timeout as an integer value in milliseconds rather than a struct timeval. This simplifies the code a little and eases the transition from select(2) to poll(2) because poll(2) also takes a plain integer for the timeout. Since para_select() of fd.c now calls ms2tv() to convert the timeout back to a struct timeval, all executables which link with fd.o must also link with time.o. This was not the case for para_mixer and para_audioc, so configure.ac needs to be adjusted accordingly.
string: Introduce arr_zalloc(). Adjust all callers which pass a product of two integers to zalloc() to call the new function instead and reduce zalloc() to a one-line wrapper.
string: Rename para_calloc() -> zalloc(). Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes.
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 }'
Convert para_write to lopsub. This replaces the gengetopt file write.m4 by write.suite.m4, making use of the shared macros in m4/lls/include for --channels, --sample-format and --sample-rate. The gengetopt files for these options are not needed for the unconverted executables which still rely on gengetopt, so they can be removed. In write.c we now use LLS_COPY_WAV_PARMS() rather than COPY_WAV_PARMS(). The latter macro becomes unused and is removed as well.
Convert writers to lopsub. Similar to the previous commits for receivers and filters, this commit replaces the five gengetopt parsers for the alsa, ao, file, oss, osx writers by a lopsub suite and links para_write with -llopsub. This allows to get rid of the WRITER_ENUM and the writers array as a reference to each writer structure are stored in the lopsub user_data pointer. Moreover, ->init(), ->parse_config(), ->free_config() and ->ggo_help() of struct writer are not needed any more and can be removed. The patch also removes write_common.h and moves the few prototypes write.h. Now that receivers, filters and writers have all been converted, we may also stop to include ggo.h from audiod_command.c and play.c. As for the receivers and filters, t0005 needs slight adjustments due to the new section header in the man page.
Simplify the error subsystem, get rid of error2.[ch]. This commit removes error2.c and the surrounding infrastructure of the build system, getting rid of ~600 LOC. After the change there are no more subsystems for error codes, and we don't need to host-compile error2.c any more. Since all executables now contain the text of every error code, the change has some impact on the sizes of the (stripped) executables: Before: After: 64K para_afh 71K para_afh 43K para_audioc 47K para_audioc 256K para_audiod 259K para_audiod 64K para_client 71K para_client 39K para_fade 47K para_fade 141K para_filter 144K para_filter 51K para_gui 59K para_gui 252K para_play 255K para_play 97K para_recv 104K para_recv 227K para_server 230K para_server 60K para_write 67K para_write This increase in size is justified by the major simplification.
Update year in copyright headers. Done with files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files In previous years we ran a similar script to set the second year in the range to the current year. This is kind of silly, so let's get rid of this useless information. This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in all file headers, i.e. only the first year (A) is left in. Accurate information including time stamps for each change can be obtained from the git history.
doc: Change email address to maan@tuebingen.mpg.de The mail server on systemlinux.org was down for more than a week lately, so let's use an alternative official address. This commit changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de. Most .c and .h files contain the email address in the copyright header, so they must all be patched. Three other files contain the address for a different reason: * README lists email and git, gitweb and home page URLs * configure.ac needs it for configure -h * version.c contains it for the -V option of all commands
sched: Directly pass context pointer to pre/post_select(). The patch is large, but it's fairly straight forward: Instead of a task pointer all ->pre_select() and ->post_select() methods now receive the context pointer that was passed to the scheduler when the task was registered. This allows to kill the public task_context(). Two pre_select/post_select functions are not directly called by the scheduler: session_post_select(), generic_recv_pre_select(). These are changed to receive a proper struct rather than a void pointer. Note that generic_filter_pre_select() is not changed in this manner because some filters do not provide a pre_select wrapper but set task->pre_select to generic_filter_pre_select().
sched: Introduce task_status(). Before struct task can be made private to sched.c we must eliminate code which directly accesses the fields of this structure. The last offender is ->error: in many places we check this field to detect whether some task is in an error condition. This patch provides a public accessor function, task_status(), for this purpose. All users of ->error are modified to call this function instead.
task_register() conversion: writers
task_register() conversion: write task
task_register() conversion: stdin task This renames stdin_set_defaults() to stdin_task_register() and changes the function to register the stdin task. Before this patch, the task was registered in the callers.
Change copyright year to 2014. This year, we're really on time. The changes in this patch were created by the following silly script: files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
Revamp ggo help. This adds usage and description fields to struct ggo_help and changes ggo_print_help() to optionally print these. The boolean detailed_help flag of ggo_print_help() is replaced by a bitmask which lets the caller specify what to print. Four pre-defined masks are used to print the normal help, the detailed help, the help for modules (receivers, filters, writers) and the detailed module help. The new macro DEFINE_GGO_HELP can be employed to create a struct ggo_help from a gengetopt structure.
Introduce version.c to limit recompilation on version changes. Currently version.h includes git-version.h which changes whenever a different commit is checked out or the working tree becomes dirty because a file has been modified. Consequently, all .c files that include this header must be recompiled in this case. To limit the number of recompilations, this commit introduces version.c, which contains functions that return the various types of the version string. It is now the only file that includes version.h, so only version.o must be rebuilt if git-version.h changes. This also adds the build date, OS and CC version to the version output.