src/GLX/libglxmapping.c
static int AddVendorXIDMapping(Display *dpy, __GLXdisplayInfo *dpyInfo, XID xid, __GLXvendorInfo *vendor)
{
    __GLXvendorXIDMappingHash *pEntry = NULL;

    if (xid == None) {
        return 0;
    }

    if (vendor == NULL) {
        return -1;
    }

    LKDHASH_WRLOCK(dpyInfo->xidVendorHash);

    HASH_FIND(hh, _LH(dpyInfo->xidVendorHash), &xid, sizeof(xid), pEntry);

    if (pEntry == NULL) {
        pEntry = malloc(sizeof(*pEntry));
        if (pEntry == NULL) {
            LKDHASH_UNLOCK(dpyInfo->xidVendorHash);
            return -1;
        }
        pEntry->xid = xid;
        pEntry->vendor = vendor;
        HASH_ADD(hh, _LH(dpyInfo->xidVendorHash), xid, sizeof(xid), pEntry);
    } else {
        // Like GLXContext and GLXFBConfig handles, any GLXDrawables must map
        // to a single vendor library.
        if (pEntry->vendor != vendor) {
            LKDHASH_UNLOCK(dpyInfo->xidVendorHash);
            return -1;
        }
    }

    LKDHASH_UNLOCK(dpyInfo->xidVendorHash);
    return 0;
}
/****************************************************************************/
/*
 * __GLXvendorXIDMappingHash is a hash table which maps XIDs to vendors.
 */
GLXvendorXIDMappingHash is a hash table which maps XIDs to vendors.
GLXvendorXIDMappingHash is a hash table which maps XIDs to vendors .
static int AddVendorXIDMapping(Display *dpy, __GLXdisplayInfo *dpyInfo, XID xid, __GLXvendorInfo *vendor)
{
    __GLXvendorXIDMappingHash *pEntry = NULL;
    if (xid == None) {
        return 0;
    }
    if (vendor == NULL) {
        return -1;
    }
    LKDHASH_WRLOCK(dpyInfo->xidVendorHash);
    HASH_FIND(hh, _LH(dpyInfo->xidVendorHash), &xid, sizeof(xid), pEntry);
    if (pEntry == NULL) {
        pEntry = malloc(sizeof(*pEntry));
        if (pEntry == NULL) {
            LKDHASH_UNLOCK(dpyInfo->xidVendorHash);
            return -1;
        }
        pEntry->xid = xid;
        pEntry->vendor = vendor;
        HASH_ADD(hh, _LH(dpyInfo->xidVendorHash), xid, sizeof(xid), pEntry);
    } else {
        if (pEntry->vendor != vendor) {
            LKDHASH_UNLOCK(dpyInfo->xidVendorHash);
            return -1;
        }
    }
    LKDHASH_UNLOCK(dpyInfo->xidVendorHash);
    return 0;
}
static int AddVendorXIDMapping ( Display * dpy , __GLXdisplayInfo * dpyInfo , XID xid , __GLXvendorInfo * vendor ) { __GLXvendorXIDMappingHash * pEntry = NULL ; if ( xid == None ) { return 0 ; } if ( vendor == NULL ) { return -1 ; } LKDHASH_WRLOCK ( dpyInfo -> xidVendorHash ) ; HASH_FIND ( hh , _LH ( dpyInfo -> xidVendorHash ) , & xid , sizeof ( xid ) , pEntry ) ; if ( pEntry == NULL ) { pEntry = malloc ( sizeof ( * pEntry ) ) ; if ( pEntry == NULL ) { LKDHASH_UNLOCK ( dpyInfo -> xidVendorHash ) ; return -1 ; } pEntry -> xid = xid ; pEntry -> vendor = vendor ; HASH_ADD ( hh , _LH ( dpyInfo -> xidVendorHash ) , xid , sizeof ( xid ) , pEntry ) ; } else { if ( pEntry -> vendor != vendor ) { LKDHASH_UNLOCK ( dpyInfo -> xidVendorHash ) ; return -1 ; } } LKDHASH_UNLOCK ( dpyInfo -> xidVendorHash ) ; return 0 ; }
__GLXvendorXIDMappingHash is a hash table which maps XIDs to vendors.
__GLXvendorXIDMappingHash is a hash table which maps XIDs to vendors .
// Like GLXContext and GLXFBConfig handles, any GLXDrawables must map // to a single vendor library.