void * zlistx_insert (zlistx_t *self, void *item, bool low_value) { assert (self); if (self->duplicator) { item = (self->duplicator) (item); assert (item); } node_t *node = s_node_new (item); assert (node); zlistx_reorder (self, node, low_value); self->cursor = self->head; self->size++; return node; }
void * zlistx_insert (zlistx_t *self, void *item, bool low_value) { assert (self); if (self->duplicator) { item = (self->duplicator)(item); if (!item) return NULL; // Out of memory } node_t *node = s_node_new (item); if (node) { zlistx_reorder (self, node, low_value); self->cursor = self->head; self->size++; } return node; }
/// // Move an item, specified by handle, into position in a sorted list. Uses // the item comparator, if any, to determine the new location. If low_value // is true, starts searching from the start of the list, otherwise searches // from the end. void QZlistx::reorder (void *handle, bool lowValue) { zlistx_reorder (self, handle, lowValue); }