summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-07-30 10:30:52 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-07-30 10:33:34 -0700
commitaec9d7266777e0b9243ef0f112fe0e07256bd446 (patch)
treea3c446db2134d009009a95b4e0c4a102f92ec6e4
parent68e74d37b99f56bbd1a5f2fb8cb4ad6116f27bd3 (diff)
Xauth.h: add access & malloc attributes to function prototypes
May aid in static analysis by gcc Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--include/X11/Xauth.h35
1 files changed, 31 insertions, 4 deletions
diff --git a/include/X11/Xauth.h b/include/X11/Xauth.h
index a51bc72..bd558eb 100644
--- a/include/X11/Xauth.h
+++ b/include/X11/Xauth.h
@@ -67,12 +67,34 @@ typedef struct xauth {
_XFUNCPROTOBEGIN
+#ifndef __has_attribute
+# define __has_attribute(x) 0 /* Compatibility with older compilers */
+#endif
+
+#if __has_attribute(access)
+# define XAU_ACCESS_ATTRIBUTE(X) __attribute__((access X))
+#else
+# define XAU_ACCESS_ATTRIBUTE(X)
+#endif
+
+#if __has_attribute(malloc)
+# define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc X))
+#else
+# define XAU_MALLOC_ATTRIBUTE(X)
+#endif
+
char *XauFileName(void);
+void XauDisposeAuth(
+Xauth* /* auth */
+);
+
+XAU_MALLOC_ATTRIBUTE((XauDisposeAuth, 1))
Xauth *XauReadAuth(
FILE* /* auth_file */
);
+XAU_ACCESS_ATTRIBUTE((read_only, 1)) /* file_name */
int XauLockAuth(
_Xconst char* /* file_name */,
int /* retries */,
@@ -80,15 +102,20 @@ int /* timeout */,
long /* dead */
);
+XAU_ACCESS_ATTRIBUTE((read_only, 1)) /* file_name */
int XauUnlockAuth(
_Xconst char* /* file_name */
);
+XAU_ACCESS_ATTRIBUTE((read_only, 2)) /* auth */
int XauWriteAuth(
FILE* /* auth_file */,
Xauth* /* auth */
);
+XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) /* address */
+XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) /* number */
+XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) /* name */
Xauth *XauGetAuthByAddr(
#if NeedWidePrototypes
unsigned int /* family */,
@@ -112,6 +139,10 @@ unsigned short /* name_length */,
_Xconst char* /* name */
);
+XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) /* address */
+XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) /* number */
+XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) /* type_names */
+XAU_ACCESS_ATTRIBUTE((read_only, 8, 6)) /* type_lengths */
Xauth *XauGetBestAuthByAddr(
#if NeedWidePrototypes
unsigned int /* family */,
@@ -132,10 +163,6 @@ char** /* type_names */,
_Xconst int* /* type_lengths */
);
-void XauDisposeAuth(
-Xauth* /* auth */
-);
-
_XFUNCPROTOEND
/* Return values from XauLockAuth */