static void charset_filter_plaintexts(struct db_main *db) { struct list_entry *current, *last; unsigned char *ptr; char key[PLAINTEXT_BUFFER_SIZE]; last = NULL; if ((current = db->plaintexts->head)) do { if (!current->data[0]) { list_del_next(db->plaintexts, last); continue; } for (ptr = (unsigned char *)current->data; *ptr; ptr++) if (*ptr < CHARSET_MIN || *ptr > CHARSET_MAX) { list_del_next(db->plaintexts, last); break; } if (*ptr) continue; strnzcpy(key, current->data, PLAINTEXT_BUFFER_SIZE); if (ext_filter(key)) { if (strlen(key) <= strlen(current->data)) strcpy(current->data, key); } else { list_del_next(db->plaintexts, last); continue; } last = current; } while ((current = current->next)); }
int list_del_node(list_t *lst, node_t *node) { node_t *iter; if (node == NULL || lst->node_cnt == 0) return -1; for_each_node(iter, lst) { if (iter == node) { list_del_next(lst, node->prev); lst->node_cnt--; return 0; } } return -1; }
node_t *list_del_head(list_t *lst) { return list_del_next(lst, lst->head); }