Martin Mares [Tue, 5 Sep 2017 22:16:11 +0000 (00:16 +0200)]
Fastbufs: bclose() on caller-allocated fastbuf is allowed
Previously, it was impossible to catch exceptions thrown by fbbuf
(although it is quite useful in case of the "buffer overflow" exception).
With these changes, bclose() should be allowed and equivalent to bflush(),
which should do nothing :) Hence, fb_tie() should work and so should
exception handling.
Martin Mares [Sat, 22 Jul 2017 20:32:18 +0000 (22:32 +0200)]
Debian: The build system is packaged as a part of libucw-dev
Previously, I added UCW::Configure to libucw-perl, but I forgot
that most users of this module also need the build system. Surprisingly,
our packaging completely avoided the build system files.
Therefore, I moved UCW::Configure to libucw-dev and added the build
system there, too.
In the long term, we should move UCW::Configure under build/.
Since nobody is using v6.5.3 yet, I am rebuilding it with these
changes applied.
Martin Mares [Wed, 8 Jul 2015 21:58:21 +0000 (23:58 +0200)]
Unicode: Reject denormalized UTF-8 sequences
When there are multiple possible encodings of a single Unicode
codepoint, the standard requires to use the shortest one. Not checking
this requirement on input has been observed to cause weird security
problems in some software, so better be careful.
Martin Mares [Fri, 6 Mar 2015 13:50:05 +0000 (14:50 +0100)]
Mainloop: Avoid polling for an empty set of events
If a main_file was active, but it did not have any handlers set,
it could happen that poll/epoll was called with an empty set of
requested events.
Alas, even in those cases POLLHUP or POLLERR could be delivered,
leading to an endless loop of such events. (Remember that we do not
use the edge-triggered mode of epoll as we want to be compatible
with plain poll semantics in handlers.)
From now on, we avoid this situation by removing the fd from the
poll set temporarily.
Also, this led to a slight unification of code paths.
Martin Mares [Thu, 12 Feb 2015 23:24:26 +0000 (00:24 +0100)]
XML: Changed internal representation of attributes
As most elements have only a couple of attributes, I switched the
main attribute data structure from a hash table to a list. String
comparisons are hopefully avoided in most cases, as we keep a hash
of the lookup key in each entry.
More importantly, the structure is populated in two steps: first,
original (i.e., qualified) names of all attributes are entered;
second, namespaces are resolved and attributes are checked for
uniqueness.
If linear time complexity of attribute lookups turns out to be
too slow, we can add a secondary hash table for elements with
many attributes. This table will be populated from the list
in the 2nd step above.
Martin Mares [Thu, 12 Feb 2015 15:41:26 +0000 (16:41 +0100)]
Logging: Added log_drop_stderr().
When writing the daemonization module, I assumed that it is not
necessary to close stderr, because it will be replaced by a log
file later. Alas, this is not true for general log streams.
I have added a function, which should be called by the daemon
when it is done with initialization of logging.
Martin Mares [Sun, 9 Nov 2014 12:32:28 +0000 (13:32 +0100)]
Mainloop: Be benevolent when file_del() is called on a closed fd
I recently wrote a couple of wrappers for connecting other mainloop
interfaces to UCW mainloop. Unfortunately, asking a mainloop to stop
watching a file a moment after close() is a common (mal)practice.
Working around it in the wrapper is hard to do, so I relax the checks
in LibUCW instead.