When vm-storage-dir was set to an absolute path, FS would abort after
delivering a VM because we were trying to free(3) memory sitting in
the middle of a memory pool.
FS-5329
At this point we never want someone running a module against a
different version of FS than the module was built for. It's also
conceivable that you could want to use the modules with libfreeswitch1
even if you weren't running FS itself.
Use uint64_t and FTDM_UINT64_FMT for flagval and "%u" for unsigned int.
Extend invalid channel id check to cover chan_id == 0 case.
Use ftdm_strlen_zero() and ftdm_array_len() instead of open-coding them.
Move some variables from global scope into local subcommand scope.
Various other little format string and variable naming fixes.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Auto-loading can be toggled by setting the new autoload parameter
to FTDM_FALSE/FTDM_TRUE.
Update ftdm_span_create() and ftdm_api_execute() to use the new code.
NOTE: Auto-loading of missing I/O interfaces remains enabled in both cases,
but I guess we should disable it for ftdm_api_execute().
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
"x >> 1" is _NOT_ the reverse of "1 << x"...
Use code from Sean Eron Andersen's "Bit Twiddling Hacks"
(=> http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog)
to compute the log2 value (= position in the enum) of the bitflag.
This preserves the current behaviour, which is rather odd because
it is based on the position of the value in the enum, not its
actual (bit flag) value.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Simplify code by using shared string constants using bool (0/1) index,
!!-operator and negation-via-XOR.
Future optimization: Preallocate and re-use of iterators, to avoid
repeatedly allocating and freeing of memory.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
Part of my ongoing effort to split ftdm_io.c into more manageable pieces.
This change (along with others in the future) allows decoupling of the
span registry and its users, in preparation of moving all span related
functions and data structures into ftdm_span.c.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>