Remove use of gnu-extension anonymous struct/union definitions. (#1838)

This commit is contained in:
Jonathan Hui
2017-05-27 21:24:22 -07:00
committed by GitHub
parent ba3f8cd710
commit ee089fb8b6
2 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -389,7 +389,7 @@ otError Message::SetPriority(uint8_t aPriority)
if (mBuffer.mHead.mInfo.mInPriorityQ) if (mBuffer.mHead.mInfo.mInPriorityQ)
{ {
priorityQueue = mBuffer.mHead.mInfo.mPriorityQueue; priorityQueue = mBuffer.mHead.mInfo.mQueue.mPriority;
priorityQueue->Dequeue(*this); priorityQueue->Dequeue(*this);
} }
else else
@@ -786,13 +786,13 @@ uint16_t Message::UpdateChecksum(uint16_t aChecksum, uint16_t aOffset, uint16_t
void Message::SetMessageQueue(MessageQueue *aMessageQueue) void Message::SetMessageQueue(MessageQueue *aMessageQueue)
{ {
mBuffer.mHead.mInfo.mMessageQueue = aMessageQueue; mBuffer.mHead.mInfo.mQueue.mMessage = aMessageQueue;
mBuffer.mHead.mInfo.mInPriorityQ = false; mBuffer.mHead.mInfo.mInPriorityQ = false;
} }
void Message::SetPriorityQueue(PriorityQueue *aPriorityQueue) void Message::SetPriorityQueue(PriorityQueue *aPriorityQueue)
{ {
mBuffer.mHead.mInfo.mPriorityQueue = aPriorityQueue; mBuffer.mHead.mInfo.mQueue.mPriority = aPriorityQueue;
mBuffer.mHead.mInfo.mInPriorityQ = true; mBuffer.mHead.mInfo.mInPriorityQ = true;
} }
+11 -11
View File
@@ -91,9 +91,9 @@ struct MessageInfo
MessagePool *mMessagePool; ///< Identifies the message pool for this message. MessagePool *mMessagePool; ///< Identifies the message pool for this message.
union union
{ {
MessageQueue *mMessageQueue; ///< Identifies the message queue (if any) where this message is queued. MessageQueue *mMessage; ///< Identifies the message queue (if any) where this message is queued.
PriorityQueue *mPriorityQueue; ///< Identifies the priority queue (if any) where this message is queued. PriorityQueue *mPriority; ///< Identifies the priority queue (if any) where this message is queued.
}; } mQueue; ///< Identifies the queue (if any) where this message is queued.
uint16_t mReserved; ///< Number of header bytes reserved for the message. uint16_t mReserved; ///< Number of header bytes reserved for the message.
uint16_t mLength; ///< Number of bytes within the message. uint16_t mLength; ///< Number of bytes within the message.
@@ -107,7 +107,7 @@ struct MessageInfo
{ {
uint16_t mPanId; ///< Used for MLE Discover Request and Response messages. uint16_t mPanId; ///< Used for MLE Discover Request and Response messages.
uint8_t mChannel; ///< Used for MLE Announce. uint8_t mChannel; ///< Used for MLE Announce.
}; } mPanIdChannel; ///< Used for MLE Discover Request, Response, and Announce messages.
uint8_t mType : 2; ///< Identifies the type of message. uint8_t mType : 2; ///< Identifies the type of message.
uint8_t mSubType : 4; ///< Identifies the message sub type. uint8_t mSubType : 4; ///< Identifies the message sub type.
@@ -518,7 +518,7 @@ public:
* @returns The IEEE 802.15.4 Destination PAN ID. * @returns The IEEE 802.15.4 Destination PAN ID.
* *
*/ */
uint16_t GetPanId(void) const { return mBuffer.mHead.mInfo.mPanId; } uint16_t GetPanId(void) const { return mBuffer.mHead.mInfo.mPanIdChannel.mPanId; }
/** /**
* This method sets the IEEE 802.15.4 Destination PAN ID. * This method sets the IEEE 802.15.4 Destination PAN ID.
@@ -528,7 +528,7 @@ public:
* @param[in] aPanId The IEEE 802.15.4 Destination PAN ID. * @param[in] aPanId The IEEE 802.15.4 Destination PAN ID.
* *
*/ */
void SetPanId(uint16_t aPanId) { mBuffer.mHead.mInfo.mPanId = aPanId; } void SetPanId(uint16_t aPanId) { mBuffer.mHead.mInfo.mPanIdChannel.mPanId = aPanId; }
/** /**
* This method returns the IEEE 802.15.4 Channel to use for transmission. * This method returns the IEEE 802.15.4 Channel to use for transmission.
@@ -538,7 +538,7 @@ public:
* @returns The IEEE 802.15.4 Channel to use for transmission. * @returns The IEEE 802.15.4 Channel to use for transmission.
* *
*/ */
uint8_t GetChannel(void) const { return mBuffer.mHead.mInfo.mChannel; } uint8_t GetChannel(void) const { return mBuffer.mHead.mInfo.mPanIdChannel.mChannel; }
/** /**
* This method sets the IEEE 802.15.4 Channel to use for transmission. * This method sets the IEEE 802.15.4 Channel to use for transmission.
@@ -548,7 +548,7 @@ public:
* @param[in] aChannel The IEEE 802.15.4 Channel to use for transmission. * @param[in] aChannel The IEEE 802.15.4 Channel to use for transmission.
* *
*/ */
void SetChannel(uint8_t aChannel) { mBuffer.mHead.mInfo.mChannel = aChannel; } void SetChannel(uint8_t aChannel) { mBuffer.mHead.mInfo.mPanIdChannel.mChannel = aChannel; }
/** /**
* This method returns the timeout used for 6LoWPAN reassembly. * This method returns the timeout used for 6LoWPAN reassembly.
@@ -639,7 +639,7 @@ public:
* *
*/ */
MessageQueue *GetMessageQueue(void) const { MessageQueue *GetMessageQueue(void) const {
return (!mBuffer.mHead.mInfo.mInPriorityQ) ? mBuffer.mHead.mInfo.mMessageQueue : NULL; return (!mBuffer.mHead.mInfo.mInPriorityQ) ? mBuffer.mHead.mInfo.mQueue.mMessage : NULL;
} }
private: private:
@@ -666,7 +666,7 @@ private:
* @returns `true` if the message is in any queue, `false` otherwise. * @returns `true` if the message is in any queue, `false` otherwise.
* *
*/ */
bool IsInAQueue(void) const { return (mBuffer.mHead.mInfo.mMessageQueue != NULL); } bool IsInAQueue(void) const { return (mBuffer.mHead.mInfo.mQueue.mMessage != NULL); }
/** /**
* This method sets the message queue information for the message. * This method sets the message queue information for the message.
@@ -683,7 +683,7 @@ private:
* *
*/ */
PriorityQueue *GetPriorityQueue(void) const { PriorityQueue *GetPriorityQueue(void) const {
return (mBuffer.mHead.mInfo.mInPriorityQ) ? mBuffer.mHead.mInfo.mPriorityQueue : NULL; return (mBuffer.mHead.mInfo.mInPriorityQ) ? mBuffer.mHead.mInfo.mQueue.mPriority : NULL;
} }
/** /**