Compare commits
8 Commits
wip/malloc
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
d403cbd25c | ||
|
a46fd9f16e | ||
|
fc9bd6b175 | ||
|
d338bf6e68 | ||
|
c6777fe48e | ||
|
2f46a02217 | ||
|
93013224b4 | ||
|
74d5b7bb05 |
|
@ -11,14 +11,6 @@
|
|||
#include "namespace.h"
|
||||
#include "hooks.h"
|
||||
|
||||
static inline Bool winIsRoot(WindowPtr pWin) {
|
||||
if (!pWin)
|
||||
return FALSE;
|
||||
if (pWin->drawable.pScreen->root == pWin)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void hookWindowProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||
{
|
||||
XNS_HOOK_HEAD(PropertyFilterParam);
|
||||
|
|
|
@ -370,6 +370,23 @@ ddxProcessArgument(int argc, char **argv, int i)
|
|||
return KdProcessArgument(argc, argv, i);
|
||||
}
|
||||
|
||||
static int
|
||||
EphyrInit(void)
|
||||
{
|
||||
/*
|
||||
* make sure at least one screen
|
||||
* has been added to the system.
|
||||
*/
|
||||
if (!KdCardInfoLast()) {
|
||||
processScreenArg("640x480", NULL);
|
||||
}
|
||||
return hostx_init();
|
||||
}
|
||||
|
||||
KdOsFuncs EphyrOsFuncs = {
|
||||
.Init = EphyrInit,
|
||||
};
|
||||
|
||||
void
|
||||
OsVendorInit(void)
|
||||
{
|
||||
|
@ -381,12 +398,7 @@ OsVendorInit(void)
|
|||
if (hostx_want_host_cursor())
|
||||
ephyrFuncs.initCursor = &ephyrCursorInit;
|
||||
|
||||
if (serverGeneration == 1) {
|
||||
if (!KdCardInfoLast()) {
|
||||
processScreenArg("640x480", NULL);
|
||||
}
|
||||
hostx_init();
|
||||
}
|
||||
KdOsInit(&EphyrOsFuncs);
|
||||
}
|
||||
|
||||
KdCardFuncs ephyrFuncs = {
|
||||
|
|
|
@ -91,6 +91,14 @@ const char *kdGlobalXkbLayout = NULL;
|
|||
const char *kdGlobalXkbVariant = NULL;
|
||||
const char *kdGlobalXkbOptions = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Carry arguments from InitOutput through driver initialization
|
||||
* to KdScreenInit
|
||||
*/
|
||||
|
||||
KdOsFuncs *kdOsFuncs = NULL;
|
||||
|
||||
void
|
||||
KdDisableScreen(ScreenPtr pScreen)
|
||||
{
|
||||
|
@ -517,6 +525,19 @@ KdProcessArgument(int argc, char **argv, int i)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
KdOsInit(KdOsFuncs * pOsFuncs)
|
||||
{
|
||||
kdOsFuncs = pOsFuncs;
|
||||
if (pOsFuncs) {
|
||||
if (serverGeneration == 1) {
|
||||
KdDoSwitchCmd("start");
|
||||
if (pOsFuncs->Init)
|
||||
(*pOsFuncs->Init) ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Bool
|
||||
KdAllocatePrivates(ScreenPtr pScreen)
|
||||
{
|
||||
|
|
|
@ -278,6 +278,16 @@ int KdAddConfigKeyboard(char *pointer);
|
|||
int KdAddKeyboard(KdKeyboardInfo * ki);
|
||||
void KdRemoveKeyboard(KdKeyboardInfo * ki);
|
||||
|
||||
typedef struct _KdOsFuncs {
|
||||
int (*Init) (void); /* Only called when the X server is started, when serverGeneration == 1 */
|
||||
void (*Enable) (void);
|
||||
Bool (*SpecialKey) (KeySym);
|
||||
void (*Disable) (void);
|
||||
void (*Fini) (void);
|
||||
void (*pollEvents) (void);
|
||||
void (*Bell) (int, int, int);
|
||||
} KdOsFuncs;
|
||||
|
||||
typedef struct _KdPointerMatrix {
|
||||
int matrix[2][3];
|
||||
} KdPointerMatrix;
|
||||
|
@ -289,6 +299,8 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec;
|
|||
extern Bool kdEmulateMiddleButton;
|
||||
extern Bool kdDisableZaphod;
|
||||
|
||||
extern KdOsFuncs *kdOsFuncs;
|
||||
|
||||
#define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \
|
||||
dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey))
|
||||
#define KdSetScreenPriv(pScreen,v) \
|
||||
|
@ -345,6 +357,9 @@ void
|
|||
int
|
||||
KdProcessArgument(int argc, char **argv, int i);
|
||||
|
||||
void
|
||||
KdOsInit(KdOsFuncs * pOsFuncs);
|
||||
|
||||
void
|
||||
KdOsAddInputDrivers(void);
|
||||
|
||||
|
|
|
@ -259,13 +259,6 @@ ddxGiveUp(enum ExitCode error)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
void
|
||||
DarwinHandleGUI(int argc, char *argv[])
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
OsVendorInit(void)
|
||||
{
|
||||
|
|
|
@ -154,13 +154,6 @@ ddxGiveUp(enum ExitCode error)
|
|||
xnestCloseDisplay();
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
void
|
||||
DarwinHandleGUI(int argc, char *argv[])
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
OsVendorInit(void)
|
||||
{
|
||||
|
|
|
@ -549,7 +549,7 @@ getGlCapabilities(struct glCapabilities *cap)
|
|||
continue;
|
||||
}
|
||||
|
||||
conf = calloc(1, sizeof(*conf));
|
||||
conf = malloc(sizeof(*conf));
|
||||
if (NULL == conf) {
|
||||
FatalError("Unable to allocate memory for OpenGL capabilities\n");
|
||||
}
|
||||
|
|
|
@ -44,12 +44,21 @@
|
|||
#if defined(IN_MINI_GLX)
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define _mesa_malloc(b) malloc(b)
|
||||
#define _mesa_free(m) free(m)
|
||||
#define _mesa_memset memset
|
||||
#else
|
||||
#ifdef XFree86Server
|
||||
#include <os.h>
|
||||
#include <string.h>
|
||||
#define _mesa_malloc(b) malloc(b)
|
||||
#define _mesa_free(m) free(m)
|
||||
#define _mesa_memset memset
|
||||
#else
|
||||
#include <X11/Xlibint.h>
|
||||
#define _mesa_memset memset
|
||||
#define _mesa_malloc(b) Xmalloc(b)
|
||||
#define _mesa_free(m) free(m)
|
||||
#endif /* XFree86Server */
|
||||
#endif /* !defined(IN_MINI_GLX) */
|
||||
|
||||
|
@ -120,7 +129,7 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
|
|||
{
|
||||
__GLcontextModes * const next = mode->next;
|
||||
|
||||
(void)memset(mode, 0, sizeof(__GLcontextModes));
|
||||
(void)_mesa_memset(mode, 0, sizeof(__GLcontextModes));
|
||||
mode->next = next;
|
||||
|
||||
mode->visualID = config->vid;
|
||||
|
@ -422,14 +431,14 @@ _gl_context_modes_create(unsigned count, size_t minimum_size)
|
|||
|
||||
next = &base;
|
||||
for (i = 0; i < count; i++) {
|
||||
*next = calloc(1, size);
|
||||
*next = (__GLcontextModes *)_mesa_malloc(size);
|
||||
if (*next == NULL) {
|
||||
_gl_context_modes_destroy(base);
|
||||
base = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
(void)memset(*next, 0, size);
|
||||
(void)_mesa_memset(*next, 0, size);
|
||||
(*next)->visualID = GLX_DONT_CARE;
|
||||
(*next)->visualType = GLX_DONT_CARE;
|
||||
(*next)->visualRating = GLX_NONE;
|
||||
|
@ -467,7 +476,7 @@ _gl_context_modes_destroy(__GLcontextModes * modes)
|
|||
while (modes != NULL) {
|
||||
__GLcontextModes * const next = modes->next;
|
||||
|
||||
free(modes);
|
||||
_mesa_free(modes);
|
||||
modes = next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -549,7 +549,10 @@ __glXAquaScreenCreateDrawable(ClientPtr client,
|
|||
XID glxDrawId,
|
||||
__GLXconfig *conf)
|
||||
{
|
||||
__GLXAquaDrawable *glxPriv = calloc(1, sizeof *glxPriv);
|
||||
__GLXAquaDrawable *glxPriv;
|
||||
|
||||
glxPriv = malloc(sizeof *glxPriv);
|
||||
|
||||
if (glxPriv == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ static int
|
|||
ProcAppleWMSelectInput(register ClientPtr client)
|
||||
{
|
||||
REQUEST(xAppleWMSelectInputReq);
|
||||
WMEventPtr pEvent, *pHead;
|
||||
WMEventPtr pEvent, pNewEvent, *pHead;
|
||||
XID clientResource;
|
||||
int i;
|
||||
|
||||
|
@ -246,7 +246,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
|
|||
}
|
||||
|
||||
/* build the entry */
|
||||
WMEventPtr pNewEvent = calloc(1, sizeof(WMEventRec));
|
||||
pNewEvent = (WMEventPtr)malloc(sizeof(WMEventRec));
|
||||
if (!pNewEvent)
|
||||
return BadAlloc;
|
||||
pNewEvent->next = 0;
|
||||
|
@ -267,7 +267,7 @@ ProcAppleWMSelectInput(register ClientPtr client)
|
|||
* done through the resource database.
|
||||
*/
|
||||
if (i != Success || !pHead) {
|
||||
pHead = calloc(1, sizeof(WMEventPtr));
|
||||
pHead = (WMEventPtr *)malloc(sizeof(WMEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource(eventResource, EventType, (void *)pHead)) {
|
||||
FreeResource(clientResource, X11_RESTYPE_NONE);
|
||||
|
@ -368,15 +368,16 @@ ProcAppleWMReenableUpdate(register ClientPtr client)
|
|||
static int
|
||||
ProcAppleWMSetWindowMenu(register ClientPtr client)
|
||||
{
|
||||
const char *bytes;
|
||||
const char *bytes, **items;
|
||||
char *shortcuts;
|
||||
int max_len, nitems, i, j;
|
||||
REQUEST(xAppleWMSetWindowMenuReq);
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xAppleWMSetWindowMenuReq);
|
||||
|
||||
nitems = stuff->nitems;
|
||||
const char **items = calloc(nitems, sizeof(char *));
|
||||
char *shortcuts = calloc(nitems, sizeof(char));
|
||||
items = malloc(sizeof(char *) * nitems);
|
||||
shortcuts = malloc(sizeof(char) * nitems);
|
||||
|
||||
if (!items || !shortcuts) {
|
||||
free(items);
|
||||
|
@ -689,7 +690,6 @@ SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to)
|
|||
static int
|
||||
SProcAppleWMQueryVersion(register ClientPtr client)
|
||||
{
|
||||
REQUEST(xAppleWMQueryVersionReq);
|
||||
return ProcAppleWMQueryVersion(client);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
int dpi;
|
||||
static int foundIndex = 0;
|
||||
Bool ret;
|
||||
DarwinFramebufferPtr dfb;
|
||||
|
||||
if (!dixRegisterPrivateKey(&darwinScreenKeyRec, PRIVATE_SCREEN, 0))
|
||||
return FALSE;
|
||||
|
@ -201,7 +202,7 @@ DarwinScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
}
|
||||
|
||||
// allocate space for private per screen storage
|
||||
DarwinFramebufferPtr dfb = calloc(1, sizeof(DarwinFramebufferRec));
|
||||
dfb = malloc(sizeof(DarwinFramebufferRec));
|
||||
|
||||
// SCREEN_PRIV(pScreen) = dfb;
|
||||
dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
|
||||
|
|
|
@ -879,7 +879,7 @@ ucs2keysym(long ucs)
|
|||
int mid;
|
||||
|
||||
if (reverse_keysymtab == NULL) {
|
||||
reverse_keysymtab = calloc(1, sizeof(keysymtab));
|
||||
reverse_keysymtab = malloc(sizeof(keysymtab));
|
||||
memcpy(reverse_keysymtab, keysymtab, sizeof(keysymtab));
|
||||
|
||||
qsort(reverse_keysymtab,
|
||||
|
|
|
@ -321,9 +321,11 @@ static int launchd_socket_handed_off = 0;
|
|||
kern_return_t
|
||||
do_request_fd_handoff_socket(mach_port_t port, string_t filename)
|
||||
{
|
||||
socket_handoff_t *handoff_data;
|
||||
|
||||
launchd_socket_handed_off = 1;
|
||||
|
||||
socket_handoff_t *handoff_data = calloc(1, sizeof(socket_handoff_t));
|
||||
handoff_data = (socket_handoff_t *)calloc(1, sizeof(socket_handoff_t));
|
||||
if (!handoff_data) {
|
||||
ErrorF("X11.app: Error allocating memory for handoff_data\n");
|
||||
return KERN_FAILURE;
|
||||
|
@ -526,6 +528,7 @@ setup_console_redirect(const char *bundle_id)
|
|||
static void
|
||||
setup_env(void)
|
||||
{
|
||||
char *temp;
|
||||
const char *pds = NULL;
|
||||
const char *disp = getenv("DISPLAY");
|
||||
size_t len;
|
||||
|
@ -556,7 +559,7 @@ setup_env(void)
|
|||
setenv("X11_PREFS_DOMAIN", server_bootstrap_name, 1);
|
||||
|
||||
len = strlen(server_bootstrap_name);
|
||||
bundle_id_prefix = calloc(len-3, sizeof(char));
|
||||
bundle_id_prefix = malloc(sizeof(char) * (len - 3));
|
||||
if (!bundle_id_prefix) {
|
||||
ErrorF("X11.app: Memory allocation error.\n");
|
||||
exit(1);
|
||||
|
@ -579,7 +582,7 @@ setup_env(void)
|
|||
"X11.app: Detected old style launchd DISPLAY, please update xinit.\n");
|
||||
}
|
||||
else {
|
||||
char *temp = calloc(len, sizeof(char));
|
||||
temp = (char *)malloc(sizeof(char) * len);
|
||||
if (!temp) {
|
||||
ErrorF(
|
||||
"X11.app: Memory allocation error creating space for socket name test.\n");
|
||||
|
@ -610,7 +613,7 @@ setup_env(void)
|
|||
ensure_path(X11BINDIR);
|
||||
|
||||
/* cd $HOME */
|
||||
char *temp = getenv("HOME");
|
||||
temp = getenv("HOME");
|
||||
if (temp != NULL && temp[0] != '\0')
|
||||
chdir(temp);
|
||||
}
|
||||
|
@ -778,14 +781,14 @@ command_from_prefs(const char *key, const char *default_value)
|
|||
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
|
||||
CFRelease(cfDefaultValue);
|
||||
|
||||
command = calloc(len, sizeof(char));
|
||||
command = (char *)malloc(len * sizeof(char));
|
||||
if (!command)
|
||||
goto command_from_prefs_out;
|
||||
strcpy(command, default_value);
|
||||
}
|
||||
else {
|
||||
int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
|
||||
command = calloc(len, sizeof(char));
|
||||
command = (char *)malloc(len * sizeof(char));
|
||||
if (!command)
|
||||
goto command_from_prefs_out;
|
||||
CFStringGetCString((CFStringRef)PlistRef, command, len,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
* needs and simply execs the startup script which then execs the main binary.
|
||||
*/
|
||||
|
||||
static char *executable_path() {
|
||||
static char *executable_path(void) {
|
||||
uint32_t bufsize = PATH_MAX;
|
||||
char *buf = calloc(1, bufsize);
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ QuartzCopyDisplayIDs(ScreenPtr pScreen,
|
|||
free(pQuartzScreen->displayIDs);
|
||||
if (displayCount) {
|
||||
size_t size = displayCount * sizeof(CGDirectDisplayID);
|
||||
pQuartzScreen->displayIDs = calloc(1, size);
|
||||
pQuartzScreen->displayIDs = malloc(size);
|
||||
memcpy(pQuartzScreen->displayIDs, displayIDs, size);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -81,7 +81,7 @@ create_thread(void *func, void *arg)
|
|||
void
|
||||
QuartzInitServer(int argc, char **argv, char **envp)
|
||||
{
|
||||
struct arg *args = calloc(1, sizeof(struct arg));
|
||||
struct arg *args = (struct arg *)malloc(sizeof(struct arg));
|
||||
if (!args)
|
||||
FatalError("Could not allocate memory.\n");
|
||||
|
||||
|
|
|
@ -394,7 +394,6 @@ SNotifyEvent(xAppleDRINotifyEvent *from,
|
|||
static int
|
||||
SProcAppleDRIQueryVersion(register ClientPtr client)
|
||||
{
|
||||
REQUEST(xAppleDRIQueryVersionReq);
|
||||
return ProcAppleDRIQueryVersion(client);
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ CreateSurfaceForWindow(ScreenPtr pScreen, WindowPtr pWin,
|
|||
xp_window_changes wc;
|
||||
|
||||
/* allocate a DRI Window Private record */
|
||||
if (!(pDRIDrawablePriv = calloc(1, sizeof(*pDRIDrawablePriv)))) {
|
||||
if (!(pDRIDrawablePriv = malloc(sizeof(*pDRIDrawablePriv)))) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -681,6 +681,7 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id,
|
|||
DrawablePtr pDrawable, char *path,
|
||||
size_t pathmax)
|
||||
{
|
||||
DRIPixmapBufferPtr shared;
|
||||
PixmapPtr pPix;
|
||||
|
||||
if (pDrawable->type != DRAWABLE_PIXMAP)
|
||||
|
@ -688,7 +689,7 @@ DRICreatePixmap(ScreenPtr pScreen, Drawable id,
|
|||
|
||||
pPix = (PixmapPtr)pDrawable;
|
||||
|
||||
DRIPixmapBufferPtr shared = calloc(1, sizeof(*shared));
|
||||
shared = malloc(sizeof(*shared));
|
||||
if (NULL == shared) {
|
||||
FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ X_PFX(list_prepend) (x_list * lst, void *data) {
|
|||
x_list_block *b;
|
||||
int i;
|
||||
|
||||
b = calloc(1, sizeof(x_list_block));
|
||||
b = malloc(sizeof(x_list_block));
|
||||
assert(b != NULL);
|
||||
|
||||
for (i = 0; i < NODES_PER_BLOCK - 1; i++)
|
||||
|
|
|
@ -93,7 +93,7 @@ load_cursor(CursorPtr src, int screen)
|
|||
const uint32_t *be_data = (uint32_t *)src->bits->argb;
|
||||
unsigned i;
|
||||
rowbytes = src->bits->width * sizeof(CARD32);
|
||||
data = calloc(src->bits->height, rowbytes);
|
||||
data = malloc(rowbytes * src->bits->height);
|
||||
free_data = TRUE;
|
||||
if (!data) {
|
||||
FatalError("Failed to allocate memory in %s\n", __func__);
|
||||
|
@ -119,7 +119,7 @@ load_cursor(CursorPtr src, int screen)
|
|||
|
||||
/* round up to 8 pixel boundary so we can convert whole bytes */
|
||||
rowbytes = ((src->bits->width * 4) + 31) & ~31;
|
||||
data = calloc(src->bits->height, rowbytes);
|
||||
data = malloc(rowbytes * src->bits->height);
|
||||
free_data = TRUE;
|
||||
if (!data) {
|
||||
FatalError("Failed to allocate memory in %s\n", __func__);
|
||||
|
|
|
@ -198,7 +198,7 @@ static void
|
|||
xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height,
|
||||
ScreenPtr pScreen)
|
||||
{
|
||||
CGDisplayCount i;
|
||||
CGDisplayCount i, displayCount;
|
||||
CGDirectDisplayID *displayList = NULL;
|
||||
CGRect unionRect = CGRectNull, frame;
|
||||
|
||||
|
@ -224,7 +224,7 @@ xprAddPseudoramiXScreens(int *x, int *y, int *width, int *height,
|
|||
if (CGDisplayIsCaptured(kCGDirectMainDisplay))
|
||||
displayCount = 1;
|
||||
|
||||
CGDisplayCount displayList = calloc(displayCount, sizeof(CGDirectDisplayID));
|
||||
displayList = malloc(displayCount * sizeof(CGDirectDisplayID));
|
||||
if (!displayList)
|
||||
FatalError("Unable to allocate memory for list of displays.\n");
|
||||
CGGetActiveDisplayList(displayCount, displayList, &displayCount);
|
||||
|
|
|
@ -3,10 +3,10 @@ project('xserver', 'c',
|
|||
'buildtype=debugoptimized',
|
||||
'c_std=gnu99',
|
||||
],
|
||||
version: '25.0.0.3',
|
||||
version: '25.0.0.4',
|
||||
meson_version: '>= 0.58.0',
|
||||
)
|
||||
release_date = '2025-07-02'
|
||||
release_date = '2025-07-04'
|
||||
|
||||
add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc'])
|
||||
cc = meson.get_compiler('c')
|
||||
|
|
|
@ -1040,8 +1040,6 @@ XFixesCursorInit(void)
|
|||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
||||
if (!cs)
|
||||
return FALSE;
|
||||
dixScreenHookClose(pScreen, CursorScreenClose);
|
||||
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
|
||||
cs->pCursorHideCounts = NULL;
|
||||
|
|
Loading…
Reference in New Issue