[elinks-users] LIST_HEAD and *prev *next

Yan Seiner yan at seiner.com
Mon Apr 30 11:05:06 PDT 2007


Could someone please clue me in on how to use *prev and *next pointers 
for struct form_control?

I seem to be traversing the list OK, but it segfaults at some point and 
I have no idea why...

I haven't found the right way to test for the end of the list.  The ptr 
values seem OK when they print.

Here's the code snippet:

    while (temp_fc->prev != NULL) {
        temp_fc = temp_fc->prev;
        syslog(LOG_DEBUG,"Prev element ptr: %p\n",temp_fc);
        if(strncmp(fc->_P_idindex, temp_fc->_P_idindex,3) == 0) break;
//        temp_fs = find_form_state(doc_view, temp_fc);
        syslog(LOG_DEBUG,"Prev element ID: %s value 
%s\n",temp_fc->_P_idindex,"yyy");
//        free(temp_fs);
        }

On another topic, I've commented out the find_form_state and subsequent 
free.  I haven't been able to find a 'free_form_state' type of 
function.  Could someone please clue me in on how to free the structure 
allocated with find_form_state?

Thanks,

--Yan



More information about the elinks-users mailing list