gui: Clear status bar after pressing <End>. Without this a stale message such as "scrolled view: 1-36/42" remains although the window has been updated to show the bottom of the ringbuffer.
gui: Improve loglevel message. When changing the log level, show the new severity string rather than its numerical representation.
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.
Hide implementation of para_fd_set(). This preparatory patch for replacing select() renames para_fd_set() to sched_fd_set(), moves it to sched.c and makes it static. All users are modified to call either of the two new public functions sched_monitor_{read,write}fd() which take a pointer to struct sched rather than an fd set pointer.
fd: Drop fd_set parameter from read_nonblock() and friends. This parameter is not necessary because its only purpose is to avoid the readv(2) system call in case it would likely return EAGAIN because we just called select(2) which reported that there is no data to read. Since the parameter is an obstacle for the conversion of the code base from select(2) to poll(2), get rid of it for the time being. If needed we can add back an equivalent optimization which checks for POLLIN after the conversion.
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: 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
gui: Do not decode the pressed key multiple times. Although the key name is a loop invariant, we recompute it during every iteration of the loop. Fix this.
gui: Have km_keyname() return const. We neither want the caller to write there nor to free the memory.
Merge branch 'refs/heads/t/long-help' This series introduces lsu.c and lsu.h which contain helpers related to the lopsub library. These helpers are designed to be shared between the executables. The series starts by implementing a generic help command for lopsub suites and converts para_server. Subsequent patches convert audiod and para_play. The second part of the series adds another lopsub related helper which merges command line options and config file options. Each executable is modified to make use of the new helper, getting rid of quite some code duplication. The conflict resolution for server.c has been tested for a while. Cooking for five weeks. * refs/heads/t/long-help: play: Use lsu_merge_config_file_options(). mixer: Use lsu_merge_config_file_options(). gui: Use lsu_merge_config_file_options(). filter: Use lsu_merge_config_file_options(). audioc: Use lsu_merge_config_file_options(). audiod: Use lsu_merge_config_file_options(). client: Use lsu_merge_config_file_options(). lsu: Add helper to merge config file options, convert server. Trivial: Rename completion_result variables. play: Implement help --long. audiod: Implement help --long. Introduce lsu.{c,h}, implement help --long for para_server.
gui: Use lsu_merge_config_file_options(). para_gui supports config file reloading, so parse_config_file_or_die() needs to set MCF_DONT_FREE to keep a reference to the command line parse result and MCF_OVERRIDE in the reload case. Also, the code to check the key maps and to initialize the theme needs to be kept.
gui: Catch SIGWINCH. Commit 9775f534 from more than three years ago removed the signal handler for SIGWINCH on the grounds that it is unnecessary and simplifies the gui menu code that was in preparation back then. However, the gui menu feature was never merged and handling SIGWINCH in the input task does have a disadvantage: since KEY_RESIZE is generated by the curses library, select(2) (which watches STDIN_FILENO) does not notice that wgetch(3) would not block or return ERR any more after SIGWINCH was received. Hence the window will only be refreshed after select(2) returns for another reason. This can delay the window update for up to one second. This patch gets rid of the delay by reintroducing the signal handler for SIGWINCH, effectively reverting the above mentioned commit.
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 }'
Define status items in para.h. The only reason the status item enum and string array are defined in configure.ac is that upper case identifiers and lower case strings are not easy to do in cpp as it lacks toupper(). However, configure.ac is not the right place for defining C language constructs as the configure script should only check for installed packages. This commit moves the definition of the status item enum and array to para.h and modifies all users to use lower case for the item names. This was automated with a script which essentially did upper=${i^^} sed -i "s/\<SI_$upper/SI_$i/g" $files for each status item $i. Care has been taken to leave the order of the status items unchanged. This is important because the item numbers must be considered part of the API between server and client.
gui: Trivial whitespace and spelling fixes. Nothing interesting in this patch..
Convert para_gui to lopsub. This replaces the gengetopt file for para_gui by a lopsub suite and links para_gui with -llopsub. The new FOR_EACH_KEY_MAP() macro is introduced for iterating over all key bindings given at the command line or in the config file. The bulk of the change is parse_config_file_or_die() where we get rid of the gengetopt specific hack which removed all key bindings due to gengetopt appending the options when the config parser is called a second time. The patch also adds a description section to the man page of para_gui.
gui: Remove --timeout. para_gui should work well regardless of the scheduler timeout setting. This commit removes the timeout options and changes gui.c to use a fixed timeout of one second.
Merge branch 'refs/heads/t/simple_error_codes' Two patches which get rid of the concept of per-subsystem error codes. The host-compiled error2.c program can be removed, configure.ac and error.h simplified. The merge conflicted because both sides modified error.h, but this was easy to resolve. * refs/heads/t/simple_error_codes: Sort errors alphabetically. Simplify the error subsystem, get rid of error2.[ch].
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.