The strbuf_local_buf() function attempted to detect if its argument was
not an array but a pointer, and fail at compile time. This worked fine
when compiling with standard optimisation (-O2).
However, specifying the gcc -g option disables compiler optimisation, so
the compiler does not optimise away the call to the function with
__attribute__(error("...")), and so the compile fails.
The solution is to perform the check at run time using assert(), like
strbuf_local() already does.
swiftc(1) requires every -D option to be prefixed with -Xcc, which
is not easy to achieve using autoconf.
Now instead of setting configuration macros like HAVE_LSEEK64 on the
command line using -D, they are defined in config.h, which is generated
by ./configure, ignored by Git, and included by all headers and source
files that use any configuration macro.
The dependency on Makefile has been replaced with a dependency on
Makefile.in and config.h, which helps avoid some redundant full
recompiles after running ./configure, because the configure script
does not overwrit config.h if its content does not change.
Recent addition of the GCC __attribute__(alloc_size) to some functions
in mem.h broke the build when using Clang 3.5. This commit introduces
configure-time checks for all GCC attributes used in the Serval source
code, and adapts accordingly.
If strbuf_local(buf, len) is called with a buffer whose size can be
deduced at compile time, then this change will check that 'len' does not
exceed that size, causing an assertion failure at run time if it does.
The safety check makes use of the GCC extensions: __builtin_object_size()
and __attribute__((alloc_size(n)). Under non-GCC compilers, the safety
check will not be performed.
Internally the strbuf_local_buf(x) macro uses sizeof(x) to determine
the size of the buffer, but this will give the wrong behaviour if x
is a pointer (char *x), not an array (char x[]). With this change,
invoking it with a pointer will cause a compile error.
The safety check makes use of the GCC extensions: __builtin_object_size()
and __attribute__((alloc_size(n)). Under non-GCC compilers, the safety
check will not be performed.
Remove stowSid() at last
Change API of tohex() and strbuf_tohex(), to pass string length instead of
binary byte count. This allows odd numbers of hex digits to be produced.
Remove alloca_tohex_sid(); replace with alloca_tohex_sid_t()
New alloca_tohex_sid_t_trunc() macro
- shift radio rssi onto interace structure
- track packets sent received
- create html output for interface stats
- create html output for link state routing stats
Replaces (const char *file, unsigned int line, const char *function) arguments
to all logging functions, simplifies malloc/free tracking code in
overlay_buffer.c and Rhizome manifest alloc/free tracking in rhizome_bundle.c.
Use __HERE__ macro instead of (__FILE__, __LINE__, __FUNCTION__) everywhere.
Special __NOWHERE__ macro is equivalent to (NULL, 0, NULL).
Declare net.c functions in new "net.h" header, so log.c doesn't have to pull
in the entire "serval.h" just to use write_str().
Facilitates progress on issue #2.