Skip to content
Snippets Groups Projects
Commit b279b2a8 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel: Committed by Sergey Kosukhin
Browse files

Convert VLA struct member to pointer.

parent 8a0e4e14
No related branches found
No related tags found
2 merge requests!34Version 2.2.0,!13Consolidation with CDI-PIO (develop)
......@@ -43,11 +43,11 @@ enum
*/
struct mwFileBuf
{
char *name;
struct dBuffer *db;
int fd;
enum IO_Server_command command;
int tsID, fileID;
char name[];
};
static int
......@@ -64,8 +64,12 @@ static struct mwFileBuf *
newMultiwriterFileBuf(const char *key, size_t bs)
{
size_t len = strlen(key);
struct mwFileBuf *afd = Calloc(1, sizeof(*afd) + len + 1);
strcpy(afd->name, key);
struct mwFileBuf *afd = Calloc(1, sizeof(*afd));
{
size_t nameSize = len + 1;
char *name = afd->name = Malloc(nameSize);
memcpy(afd->name, key, nameSize);
}
afd->tsID = 0;
/* init output buffer */
......@@ -98,7 +102,8 @@ deleteMultiwriterFileBuf(void *v)
/* file closed, cleanup */
xdebug("name=%s, file closed, cleanup ...", afd->name);
dbuffer_cleanup(&afd->db);
Free(afd->name);
afd->name = NULL;
Free(afd);
return iret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment