From e188f6c4e1a3b84b5785309491eb3e316218547c Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 6 Jul 2012 14:37:02 +0200 Subject: [PATCH] Replaced manual duplication with strdup. --- src/x11_monitor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/x11_monitor.c b/src/x11_monitor.c index de8cda02..9d790468 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -53,9 +53,7 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, (*current)->physicalWidth = outputInfo->mm_width; (*current)->physicalHeight = outputInfo->mm_height; - (*current)->name = malloc(strlen(outputInfo->name) + 1); - memcpy((*current)->name, outputInfo->name, strlen(outputInfo->name) + 1); - (*current)->name[strlen(outputInfo->name)] = '\0'; + (*current)->name = strdup(outputInfo->name); (*current)->screenX = crtcInfo->x; (*current)->screenY = crtcInfo->y;