[Patch] increase dbus_verbose readability

Tor Lillqvist tml at iki.fi
Thu Dec 17 02:52:03 PST 2009


Just a related note:

> +               if (*p == DBUS_DIR_SEPARATOR)

Please, check for both slash and backslash on Windows, they are
equivalent (at the Win32, and thus certainly C library, level) and
either can occur for various reasons. I.e., use a
DBUS_IS_DIR_SEPARATOR() function-type macro instead of
DBUS_DIR_SEPARATOR. Something like:

#ifdef DBUS_WIN
#define DBUS_IS_DIR_SEPARATOR(c) ((c) == '\\' || (c) == '/')
#else
#define DBUS_IS_DIR_SEPARATOR(c) ((c) == '/')
#endif

(Yes, this makes the code a bit more complex when what you would want
to do is something like strchr(s, DBUS_DIR_SEPARATOR).)

(And for file names there is also the multi-byte codepage issue... in
the CJK codepages some characters have as trailing byte a slash or
backslash, so actually one should use multi-byte string functions when
scanning strings looking for directory separators... but let's not get
into that now.)

--tml


More information about the dbus mailing list