I'm looking at Bruno's data structure modules, in particular linked-list, and consider using it to hold the information related to all open fd's handled by select() in GnuTLS's gnutls-serv. One important feature of our current implementation is that I can register my custom "free" function, which can do more things than just memory deallocation:
static void listener_free (listener_item * j) { if (j->http_request) free (j->http_request); if (j->http_response) free (j->http_response); if (j->fd >= 0) { gnutls_bye (j->tls_session, GNUTLS_SHUT_WR); shutdown (j->fd, 2); close (j->fd); gnutls_deinit (j->tls_session); } } This function is invoked for each list item that for any reason is being removed from the list. Is it possible to do this with the linked-list module? By reading gl_anylinked_list2.h it appear as de-allocating a list item is pretty hard coded, and several function do 'free' on it. I imagine some function to register a "free"-handler, and it would be used by all other functions that want to de-allocate a particular node. Thoughts? /Simon