oetiker/rrdtool-1.x — pull request #525 by pabigot (2014-08-05 23:57:42+00:00)
Title: Fix snprintf

OK, so this is a mess.

I need to use rrdtool under OpenEmbedded, where it's cross-compiled for platforms like the Raspberry PI and BeagleBone. For BeagleBone, the environment's compilation flags or libraries are such that snprintf and vsnprintf are present but are determined to not be C99 compliant, so the snprintf.m4 feature specifies they're to be replaced by rpl_snprintf and rpl_vsnprintf.

Unfortunately, the source code was modified so the functions are now named rrd_snprintf and rrd_vsnprintf, and several files fail to link because the rpl_* versions don't exist.

I fixed that by consistently using rrd_ as the prefix in both the m4 and C sources.

I also got rid of the compiler warnings because the declarations for the replacement functions weren't visible in all the source files that used them.

Finally, rrd_vsnprintf needed to be exposed so rrd_daemon could find it from librrd_th.la.

With these three patches (and the one in #524) the master branch of rrdtool builds under Yocto dev again, except for perl but that's probably mostly an OE issue and I don't use perl.

I will say I'm pretty sceptical of this snprintf replacement: whether rrd_snprintf or libc snprintf get invoked seems to be inconsistent. On my Ubuntu native builds, the only time the rrd_* versions get invoked are in the files where they're called explicitly: the autoconf tests always determine the libc versions are fine so those get used everywhere the unqualified names are used.