TINYGL: Use realloc to increase the size of the vertex array

This commit is contained in:
Cameron Cawley committed 2023-02-03 22:06:53 +00:00
1 parent c89cc0bc4c
commit 4b2e3e6726
3 files changed
+6 -3

No files matched your search

+1 -3
View File
@@ -209,12 +209,10 @@ void GLContext::glopVertex(GLParam *p) {
if (n >= vertex_max) {
GLVertex *newarray;
vertex_max <<= 1; // just double size
newarray = (GLVertex *)gl_malloc(sizeof(GLVertex) * vertex_max);
newarray = (GLVertex *)gl_realloc(vertex, sizeof(GLVertex) * vertex_max);
if (!newarray) {
error("unable to allocate GLVertex array.");
}
memcpy(newarray, vertex, n * sizeof(GLVertex));
gl_free(vertex);
vertex = newarray;
}
// new vertex entry