| Commit message (Collapse) | Author | Age |
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Switch to SPDX licence identifiers
A single patch which replaces the first comment line of most .c and .h files
containing the copyright notice by standardized SPDX (Software/System Package
Data Exchange) nomenclature.
* t/spdx:
Switch to SPDX identifiers.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Generated with
sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h
followed by manually tweaking the result a bit. No license change intended.
|
| | |
| |
| |
| |
| |
| | |
Return the bit number directly, avoiding the result pointer argument for
the bit number. Remove the pointless "one" variable in one of the callers,
the touch callback, while at it.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently mood.c and playlist.c contain similar public functions. For example,
there is mood_load() and playlist_load(), mood_loop() and playlist_loop().
Introduce struct selector_ops which contains methods such as ->load()
and loop(). We define two instances of the new structure, one for the mood
selector and one for the playlist selector. The structures can be constant,
but need to be public. The methods can be static.
The score table is now regarded as owned by the mood or playlist. It is no
longer listed in afs_tables[] and afs_table_operations can go away.
We don't need the global score_table variable anymore because all public
functions of score.c now take a pointer to the table to operate on. Similarly,
current_mood and current_playlist can be removed.
|
| |/
|
|
|
|
|
| |
We perform arithmetical operations and use its value as the right hand side
of the shift operator, so uint8_t seems to be more natural than unsigned
char. Rename char_compare() to u8_compare() and simplify it a bit by
dereferencing the two pointers right away.
|
| |
|
|
|
| |
These errors occur when the user adds a syntactically incorrect mood, an error
which is handled and which should not trigger a warning in the server log.
|
| |
|
|
| |
Found by the clang analyzer.
|
| |
|
|
| |
Every .c file includes it anyway.
|
| |
|
|
| |
Because callers expect this. Also print the message to the server log.
|
| |
|
|
|
|
|
|
| |
This naming is unfortunate because we also have the static
{mood,pl}_{open,close}() in blob.c which operate on the osl table. In
contrast, the functions renamed in this commit operate on blob objects
and change the current mood or playlist. Let's call these operations
load/unload to avoid confusion.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the code which destroys the current mood to the end of the
function so that we can still return to the old mood if something
goes awry.
To make this work, various functions need to be adjusted to no longer
refer to to afs statistics via the global current_mood pointer. Pass
a pointer to the statistics structure to those.
Also get rid of the local mood pointer variable in favor of ->m of
struct admissible_array.
Rename the function because it is public and deserves the mood_ prefix.
|
| |
|
|
|
| |
Reword the documentation a bit since the function has never been a
wrapper for calloc(3). No code changes.
|
| |
|
|
|
|
|
| |
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
|
| |\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A couple of urgent fixes for old bugs, the critical one being the
patch to reject empty mood arguments.
Cooking only for a few days to get these fixes merged ASAP.
* maint:
com_addatt(): Fix memory leak.
mood.c: Fix memory leak in change_current_mood().
mp.c: Fix memory leak on parse errors.
Reject empty mood arguments.
|
| | |
| |
| |
| |
| |
| | |
When mp_yyparse() fails we miss to free the abstract syntax tree.
Found by valgrind.
|
| |/
|
|
|
|
|
|
|
|
|
|
| |
The new keyword makes it possible to define moods which impose a
constraint on the duration of the admissible files. For example,
the expression
duration < 120 * 1000
selects only files which are shorter than two minutes.
The implementation is pretty simple.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
We special-case empty mood definitions (because we can't map the
osl object anyway), but we don't check whether the mood definition
contains anything else than whitespace or comments.
Such blank mood definitions result in an empty abstract syntax tree
indicated by ->ast of the mood parser's context structure being
NULL. We happily dereference that pointer in mp_eval_row() and die
by the resulting SIGSEGV.
The fix is trivial: simply treat blank moods in the same way as the
dummy mood, i.e. regard each audio file as admissible.
|
| |
|
|
|
|
| |
In mp_init(), if mp_yyparse() fails, we return early without setting
the result pointer to NULL. This does not matter much because both
callers of mood.c pass in NULL, but still..
|
| |\
| |
| |
| |
| |
| |
| |
| |
| | |
Some minor documentation improvements. Cooking for four months.
* refs/heads/t/doc:
Fix bad grammar "allows <infinitive>".
doc: Move filter examples to man page.
doc: Move sender examples to manual page.
|
| | |
| |
| |
| |
| | |
In standard English, the verb "allows" can never take an infinitive as
its direct object. This patch corrects these mistakes.
|
| |/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
}'
|
|
|
This introduces a context-free grammar for moods. The parser for the
corresponding language (the version 2 mood parser) is generated by
flex and bison and will eventually replace the open-coded parser for
traditional (version 1) moods. Those are still supported, but the
server now logs a deprecation warning when a version 1 mood is loaded,
Loading a version 2 mood is a two step procedure. In the first step the
bison parser reads the mood definition stored in the moods table of the
afs database. If there are no errors, the parser returns an abstract
syntax tree which represents the syntactic structure of the mood
definition. In the second step the abstract syntax tree is evaluated
for each row of the audio file table in turn. If the evaluation
function returns true, the audio file is considered admissible. In
this case a reference to the row is added to the score table in the
same way the version 1 mood parser stores the set of admissible files.
The commit adds the following new files to the repository:
* yy/mp.lex: the lexer
* yy/mp.y: the bison parser
* yy/makefile: rules for building the parser, included from main Makefile
* mp.c: frontend (high-level API) and backend (helpers for yy/mp.[ch])
* mp.h: backend data structures and function prototypes
The frontend is only needed in the existing mood.c, which now also
contains the declarations of the frontend API so that mp.h needs only
be included by the lexer and the parser.
The comment at the top of mp.c gives an overview of the mood parser
API. All non-static functions of mp.c (both frontend and backend)
are fully documented. The section on moods of the user manual has
been rewritten and extended.
Since flex and bison are required to build para_server, the list
of optional software packages now mentions these tools, with links
to their home page. If either tool is not installed, the configure
script succeeds but para_server will not be built.
|