aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-06-20 12:13:38 +0200
committerMattias Andrée <maandree@kth.se>2020-06-20 12:13:38 +0200
commit79af02f81b282ef8e521cdfd08462a2c91ff7861 (patch)
treedb458c14b330f3c53dd2410e0db07deef780aa10
parentUpdate readme (diff)
downloadlibaxl-79af02f81b282ef8e521cdfd08462a2c91ff7861.tar.gz
libaxl-79af02f81b282ef8e521cdfd08462a2c91ff7861.tar.bz2
libaxl-79af02f81b282ef8e521cdfd08462a2c91ff7861.tar.xz
Change libaxl_protocol_version_major, libaxl_protocol_version_minor, and libaxl_protocol_version into variables
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--libaxl/advanced.h45
-rw-r--r--libaxl_protocol_version.325
-rw-r--r--libaxl_protocol_version.c6
-rw-r--r--libaxl_protocol_version_major.319
-rw-r--r--libaxl_protocol_version_major.c6
-rw-r--r--libaxl_protocol_version_minor.319
-rw-r--r--libaxl_protocol_version_minor.c6
7 files changed, 38 insertions, 88 deletions
diff --git a/libaxl/advanced.h b/libaxl/advanced.h
index 13775e8..f34a347 100644
--- a/libaxl/advanced.h
+++ b/libaxl/advanced.h
@@ -7,16 +7,16 @@
/**
* The major version number of the highest version of X protocol
* of the library supports (the lowest version is 11.0). If you
- * are using dynamic linking, you make also want to use the
- * libaxl_protocol_version_major() function.
+ * are using dynamic linking, you may also want to use the
+ * `libaxl_protocol_version_major` variable.
*/
#define LIBAXL_PROTOCOL_VERSION_MAJOR 11
/**
* The minor version number of the highest version of X protocol
* of the library supports (the lowest version is 11.0). If you
- * are using dynamic linking, you make also want to use the
- * libaxl_protocol_version_minor() function.
+ * are using dynamic linking, you may also want to use the
+ * `libaxl_protocol_version_minor` variable.
*/
#define LIBAXL_PROTOCOL_VERSION_MINOR 0
@@ -25,44 +25,35 @@
* the library supports, as one integer where the major number
* is multiped by 1000, (the lowest version is 11.0, which is
* encoded as 11000). If you are using dynamic linking, you
- * make also want to use the libaxl_protocol_version() function.
+ * may also want to use the `libaxl_protocol_version` variable.
*/
#define LIBAXL_PROTOCOL_VERSION ((LIBAXL_PROTOCOL_VERSION_MAJOR) * 1000 + (LIBAXL_PROTOCOL_VERSION_MINOR))
/**
- * Returns the major version number of the highest version of
+ * The major version number of the highest version of
* X protocol of the library supports (the lowest version is
- * 11.0). If you are using static linking, you make also want
+ * 11.0). If you are using static linking, you may also want
* to use the LIBAXL_PROTOCOL_VERSION_MAJOR constant.
- *
- * @return The major version number of highest support version of the protocol
*/
-_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__)))
-int libaxl_protocol_version_major(void); /* TODO should be an `extern const int` */
+extern const int libaxl_protocol_version_major;
/**
- * Returns the minor version number of the highest version of
+ * The minor version number of the highest version of
* X protocol of the library supports (the lowest version is
- * 11.0). If you are using static linking, you make also want
+ * 11.0). If you are using static linking, you may also want
* to use the LIBAXL_PROTOCOL_VERSION_MINOR constant.
- *
- * @return The minor version number of highest support version of the protocol
*/
-_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__)))
-int libaxl_protocol_version_minor(void); /* TODO should be an `extern const int` */
+extern const int libaxl_protocol_version_minor;
/**
- * Returns the minor version number of the highest version of
- * X protocol of the library supports (the lowest version is 11.0,
- * which is encoded as 11000). If you are using static linking,
- * you make also want to use the LIBAXL_PROTOCOL_VERSION constant.
- *
- * @return The version number of highest support version of the protocol,
- * encoded as a sum of the major number multipled by 1000 and
- * the minor number, e.g. 11000 for 11.0 (X11)
+ * Returns the version number, encoded as the sum of the major
+ * number multipled by 1000 and the minor number (e.g. 11000
+ * for 11.0 (X11)), of the highest version of X protocol of
+ * the library supports (the lowest version is 11.0, which is
+ * encoded as 11000). If you are using static linking, you
+ * may also want to use the LIBAXL_PROTOCOL_VERSION constant.
*/
-_LIBAXL_GCC_ONLY(__attribute__((__warn_unused_result__)))
-int libaxl_protocol_version(void); /* TODO should be an `extern const int` */
+extern const int libaxl_protocol_version;
/**
* Deallocations a connection object without
diff --git a/libaxl_protocol_version.3 b/libaxl_protocol_version.3
index 2064a14..38f5871 100644
--- a/libaxl_protocol_version.3
+++ b/libaxl_protocol_version.3
@@ -5,32 +5,21 @@ libaxl_protocol_version - X protocol version
.nf
#include <libaxl.h>
-int libaxl_protocol_version(void);
+extern const int libaxl_protocol_version;
.fi
.SH DESCRIPTION
The
-.BR libaxl_protocol_version ()
-function returns the number, as the sum of the
+.B libaxl_protocol_version
+variable is set to the number, as the sum of the
major number multiplied by 1000 and the minor
number, of the highest version of the X protocol
that the library, as linked against, supports.
For example if the version number is 11.0, 11000
-is returned, and if it is 11.2, 11002 is returned.
-.SH RETURN VALUE
-The
-.BR libaxl_protocol_version ()
-function returns the number, as a the
-sum described in the
-.B DESCRIPTION
-section of the highest supported version
-of the X protocol.
-.SH ERRORS
-The
-.BR libaxl_protocol_version ()
-function cannot fail.
+is returned, and if it is 11.2, 11002 is assigned
+to the variable.
.SH NOTES
-There is no corresponding function for the lowest
-supported version. The lowest supported
+There is no corresponding variable for the
+lowest supported version. The lowest supported
version is 11.0 (X11); X11 was released in
September 1987 and predates Linux, thus
this is extremely unlikely this will change.
diff --git a/libaxl_protocol_version.c b/libaxl_protocol_version.c
index feaa953..e4f02ca 100644
--- a/libaxl_protocol_version.c
+++ b/libaxl_protocol_version.c
@@ -1,8 +1,4 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-int
-libaxl_protocol_version(void)
-{
- return LIBAXL_PROTOCOL_VERSION;
-}
+const int libaxl_protocol_version = LIBAXL_PROTOCOL_VERSION;
diff --git a/libaxl_protocol_version_major.3 b/libaxl_protocol_version_major.3
index 0a816f0..d16aa9d 100644
--- a/libaxl_protocol_version_major.3
+++ b/libaxl_protocol_version_major.3
@@ -5,26 +5,17 @@ libaxl_protocol_version_major - X protocol version, major number
.nf
#include <libaxl.h>
-int libaxl_protocol_version_major(void);
+extern const int libaxl_protocol_version_major;
.fi
.SH DESCRIPTION
The
-.BR libaxl_protocol_version_major ()
-function returns the major number of the
+.B libaxl_protocol_version_major
+variable is set to the major number of the
highest version of the X protocol that
the library, as linked against, supports.
-.SH RETURN VALUE
-The
-.BR libaxl_protocol_version_major ()
-function returns the major number of the
-highest supported version of the X protocol.
-.SH ERRORS
-The
-.BR libaxl_protocol_version_major ()
-function cannot fail.
.SH NOTES
-There is no corresponding function for the lowest
-supported version. The lowest supported
+There is no corresponding variable for the
+lowest supported version. The lowest supported
version is 11.0 (X11); X11 was released in
September 1987 and predates Linux, thus
this is extremely unlikely this will change.
diff --git a/libaxl_protocol_version_major.c b/libaxl_protocol_version_major.c
index 6e3fd26..c44d03b 100644
--- a/libaxl_protocol_version_major.c
+++ b/libaxl_protocol_version_major.c
@@ -1,8 +1,4 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-int
-libaxl_protocol_version_major(void)
-{
- return LIBAXL_PROTOCOL_VERSION_MAJOR;
-}
+const int libaxl_protocol_version_major = LIBAXL_PROTOCOL_VERSION_MAJOR;
diff --git a/libaxl_protocol_version_minor.3 b/libaxl_protocol_version_minor.3
index 3d2b5de..8610c15 100644
--- a/libaxl_protocol_version_minor.3
+++ b/libaxl_protocol_version_minor.3
@@ -5,26 +5,17 @@ libaxl_protocol_version_minor - X protocol version, minor number
.nf
#include <libaxl.h>
-int libaxl_protocol_version_minor(void);
+extern const int libaxl_protocol_version_minor;
.fi
.SH DESCRIPTION
The
-.BR libaxl_protocol_version_minor ()
-function returns the minor number of the
+.B libaxl_protocol_version_minor
+variable is set to the minor number of the
highest version of the X protocol that
the library, as linked against, supports.
-.SH RETURN VALUE
-The
-.BR libaxl_protocol_version_minor ()
-function returns the minor number of the
-highest supported version of the X protocol.
-.SH ERRORS
-The
-.BR libaxl_protocol_version_minor ()
-function cannot fail.
.SH NOTES
-There is no corresponding function for the lowest
-supported version. The lowest supported
+There is no corresponding variable for the
+lowest supported version. The lowest supported
version is 11.0 (X11); X11 was released in
September 1987 and predates Linux, thus
this is extremely unlikely this will change.
diff --git a/libaxl_protocol_version_minor.c b/libaxl_protocol_version_minor.c
index f5bc27a..eaffdc7 100644
--- a/libaxl_protocol_version_minor.c
+++ b/libaxl_protocol_version_minor.c
@@ -1,8 +1,4 @@
/* See LICENSE file for copyright and license details. */
#include "common.h"
-int
-libaxl_protocol_version_minor(void)
-{
- return LIBAXL_PROTOCOL_VERSION_MINOR;
-}
+const int libaxl_protocol_version_minor = LIBAXL_PROTOCOL_VERSION_MINOR;