diff options
author | brianp <brianp> | 2000-03-29 18:48:11 +0000 |
---|---|---|
committer | brianp <brianp> | 2000-03-29 18:48:11 +0000 |
commit | cfa61c8cd843e8d0f393f3ef52a5ee545e467404 (patch) | |
tree | 2ecbefdbc2be410d1c5f9675271190139572d859 /xc/extras/Mesa/src | |
parent | b09ee5ef891e838f1370592744543401ba32a916 (diff) |
added replacement for non-standard strdup()
Diffstat (limited to 'xc/extras/Mesa/src')
-rw-r--r-- | xc/extras/Mesa/src/glapi.c | 16 |
1 files changed, 14 insertions, 2 deletions
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++; |