aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_internal.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-11-11 17:59:31 -0500
committerDavid Robillard <d@drobilla.net>2015-11-11 17:59:31 -0500
commitdb28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6 (patch)
tree8587d475f76bb70406bd5255517e3963aeaf1fd5 /pugl/pugl_internal.h
parent95a42df7a459fb089d2d55b52c7c84f2a296c0f4 (diff)
downloadpugl-db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6.tar.gz
pugl-db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6.tar.bz2
pugl-db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6.zip
Avoid use of strdup
Diffstat (limited to 'pugl/pugl_internal.h')
-rw-r--r--pugl/pugl_internal.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h
index 7dc9cfa..bef8399 100644
--- a/pugl/pugl_internal.h
+++ b/pugl/pugl_internal.h
@@ -28,6 +28,9 @@
PUGL_HAVE_GL: Include OpenGL support code.
*/
+#include <stdlib.h>
+#include <string.h>
+
#include "pugl/pugl.h"
#include "pugl/event.h"
@@ -120,8 +123,11 @@ puglInitWindowAspectRatio(PuglView* view,
void
puglInitWindowClass(PuglView* view, const char* name)
{
+ const size_t len = strlen(name);
+
free(view->windowClass);
- view->windowClass = strdup(name);
+ view->windowClass = (char*)calloc(1, len + 1);
+ memcpy(view->windowClass, name, len);
}
void