From cfa61c8cd843e8d0f393f3ef52a5ee545e467404 Mon Sep 17 00:00:00 2001 From: brianp Date: Wed, 29 Mar 2000 18:48:11 +0000 Subject: added replacement for non-standard strdup() --- xc/extras/Mesa/src/glapi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'xc/extras/Mesa/src/glapi.c') diff --git a/xc/extras/Mesa/src/glapi.c b/xc/extras/Mesa/src/glapi.c index c5eea74be..75e778f10 100644 --- a/xc/extras/Mesa/src/glapi.c +++ b/xc/extras/Mesa/src/glapi.c @@ -72,6 +72,18 @@ static _glthread_TSD ContextTSD; static GLuint MaxDispatchOffset = sizeof(struct _glapi_table) / sizeof(void *) - 1; static GLboolean GetSizeCalled = GL_FALSE; +/* strdup is actually not a standard ANSI C or POSIX routine + Irix will not define it if ANSI mode is in effect. */ +static char *str_dup(const char *str) +{ + char *copy; + copy = (char*) malloc(strlen(str) + 1); + if (!copy) + return NULL; + strcpy(copy, str); + return copy; +} + /* @@ -1331,7 +1343,7 @@ _glapi_add_entrypoint(const char *funcName, GLuint offset) if (!entrypoint) return GL_FALSE; - ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); ExtEntryTable[NumExtEntryPoints].Offset = offset; ExtEntryTable[NumExtEntryPoints].Address = entrypoint; NumExtEntryPoints++; @@ -1376,7 +1388,7 @@ _glapi_add_entrypoint2(const char *funcName) entryPoint = generate_entrypoint(offset); if (entryPoint) { NextFreeOffset++; - ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); ExtEntryTable[NumExtEntryPoints].Offset = offset; ExtEntryTable[NumExtEntryPoints].Address = entryPoint; NumExtEntryPoints++; -- cgit v1.2.3