Merge branch 'master' into 'master'

xquartz: In darwin.c, replace assert calls with tests that call FatalError on failure

See merge request xorg/xserver!198
This commit is contained in:
Adam Richter 2025-12-06 10:35:55 +00:00
commit 4e068725a0

View file

@ -519,13 +519,19 @@ InitInput(int argc, char **argv)
.rules = "base", .model = "empty", .layout = "empty",
.variant = NULL, .options = NULL
};
int result;
/* We need to really have rules... or something... */
XkbSetRulesDflts(&rmlvo);
assert(Success == AllocDevicePair(serverClient, "xquartz virtual",
&darwinPointer, &darwinKeyboard,
DarwinMouseProc, DarwinKeybdProc, FALSE));
result = AllocDevicePair(serverClient, "xquartz virtual",
&darwinPointer, &darwinKeyboard,
DarwinMouseProc, DarwinKeybdProc, FALSE);
if (result != Success) {
FatalError("InitInput: AllocDevicePair (...,\"xquartz virtual\",...) "
"returned X windows error %d.\n",
result);
}
/* here's the snippet from the current gdk sources:
if (!strcmp (tmp_name, "pointer"))
@ -542,15 +548,26 @@ InitInput(int argc, char **argv)
*/
darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
assert(darwinTabletStylus);
if (!darwinTabletStylus) {
FatalError("InitInput: "
"AddInputDevice(serverClient, DarwinTabletProc, TRUE) "
"failed.\n");
}
darwinTabletStylus->name = strdup("pen");
darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
assert(darwinTabletCursor);
if(!darwinTabletCursor) {
FatalError("InitInput: "
"AddInputDevice(serverClient, DarwinTabletProc, TRUE) "
"failed.\n");
}
darwinTabletCursor->name = strdup("cursor");
darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
assert(darwinTabletEraser);
if(!darwinTabletEraser) {
FatalError("InitInput: AddInputDevice(serverClient, DarwinTabletProc, TRUE) failed.\n");
}
darwinTabletEraser->name = strdup("eraser");
DarwinEQInit();
@ -679,8 +696,18 @@ OsVendorInit(void)
if (serverGeneration == 1) {
char *lf;
char *home = getenv("HOME");
assert(home);
assert(0 < asprintf(&lf, "%s/Library/Logs/X11", home));
int nbytes;
if (!home) {
FatalError("darwin OsVendorInit: "
"getenv(\"HOME\") returned NULL.\n");
}
nbytes = asprintf(&lf, "%s/Library/Logs/X11", home);
if (nbytes <= 0) {
FatalError("darwin OsVendorInit: "
"asprintf of log directory name failed.\n");
}
/* Ignore errors. If EEXIST, we don't care. If anything else,
* LogInit will handle it for us.
@ -688,9 +715,12 @@ OsVendorInit(void)
(void)mkdir(lf, S_IRWXU | S_IRWXG | S_IRWXO);
free(lf);
assert(0 <
asprintf(&lf, "%s/Library/Logs/X11/%s.log", home,
bundle_id_prefix));
nbytes = asprintf(&lf, "%s/Library/Logs/X11/%s.log", home,
bundle_id_prefix);
if (nbytes <= 0) {
FatalError("darwin OsVendorInit: "
"asprintf of log file name failed.\n");
}
LogInit(lf, ".old");
free(lf);