diff options
author | David Robillard <d@drobilla.net> | 2015-11-11 17:59:31 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-11-11 17:59:31 -0500 |
commit | db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6 (patch) | |
tree | 8587d475f76bb70406bd5255517e3963aeaf1fd5 /pugl | |
parent | 95a42df7a459fb089d2d55b52c7c84f2a296c0f4 (diff) | |
download | pugl-db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6.tar.gz pugl-db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6.tar.bz2 pugl-db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6.zip |
Avoid use of strdup
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/pugl_internal.h | 8 |
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 |