/** \name String */
/*@{*/
-/**
- * Implemented using malloc() and strcpy.
- * Note that NULL is handled accordingly.
- */
-char *
-_mesa_strdup( const char *s )
-{
- if (s) {
- size_t l = strlen(s);
- char *s2 = malloc(l + 1);
- if (s2)
- strcpy(s2, s);
- return s2;
- }
- else {
- return NULL;
- }
-}
/** Compute simple checksum/hash for a string */
unsigned int
return h & 0x8000;
}
-extern char *
-_mesa_strdup( const char *s );
-
extern unsigned int
_mesa_str_checksum(const char *str);
MAX_LABEL_LENGTH);
/* null-terminated string */
- *labelPtr = _mesa_strdup(label);
+ *labelPtr = strdup(label);
}
}
}
fclose(f);
- shader = _mesa_strdup(buffer);
+ shader = strdup(buffer);
free(buffer);
return shader;
/* Save the new names and the count */
for (i = 0; i < count; i++) {
- shProg->TransformFeedback.VaryingNames[i] = _mesa_strdup(varyings[i]);
+ shProg->TransformFeedback.VaryingNames[i] = strdup(varyings[i]);
}
shProg->TransformFeedback.NumVarying = count;
memcpy(dest, src, n * sizeof(struct prog_instruction));
for (i = 0; i < n; i++) {
if (src[i].Comment)
- dest[i].Comment = _mesa_strdup(src[i].Comment);
+ dest[i].Comment = strdup(src[i].Comment);
}
return dest;
}
for (i = 0; i < sz4; i++) {
struct gl_program_parameter *p = paramList->Parameters + oldNum + i;
- p->Name = name ? _mesa_strdup(name) : NULL;
+ p->Name = name ? strdup(name) : NULL;
p->Type = type;
p->Size = size;
p->DataType = datatype;
break;
}
- return _mesa_strdup(str);
+ return strdup(str);
}
STATIC_ASSERT(NUM_TEXTURE_TARGETS <= (1 << 4));
ctx->Program.ErrorPos = -1;
- ctx->Program.ErrorString = _mesa_strdup("");
+ ctx->Program.ErrorString = strdup("");
ctx->VertexProgram.Enabled = GL_FALSE;
ctx->VertexProgram.PointSizeEnabled =
free((void *) ctx->Program.ErrorString);
if (!string)
string = "";
- ctx->Program.ErrorString = _mesa_strdup(string);
+ ctx->Program.ErrorString = strdup(string);
}
assert(clone->Target == prog->Target);
assert(clone->RefCount == 1);
- clone->String = (GLubyte *) _mesa_strdup((char *) prog->String);
+ clone->String = (GLubyte *) strdup((char *) prog->String);
clone->Format = prog->Format;
clone->Instructions = _mesa_alloc_instructions(prog->NumInstructions);
if (!clone->Instructions) {