strdup instead of malloc/strcpy
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1561 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
24caa9843b
commit
ace8df53ef
@ -923,8 +923,7 @@ void fgPlatformGlutSetWindowTitle( const char* title )
|
|||||||
/* Make copy of string to refer to later */
|
/* Make copy of string to refer to later */
|
||||||
if (fgStructure.CurrentWindow->State.pWState.WindowTitle)
|
if (fgStructure.CurrentWindow->State.pWState.WindowTitle)
|
||||||
free(fgStructure.CurrentWindow->State.pWState.WindowTitle);
|
free(fgStructure.CurrentWindow->State.pWState.WindowTitle);
|
||||||
fgStructure.CurrentWindow->State.pWState.WindowTitle = malloc (strlen(title) + 1);
|
fgStructure.CurrentWindow->State.pWState.WindowTitle = strdup(title);
|
||||||
strcpy(fgStructure.CurrentWindow->State.pWState.WindowTitle, title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -935,8 +934,7 @@ void fgPlatformGlutSetIconTitle( const char* title )
|
|||||||
/* Make copy of string to refer to later */
|
/* Make copy of string to refer to later */
|
||||||
if (fgStructure.CurrentWindow->State.pWState.IconTitle)
|
if (fgStructure.CurrentWindow->State.pWState.IconTitle)
|
||||||
free(fgStructure.CurrentWindow->State.pWState.IconTitle);
|
free(fgStructure.CurrentWindow->State.pWState.IconTitle);
|
||||||
fgStructure.CurrentWindow->State.pWState.IconTitle = malloc (strlen(title) + 1);
|
fgStructure.CurrentWindow->State.pWState.IconTitle = strdup(title);
|
||||||
strcpy(fgStructure.CurrentWindow->State.pWState.IconTitle, title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user