Skip to content

SDSPush

starnight edited this page Jun 15, 2013 · 9 revisions

The SDSPush, SDSPushQueue, SDSPushStack and SDSPushRing push an element into the buffer of the data structure. The SDSPush is the generalized function of SDSPushQueue, SDSPushStack and SDSPushRing.

C Specification

/* Push an element into the buffer of the data structure. */
uint8_t SDSPush(struct _SDS_BUFFER *b, void *elem, size_t size);
/* Push an element into the buffer of the queue. */
uint8_t SDSPushQueue(SDS_QUEUE *b, void *elem, size_t size);
/* Push an element into the buffer of the stack. */
uint8_t SDSPushStack(SDS_STACK *b, void *elem, size_t size);
/* Push an element into the buffer of the ring. */
uint8_t SDSPushRing(SDS_RING *b, void *elem, size_t size);

Parameters

  • b - The SDS structure pointer which could be SDS_QUEUE, SDS_STACK or SDS_RING is going to be pushed an element.
  • elem - The pointer of element going to be pushed.
  • size - The size of the element going to be pushed.

Return

It will return the error number to represent the status of SDS structure b. The number could be SDS_OK, SDS_BUFFERFULL or SDS_BUFFEROVERFLOW.

Example

Please reference here.

Clone this wiki locally