simplify
This commit is contained in:
@@ -135,15 +135,14 @@ getEventNode(epicsMessageQueueId pmsg)
|
||||
|
||||
evp = reinterpret_cast < struct eventNode * > ( ellGet(&pmsg->eventFreeList) );
|
||||
if (evp == NULL) {
|
||||
epicsEventId eid = epicsEventCreate(epicsEventEmpty);
|
||||
evp = (struct eventNode *) calloc(1, sizeof(*evp));
|
||||
if(!evp || !eid) {
|
||||
if(!evp)
|
||||
return NULL;
|
||||
evp->event = epicsEventCreate(epicsEventEmpty);
|
||||
if(!evp->event) {
|
||||
free(evp);
|
||||
if(eid)
|
||||
epicsEventDestroy(eid);
|
||||
return NULL;
|
||||
}
|
||||
evp->event = eid;
|
||||
}
|
||||
return evp;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ typedef struct epicsThreadOSD {
|
||||
int isFifoScheduled;
|
||||
int isOnThreadList;
|
||||
unsigned int osiPriority;
|
||||
char *name;
|
||||
char name[1];
|
||||
} epicsThreadOSD;
|
||||
|
||||
static pthread_key_t getpthreadInfo;
|
||||
@@ -151,7 +151,8 @@ static epicsThreadOSD * create_threadInfo(const char *name)
|
||||
{
|
||||
epicsThreadOSD *pthreadInfo;
|
||||
|
||||
pthreadInfo = calloc(1,sizeof(*pthreadInfo) + strlen(name)+1);
|
||||
/* sizeof(epicsThreadOSD) includes one byte for the '\0' */
|
||||
pthreadInfo = calloc(1,sizeof(*pthreadInfo) + strlen(name));
|
||||
if(!pthreadInfo)
|
||||
return NULL;
|
||||
pthreadInfo->suspendEvent = epicsEventCreate(epicsEventEmpty);
|
||||
@@ -159,7 +160,6 @@ static epicsThreadOSD * create_threadInfo(const char *name)
|
||||
free(pthreadInfo);
|
||||
return NULL;
|
||||
}
|
||||
pthreadInfo->name = (char*)&pthreadInfo[1];
|
||||
strcpy(pthreadInfo->name, name);
|
||||
return pthreadInfo;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct ringPvt {
|
||||
volatile int nextPut;
|
||||
volatile int nextGet;
|
||||
int size;
|
||||
volatile char *buffer;
|
||||
volatile char buffer[1]; /* actually larger */
|
||||
}ringPvt;
|
||||
|
||||
epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int size)
|
||||
@@ -42,7 +42,6 @@ epicsShareFunc epicsRingBytesId epicsShareAPI epicsRingBytesCreate(int size)
|
||||
if(!pring)
|
||||
return NULL;
|
||||
pring->size = size + SLOP;
|
||||
pring->buffer = (char*)&pring[1];
|
||||
pring->nextGet = 0;
|
||||
pring->nextPut = 0;
|
||||
return((void *)pring);
|
||||
|
||||
Reference in New Issue
Block a user