summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Add helper function _ul_vasprintf_and_advanceMiloslav Trmač2012-07-181-22/+26
| | | | | | ... simplifying the callers of _ul_va_spin. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Make _ul_va_spin a function.Miloslav Trmač2012-07-181-75/+76
| | | | | | | | It is not safe to pass va_list into a function, but we can pass a pointer. Do this so that we don't have to keep two copies of the code in a large macro. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Use a local variable instead of parameter for va_listMiloslav Trmač2012-07-181-11/+26
| | | | | | | | In functions that use _ul_va_spin, use a local variable instead of a parameter. This commit is not useful stand-alone, but will be necessary for the next one (and makes the next one easier to review). Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Eliminate some duplicate codeMiloslav Trmač2012-07-181-12/+5
| | | | Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* travis.yml: Install the m4/ dir too...Gergely Nagy2012-06-221-0/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* travis.yml: Use autoreconf -iGergely Nagy2012-06-221-1/+1
| | | | | | We dropped autogen.sh earlier, use autoreconf -i instead. Whoops! Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Switch warn_unused_result attributesMiloslav Trmač2012-06-221-5/+5
| | | | | | | | These should not be on ul_*syslog, because there is nothing one can do to recover; OTOH they should be on ul_*format, because they indicate a memory leak. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Fix log mask handlingMiloslav Trmač2012-06-221-1/+1
| | | | Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* t/test_umberlog: Fix a minor indentation issueGergely Nagy2012-06-221-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Fix timestamp formattingMiloslav Trmač2012-06-221-1/+1
| | | | Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Remove escape_buffer entirelyGergely Nagy2012-06-221-25/+7
| | | | | | | | | | | | Output the escaped content directly into the destination buffer, avoiding the memory copy and associated overhead. This finishes the series, and brings another 6.6-18.0% speed improvement in test_perf, compared to the previous increase with using a static exception map. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Escape values directly into a bufferGergely Nagy2012-06-221-25/+55
| | | | | | | | Instead of precomputing a buffer length, do only one pass, extending the buffer as necessary. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Use pointers instead of offsets in ul_buffer_tGergely Nagy2012-06-222-30/+31
| | | | | | | This avoids various additions and subtractions on the fast path. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Simplify extending the bufferGergely Nagy2012-06-221-26/+35
| | | | | | | | | Most of the callers know how much the buffer needs extending, so don't ask them for the total size: new _ul_buffer_reserve_size replaces _ul_buffer_ensure_size, and the fast path is now inlined. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Change return type of _ul_str_escapeMiloslav Trmač2012-06-221-11/+8
| | | | | | | Use an integer instead of pointer, like in the other cases in buffer.c. We won't need the return value in the future. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Fix error handling in buffer.cGergely Nagy2012-06-223-28/+33
| | | | | | | | | | | | | * Don't lose old msg on realloc() failure * Don't dereference NULL on failure when buffer = (...) if (!buffer) { buffer->len = orig_len; ...} * To avoid the above pattern, use integer return values: "buffer" itself will not change in any case. * Add missing error handling Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Use a static exception mapGergely Nagy2012-06-221-51/+25
| | | | | | | | | | | | | | * Make the map static, read-only and preinitialized, to avoid thread-safety problems. * Invert the map, making it non-zero for exceptional characters (so that non-exceptional characters don't need to be mentioned) * Tighten the set of exceptional characters, so that most of ASCII goes through the fast path. This increases the speed of test_perf_* by 7.7-20.6%. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Test escaping of all control charactersMiloslav Trmač2012-06-221-0/+7
| | | | | | ... now that \f does not break the test. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Don't use \f in JSONGergely Nagy2012-06-221-4/+0
| | | | | | | JSON-c 0.9 does not parse \f, so fall back to \uNNNN for now. Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Don't create unnecessary libtool wrapper scripts for testsGergely Nagy2012-06-221-0/+1
| | | | | | | This marginally speeds up build, and simplifies debugging/valgrind runs Signed-off-by: Miloslav Trmač <mitr@redhat.com> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Fix 1-byte heap overflow in ul_buffer_finalizeMiloslav Trmač2012-06-221-2/+6
| | | | Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Remove an unnecessary pointer to arrayMiloslav Trmač2012-06-221-1/+1
| | | | | | | Be a little more explicit instead of relying on the compiler to optimize the variable away. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* Remove autogen.shGergely Nagy2012-06-222-8/+1
| | | | | | | | With the latest patch, we can use autoreconf -i to get the job that autogen.sh did, done. So there's no need to have the latter here anymore. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Move the "foreign" option into configure.acMiloslav Trmač2012-06-222-2/+2
| | | | | | This makes it possible to use autoreconf(1) instead of autogen.sh Signed-off-by: Miloslav Trmač <mitr@redhat.com>
* NEWS: Finalise for 0.2.1libumberlog-0.2.1Gergely Nagy2012-05-021-1/+7
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Mention docutils in the READMEGergely Nagy2012-04-291-1/+3
| | | | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Reduce the number of memory allocationsGergely Nagy2012-04-291-14/+32
| | | | | | | | Make the string escape use an ul_buffer_t, to avoid unnecessary memory allocations. This greatly reduces the number of mallocs made, and thus results in a noticable increase in speed. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Generate the manual page if rst2man is presentGergely Nagy2012-04-294-1/+13
| | | | | | | If rst2man is present at configure time, generate the manual page with it, which is to be included in the dist tarball too. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* .travis.yml: Install check tooGergely Nagy2012-04-291-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Merge branch 'feature/test-suite/check'Gergely Nagy2012-04-294-36/+60
|\
| * Convert the test suite to CheckGergely Nagy2012-04-294-36/+60
|/ | | | | | | | | | | While assert() is a neat tool, it is not really suitable for testing, as it gives hardly any indication on what part of the test suite failed, and why. For this purpose, an existing testing library, such as Check is a much better option, so lets use that! Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Preparations for 0.2.1Gergely Nagy2012-04-283-3/+28
| | | | | | | Bump software and library interface versions, and start adding NEWS entries. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Add the build-status link to README.rstGergely Nagy2012-04-281-1/+3
| | | | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* .gitingore: Ignore a few more generated filesGergely Nagy2012-04-281-0/+15
| | | | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Add a closelog() wrapper to clear the environmentGergely Nagy2012-04-285-1/+44
| | | | | | | | | | | | | | | Our openlog() wrapper fills in a couple of variables, and those were kept around even after a closelog(), and thus, affected ul_format() calls even after a closelog(). This in turn, made one of the test cases fail, as that was relying on the default behaviour, which was modified due to an openlog() in an earlier test case. We now wrap closelog() aswell, and NULL out our settings to get a clean state, and add a test case to verify this behaviour aswell. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* travis.yml: Use sudo to install dependenciesGergely Nagy2012-04-281-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Add Travis CI control fileGergely Nagy2012-04-281-0/+8
| | | | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
* Resolve facility & priority properlyGergely Nagy2012-04-202-6/+29
| | | | | | | | | | | | | | | | | | | The priority passed to the syslog() call can contain a facility embedded, so we need to extract it to find both the facility and the priority. This also means that the facility set at openlog()-time can be overridden later, so _find_facility() has to take the priority value into account. This patch makes libumberlog do just the above: extract both priority and facility from the priority passed to syslog(), and if facility is 0, use the default set at openlog()-time, if any. Added a test case to test this expected behaviour. Reported-by: Peter Czanik <czanik@balabit.hu> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Properly reset the JSON buffer in all cases.Gergely Nagy2012-04-201-2/+2
| | | | | | | | | | | | Previously the JSON buffer was only reset when ul_vformat() was called, but not everything goes through that, so some messages ended up being garbled. The proper thing to do is to reset in _ul_vformat(), as everything goes through that, and that's the right place to do this anyway. Reported-by: Peter Czanik <czanik@balabit.hu> Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* configure.ac: Bump version to 0.2.0libumberlog-0.2.0Gergely Nagy2012-04-161-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* NEWS: Finalise for 0.2.0.Gergely Nagy2012-04-161-1/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Free up the JSON buffer on exitGergely Nagy2012-04-161-0/+7
| | | | | | | This adds a destructor that simply frees up the JSON buffer, so that to not upset valgrind and similar tools too much. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Improve string escape performance a littleGergely Nagy2012-04-161-6/+5
| | | | | | | | | | Instead of escaping a string, returning a new one and running strlen() on that, use an output variable to store the length, since we can easily calculate that during the escape process anyway. This should shave off a tiny bit of CPU time. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* .gitignore updateGergely Nagy2012-04-131-0/+1
| | | | Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Correctly NULL-terminate the JSON buffer in all cases.Gergely Nagy2012-04-131-1/+1
| | | | | | | When finalizing the JSON buffer, always NULL-terminate it at the appropriate length. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Do use the library versionGergely Nagy2012-04-131-2/+3
| | | | | | | | | | We had the LUL_* variables set in lib/Makefile.am, but they weren't used. Now they are. While there, bumped LUL_CURRENT to 1, because of the dropped JSON dependency. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
* Merge branch 'feature/libc-only'Gergely Nagy2012-04-1310-87/+389
|\
| * NEWS updateGergely Nagy2012-04-131-0/+16
| | | | | | | | | | | | Start adding 0.2.0 news items. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
| * configure updatesGergely Nagy2012-04-131-2/+5
| | | | | | | | | | | | Check for a few more headers, functions and types. Signed-off-by: Gergely Nagy <algernon@balabit.hu>
| * Make json-c optional.Gergely Nagy2012-04-132-1/+5
| | | | | | | | | | | | | | When json-c is not found, instead of failing at configure time, continue, but disable the test suite. Signed-off-by: Gergely Nagy <algernon@balabit.hu>