|
1
|
+From 4e1963a812f2c1777ba5d56ea9e939a3e40a0496 Mon Sep 17 00:00:00 2001
|
|
2
|
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
|
|
3
|
+ <zboszor@gmail.com>
|
|
4
|
+Date: Sat, 28 Aug 2021 15:38:40 +0200
|
|
5
|
+Subject: [PATCH] Fix a build error with Xorg master
|
|
6
|
+MIME-Version: 1.0
|
|
7
|
+Content-Type: text/plain; charset=UTF-8
|
|
8
|
+Content-Transfer-Encoding: 8bit
|
|
9
|
+
|
|
10
|
+Use xf86ReturnOptValBool() in get_bool_option() instead of
|
|
11
|
+options[option_index].value.bool to fix a compiler error with
|
|
12
|
+current Xorg xserver master branch.
|
|
13
|
+
|
|
14
|
+Also use xf86GetOptValInteger() in get_int_option() and
|
|
15
|
+xf86GetOptValString() in get_str_option() for consistency.
|
|
16
|
+
|
|
17
|
+The change causes a slight performance drop during option parsing
|
|
18
|
+because the passed-in index_value is no longer used as an index
|
|
19
|
+into the options array.
|
|
20
|
+
|
|
21
|
+Instead, it's used as a token now for the standard option getter
|
|
22
|
+functions which works since the index_value to the get_*_option()
|
|
23
|
+functions are identical to the value of options[n].token in the
|
|
24
|
+passed-in OptionInfoRec array.
|
|
25
|
+
|
|
26
|
+Also rename "int option_index" to "int token" for clarity in all
|
|
27
|
+three functions.
|
|
28
|
+
|
|
29
|
+Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
|
|
30
|
+---
|
|
31
|
+ src/qxl_option_helpers.c | 13 +++++++------
|
|
32
|
+ src/qxl_option_helpers.h | 6 +++---
|
|
33
|
+ 2 files changed, 10 insertions(+), 9 deletions(-)
|
|
34
|
+
|
|
35
|
+diff --git a/src/qxl_option_helpers.c b/src/qxl_option_helpers.c
|
|
36
|
+index 2aba677..7707b7c 100644
|
|
37
|
+--- a/src/qxl_option_helpers.c
|
|
38
|
++++ b/src/qxl_option_helpers.c
|
|
39
|
+@@ -10,31 +10,32 @@
|
|
40
|
+
|
|
41
|
+ #include "qxl_option_helpers.h"
|
|
42
|
+
|
|
43
|
+-int get_int_option(OptionInfoPtr options, int option_index,
|
|
44
|
++int get_int_option(OptionInfoPtr options, int token,
|
|
45
|
+ const char *env_name)
|
|
46
|
+ {
|
|
47
|
++ int value;
|
|
48
|
+ if (env_name && getenv(env_name)) {
|
|
49
|
+ return atoi(getenv(env_name));
|
|
50
|
+ }
|
|
51
|
+- return options[option_index].value.num;
|
|
52
|
++ return xf86GetOptValInteger(options, token, &value) ? value : 0;
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+-const char *get_str_option(OptionInfoPtr options, int option_index,
|
|
56
|
++const char *get_str_option(OptionInfoPtr options, int token,
|
|
57
|
+ const char *env_name)
|
|
58
|
+ {
|
|
59
|
+ if (getenv(env_name)) {
|
|
60
|
+ return getenv(env_name);
|
|
61
|
+ }
|
|
62
|
+- return options[option_index].value.str;
|
|
63
|
++ return xf86GetOptValString(options, token);
|
|
64
|
+ }
|
|
65
|
+
|
|
66
|
+-int get_bool_option(OptionInfoPtr options, int option_index,
|
|
67
|
++int get_bool_option(OptionInfoPtr options, int token,
|
|
68
|
+ const char *env_name)
|
|
69
|
+ {
|
|
70
|
+ const char* value = getenv(env_name);
|
|
71
|
+
|
|
72
|
+ if (!value) {
|
|
73
|
+- return options[option_index].value.bool;
|
|
74
|
++ return xf86ReturnOptValBool(options, token, FALSE);
|
|
75
|
+ }
|
|
76
|
+ if (strcmp(value, "0") == 0 ||
|
|
77
|
+ strcasecmp(value, "off") == 0 ||
|
|
78
|
+diff --git a/src/qxl_option_helpers.h b/src/qxl_option_helpers.h
|
|
79
|
+index 7c54c72..66d0a17 100644
|
|
80
|
+--- a/src/qxl_option_helpers.h
|
|
81
|
++++ b/src/qxl_option_helpers.h
|
|
82
|
+@@ -4,13 +4,13 @@
|
|
83
|
+ #include <xf86Crtc.h>
|
|
84
|
+ #include <xf86Opt.h>
|
|
85
|
+
|
|
86
|
+-int get_int_option(OptionInfoPtr options, int option_index,
|
|
87
|
++int get_int_option(OptionInfoPtr options, int token,
|
|
88
|
+ const char *env_name);
|
|
89
|
+
|
|
90
|
+-const char *get_str_option(OptionInfoPtr options, int option_index,
|
|
91
|
++const char *get_str_option(OptionInfoPtr options, int token,
|
|
92
|
+ const char *env_name);
|
|
93
|
+
|
|
94
|
+-int get_bool_option(OptionInfoPtr options, int option_index,
|
|
95
|
++int get_bool_option(OptionInfoPtr options, int token,
|
|
96
|
+ const char *env_name);
|
|
97
|
+
|
|
98
|
+ #endif // OPTION_HELPERS_H
|
|
99
|
+--
|
|
100
|
+2.34.1
|
|
101
|
+
|