]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Stop talking about the "XDG" version of basename() 246/head
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 17 Jun 2015 10:23:46 +0000 (11:23 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 17 Jun 2015 10:23:46 +0000 (11:23 +0100)
XDG refers to X Desktop Group, a former name for freedesktop.org.
This group is responsible for specifications like basedirs,
.desktop files and icon naming, but as far as I know, it has never
tried to redefine basename().

I think these references were meant to say XPG (X/Open Portability
Guide), a precursor of POSIX. POSIX is better-known and less easily
confused with XDG, and is how the basename(3) man page describes
the libgen.h version of basename().

The other version of basename() is glibc-specific and is described
in basename(3) as "the GNU version"; specifically mention that
version, to disambiguate.

CODING_STYLE
src/basic/util.c
src/libsystemd/sd-bus/bus-kernel.c
src/machine/machine-dbus.c

index bdec988ce6bdbca0f9155bb57cb28577b2190a6c..dbadfbdb5441adf3ae53a0ebec458bf2726cd151 100644 (file)
   c) recvmsg() must get MSG_CMSG_CLOEXEC set
   d) F_DUPFD_CLOEXEC should be used instead of F_DUPFD, and so on
 
-- We never use the XDG version of basename(). glibc defines it in
-  libgen.h. The only reason to include that file is because dirname()
+- We never use the POSIX version of basename() (which glibc defines it in
+  libgen.h), only the GNU version (which glibc defines in string.h).
+  The only reason to include libgen.h is because dirname()
   is needed. Everytime you need that please immediately undefine
   basename(), and add a comment about it, so that no code ever ends up
-  using the XDG version!
+  using the POSIX version!
 
 - Use the bool type for booleans, not integers. One exception: in public
   headers (i.e those in src/systemd/sd-*.h) use integers after all, as "bool"
index b7c70af5414001ae2f8cb6e6d429b4946b055e69..e0c5069ff8c2b22ee5e8bc973aed067f2bb2363b 100644 (file)
@@ -60,8 +60,8 @@
 #include <linux/fs.h>
 
 /* When we include libgen.h because we need dirname() we immediately
- * undefine basename() since libgen.h defines it as a macro to the XDG
- * version which is really broken. */
+ * undefine basename() since libgen.h defines it as a macro to the POSIX
+ * version which is really broken. We prefer GNU basename(). */
 #include <libgen.h>
 #undef basename
 
index 3aaaabf4edb27f4388a6d5d3d7d08ee5998f5234..f08db2da893c25d13f4986b4b50cbe9f38ade677 100644 (file)
@@ -29,8 +29,8 @@
 #include <sys/prctl.h>
 
 /* When we include libgen.h because we need dirname() we immediately
- * undefine basename() since libgen.h defines it as a macro to the XDG
- * version which is really broken. */
+ * undefine basename() since libgen.h defines it as a macro to the POSIX
+ * version which is really broken. We prefer GNU basename(). */
 #include <libgen.h>
 #undef basename
 
index 0892479a9aa7a137f4d9fbd6bacb3bafaf3f5ae1..9f026beb1325ca99c171fb3465c94b787dffc0bf 100644 (file)
@@ -24,8 +24,8 @@
 #include <sys/mount.h>
 
 /* When we include libgen.h because we need dirname() we immediately
- * undefine basename() since libgen.h defines it as a macro to the XDG
- * version which is really broken. */
+ * undefine basename() since libgen.h defines it as a macro to the POSIX
+ * version which is really broken. We prefer GNU basename(). */
 #include <libgen.h>
 #undef basename