/** * Add a dynamic stub. */ static struct mapi_stub * stub_add_dynamic(const char *name) { struct mapi_stub *stub; int idx; idx = num_dynamic_stubs; /* minus 1 to make sure we can never reach the last slot */ if (idx >= MAPI_TABLE_NUM_DYNAMIC - 1) return NULL; stub = &dynamic_stubs[idx]; /* dispatch to the last slot, which is reserved for no-op */ stub->addr = entry_generate( MAPI_TABLE_NUM_STATIC + MAPI_TABLE_NUM_DYNAMIC - 1); if (!stub->addr) return NULL; stub->name = (const void *) name; /* to be fixed later */ stub->slot = -1; num_dynamic_stubs = idx + 1; return stub; }
/** * Add a dynamic stub. */ static struct mapi_stub * stub_add_dynamic(const char *name) { struct mapi_stub *stub; int idx; idx = num_dynamic_stubs; /* minus 1 to make sure we can never reach the last slot */ if (idx >= MAPI_TABLE_NUM_DYNAMIC - 1) return NULL; stub = &dynamic_stubs[idx]; /* * name is the pointer passed to glXGetProcAddress, so the caller may free * or modify it later. Allocate a copy of the name to store. */ stub->nameBuffer = strdup(name); if (stub->nameBuffer == NULL) { return NULL; } /* dispatch to the last slot, which is reserved for no-op */ stub->addr = entry_generate(MAPI_LAST_SLOT); if (!stub->addr) { free(stub->nameBuffer); stub->nameBuffer = NULL; return NULL; } stub->nameOffset = NULL; /* to be fixed later */ stub->slot = -1; num_dynamic_stubs = idx + 1; return stub; }
/** * Add a dynamic stub. */ static struct mapi_stub * stub_add_dynamic(const char *name) { struct mapi_stub *stub; int idx; idx = num_dynamic_stubs; /* minus 1 to make sure we can never reach the last slot */ if (idx >= MAPI_TABLE_NUM_DYNAMIC - 1) return NULL; stub = &dynamic_stubs[idx]; /* * name is the pointer passed to glXGetProcAddress, so the caller may free * or modify it later. Allocate a copy of the name to store. */ stub->nameBuffer = strdup(name); if (stub->nameBuffer == NULL) { return NULL; } stub->nameOffset = NULL; /* Assign the next unused slot. */ stub->slot = MAPI_TABLE_NUM_STATIC + idx; stub->addr = entry_generate(stub->slot); if (!stub->addr) { free(stub->nameBuffer); stub->nameBuffer = NULL; return NULL; } num_dynamic_stubs = idx + 1; return stub; }