summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-03-07 13:15:22 -0700
committerBrian Paul <[email protected]>2015-03-11 09:34:24 -0600
commitd7193ce42cedc4cc7839fc4522edf5724e954c80 (patch)
treeb24eb2b2fd2d0df24423fac7858fdbd76db191ac /src/mesa/main
parent5376bc74ccfac0d1a4df6c5652e075d99e3f4fe4 (diff)
mesa: use strdup() instead of _mesa_strdup()
We were already using strdup() in various places in Mesa. Get rid of the _mesa_strdup() wrapper. All the callers pass a non-NULL argument so the NULL check isn't needed either. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/imports.c18
-rw-r--r--src/mesa/main/imports.h3
-rw-r--r--src/mesa/main/objectlabel.c2
-rw-r--r--src/mesa/main/shaderapi.c2
-rw-r--r--src/mesa/main/transformfeedback.c2
5 files changed, 3 insertions, 24 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index a7ffe229687..ac8deeb97c9 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -481,24 +481,6 @@ _mesa_half_to_float(GLhalfARB val)
/** \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
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 79210006109..ee6b39945a3 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -448,9 +448,6 @@ _mesa_half_is_negative(GLhalfARB h)
return h & 0x8000;
}
-extern char *
-_mesa_strdup( const char *s );
-
extern unsigned int
_mesa_str_checksum(const char *str);
diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index 78df96b9ba8..aecb5b1fa51 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -76,7 +76,7 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label,
MAX_LABEL_LENGTH);
/* null-terminated string */
- *labelPtr = _mesa_strdup(label);
+ *labelPtr = strdup(label);
}
}
}
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 5731d581a9d..3ea76af25d5 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1460,7 +1460,7 @@ read_shader(const char *fname)
fclose(f);
- shader = _mesa_strdup(buffer);
+ shader = strdup(buffer);
free(buffer);
return shader;
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index a3e23ced5af..ce678c86432 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -762,7 +762,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count,
/* 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;