MCPcopy Create free account
hub / github.com/creatale/node-dv / lqueueAdd

Function lqueueAdd

deps/leptonica/src/queue.c:186–213  ·  view source on GitHub ↗

--------------------------------------------------------------------------* * Accessors * *--------------------------------------------------------------------------*/ ! * \brief lqueueAdd() * * \param[in] lq lqueue * \param[in] item to be added to the tail of the queue * \return 0 if OK, 1 on error * * * Notes

Source from the content-addressed store, hash-verified

184 * </pre>
185 */
186l_int32
187lqueueAdd(L_QUEUE *lq,
188 void *item)
189{
190 PROCNAME("lqueueAdd");
191
192 if (!lq)
193 return ERROR_INT("lq not defined", procName, 1);
194 if (!item)
195 return ERROR_INT("item not defined", procName, 1);
196
197 /* If filled to the end and the ptrs can be shifted to the left,
198 * shift them. */
199 if ((lq->nhead + lq->nelem >= lq->nalloc) && (lq->nhead != 0)) {
200 memmove(lq->array, lq->array + lq->nhead, sizeof(void *) * lq->nelem);
201 lq->nhead = 0;
202 }
203
204 /* If necessary, expand the allocated array by a factor of 2 */
205 if (lq->nelem > 0.75 * lq->nalloc)
206 lqueueExtendArray(lq);
207
208 /* Now add the item */
209 lq->array[lq->nhead + lq->nelem] = (void *)item;
210 lq->nelem++;
211
212 return 0;
213}
214
215
216/*!

Callers 5

generateBinaryMazeFunction · 0.85
pixSearchBinaryMazeFunction · 0.85
pushNewPixelFunction · 0.85
seedfillGrayLowFunction · 0.85
seedfillGrayInvLowFunction · 0.85

Calls 1

lqueueExtendArrayFunction · 0.85

Tested by

no test coverage detected