Use better naming for msgQueue

This commit is contained in:
Glenn Y. Rolland 2019-09-17 14:49:28 +02:00
parent e863158bda
commit c0a30e0977
5 changed files with 22 additions and 4 deletions

View file

@ -69,6 +69,7 @@ typedef struct MsgSpaceList {
} msgSpaceList; } msgSpaceList;
typedef struct MsgQueueElem { typedef struct MsgQueueElem {
msgQueueElemId id;
int poolIndex; int poolIndex;
int bufferIndex; int bufferIndex;
msgQueueElemId next; msgQueueElemId next;

View file

@ -1,7 +1,8 @@
#include "libnazgul.h" #include "libnazgul.h"
#include "ids.h" #include "ids.h"
#include "libnazgul.h"
int queueClose(msgQueue * queue){ int msgQueueClose(msgQueue * queue){
msgQueueId qId; msgQueueId qId;
strcpy(qId,queue->id); strcpy(qId,queue->id);

View file

@ -5,7 +5,14 @@ int msgQueueElemDelete(msgQueueElemId queueElemId){
msgQueueElemId nextIdToDie; msgQueueElemId nextIdToDie;
queueElemAddr = msgQueueElemOpen(queueElemId); queueElemAddr = msgQueueElemOpen(queueElemId);
msgQueueElemClose(queueElem); strcpy(nextIdToDie,queueElemAddr->id);
msgQueueElemClose(queueElemAddr);
if (shm_unlink(queueElemId) < 0){
NZG_ERROR("shm_unlink msgQueueElem",queueElemId);
goto ERROR;
}
if (nextIdToDie != NULL){ if (nextIdToDie != NULL){
return msgQueueElemDelete(nextIdToDie); return msgQueueElemDelete(nextIdToDie);
} else { } else {

View file

@ -5,7 +5,16 @@ int msgQueueElemDelete(msgQueueElemId queueElemId){
msgQueueElemId nextIdToDie; msgQueueElemId nextIdToDie;
queueElemAddr = msgQueueElemOpen(queueElemId); queueElemAddr = msgQueueElemOpen(queueElemId);
msgQueueElemClose(queueElem); if (queueElemAddr==NULL){
NZG_ERROR("msgQueueElemOpen",queueElemId);
goto ERROR;
}
if (msgQueueElemClose(queueElemAddr) < 0){
NZG_ERROR("msgQueueElemClose",queueElemId);
goto ERROR;
}
if (nextIdToDie != NULL){ if (nextIdToDie != NULL){
return msgQueueElemDelete(nextIdToDie); return msgQueueElemDelete(nextIdToDie);
} else { } else {

View file

@ -1,7 +1,7 @@
#include "libnazgul.h" #include "libnazgul.h"
#include "ids.h" #include "ids.h"
void * queueOpen(msgQueueId queueId){ void * msgQueueOpen(msgQueueId queueId){
int queueFd; int queueFd;
void * queueAddr; void * queueAddr;