static void FreeBrowserNodes2(struct List *list) { struct Node *node, *nextnode; if(list == NULL) return; node = list->lh_Head; while( ( nextnode = node->ln_Succ ) != NULL ) { FreeListBrowserNode(node); node = nextnode; } FreeVec(list); }
void free_browserlist(struct List *list) { struct Node *node, *nextnode; if(IsListEmpty(list)) return; node = GetHead(list); do { nextnode = GetSucc(node); // FreeVec(node->ln_Name); FreeListBrowserNode(node); } while(node = nextnode); }
static void myStringCloseListview( Class *cl, Object *obj ) { struct myStringClassData *data; struct Node *node; data = INST_DATA( cl, obj ); if ( data->Window ) { IDoMethod( data->WindowObject, WM_CLOSE ); data->Window = NULL; } while(( node = RemHead( &data->ListviewHeader ))) { FreeListBrowserNode( node ); } }
static uint32 myStringSearch( Class *cl, Object *obj ) { struct myStringClassData *data; struct Window *win; struct Node *node; struct Node *n; uint32 found; uint32 bufpos; STRPTR searchString; STRPTR compString; found = 0; data = INST_DATA( cl, obj ); win = data->Window; // Remove List and Free Nodes SetGadgetAttrs( (struct Gadget *)data->ListviewObject, win, NULL, LISTBROWSER_Labels, ~0, TAG_END ); while(( node = RemHead( &data->ListviewHeader ))) { FreeListBrowserNode( node ); } GetAttr( STRINGA_BufferPos, obj, &bufpos ); if ( bufpos == 0 ) { goto bailout; } //------------- searchString = strstr(data->SearchBuffer, "://"); if(searchString) { searchString += 3; if (bufpos >= searchString - data->SearchBuffer) bufpos -= searchString - data->SearchBuffer; } else searchString = data->SearchBuffer; node = GetHead( data->SearchHeader ); while( node ) { uint32 srcpos; BOOL possible; possible = FALSE; srcpos = 0; compString = strstr(node->ln_Name, "://"); if(compString) compString += 3; else compString = node->ln_Name; if( 0 == strncasecmp( compString, searchString, bufpos ) ) { // found match after protocol possible = TRUE; } else { // no match after protocol, see if there's a match after www if( 0 == strncasecmp( compString, "www.", 4) ) { // got www, compare it! if( 0 == strncasecmp( &compString[4], searchString, bufpos ) ) possible = TRUE; } } if ( possible == TRUE ) { n = AllocListBrowserNode( 1, LBNA_Column, 0, LBNCA_CopyText, TRUE, LBNCA_Text, node->ln_Name, TAG_END ); if ( n ) { AddTail( &data->ListviewHeader, n ); found++; } } node = GetSucc( node ); } //------------- bailout: data->ListviewCount = found; data->ListviewSelected = -1; // Add List Again RefreshSetGadgetAttrs( (struct Gadget *)data->ListviewObject, win, NULL, LISTBROWSER_Labels, &data->ListviewHeader, LISTBROWSER_Selected, data->ListviewSelected, LISTBROWSER_MakeVisible, 0, TAG_END ); return( found ); }