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

Function lqueueDestroy

deps/leptonica/src/queue.c:130–163  ·  view source on GitHub ↗

! * \brief lqueueDestroy() * * \param[in,out] plq to be nulled * \param[in] freeflag TRUE to free each remaining struct in the array * \return void * * * Notes: * (1) If freeflag is TRUE, frees each struct in the array. * (2) If freeflag is FALSE but there are elements on the array, * gives a warning and destroys the array. This will * cause a

Source from the content-addressed store, hash-verified

128 * </pre>
129 */
130void
131lqueueDestroy(L_QUEUE **plq,
132 l_int32 freeflag)
133{
134void *item;
135L_QUEUE *lq;
136
137 PROCNAME("lqueueDestroy");
138
139 if (plq == NULL) {
140 L_WARNING("ptr address is NULL\n", procName);
141 return;
142 }
143 if ((lq = *plq) == NULL)
144 return;
145
146 if (freeflag) {
147 while(lq->nelem > 0) {
148 item = lqueueRemove(lq);
149 LEPT_FREE(item);
150 }
151 } else if (lq->nelem > 0) {
152 L_WARNING("memory leak of %d items in lqueue!\n", procName, lq->nelem);
153 }
154
155 if (lq->array)
156 LEPT_FREE(lq->array);
157 if (lq->stack)
158 lstackDestroy(&lq->stack, freeflag);
159 LEPT_FREE(lq);
160 *plq = NULL;
161
162 return;
163}
164
165
166/*--------------------------------------------------------------------------*

Callers 6

generateBinaryMazeFunction · 0.85
pixSearchBinaryMazeFunction · 0.85
lqueueCreateFunction · 0.85
identifyWatershedBasinFunction · 0.85
seedfillGrayLowFunction · 0.85
seedfillGrayInvLowFunction · 0.85

Calls 2

lqueueRemoveFunction · 0.85
lstackDestroyFunction · 0.85

Tested by

no test coverage detected