MCPcopy Create free account
hub / github.com/Singular/Singular / _omCheckSortedList

Function _omCheckSortedList

omalloc/omList.c:216–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216omError_t _omCheckSortedList(void* list, int next, int long_field, int level, omError_t report, OM_FLR_DECL)
217{
218 void* prev = NULL;
219
220 if (level <= 1) return omError_NoError;
221
222 if (level == 1)
223 {
224 while (list != NULL)
225 {
226 omCheckReturn(omCheckPtr(list, report, OM_FLR_VAL));
227 if (prev != NULL && VALUE(prev, long_field) > VALUE(list, long_field))
228 return omReportError(omError_SortedListError, report, OM_FLR_VAL,
229 "%d > %d", VALUE(prev, long_field), VALUE(list, long_field));
230 prev = list;
231 ITER(list);
232 }
233 }
234 else
235 {
236 void* l1 = list;
237 void* l2;
238 int l = 0, i;
239
240 while (l1 != NULL)
241 {
242 omCheckReturn(omCheckPtr(l1, report, OM_FLR_VAL));
243 if (prev != NULL && VALUE(prev, long_field) > VALUE(l1, long_field))
244 return omReportError(omError_SortedListError, report, OM_FLR_VAL,
245 "%d > %d", VALUE(prev, long_field), VALUE(l1, long_field));
246 i = 0;
247 l2 = list;
248 while (l1 != l2)
249 {
250 i++;
251 ITER(l2);
252 }
253 omCheckReturnError(i != l, omError_ListCycleError);
254 prev = l1;
255 ITER(l1);
256 l++;
257 }
258 }
259 return omError_NoError;
260}
261#endif
262#endif

Callers

nothing calls this directly

Calls 2

omCheckPtrFunction · 0.85
omReportErrorFunction · 0.85

Tested by

no test coverage detected