gboolean __connman_storage_remove_provider(const char *identifier) { gboolean removed; gchar *id; id = g_strdup_printf("%s_%s", "provider", identifier); if (id == NULL) return FALSE; if (remove_all(id) == TRUE) DBG("Removed provider dir %s/%s", STORAGEDIR, id); g_free(id); id = g_strdup_printf("%s_%s", "vpn", identifier); if (id == NULL) return FALSE; if ((removed = remove_all(id)) == TRUE) DBG("Removed vpn dir %s/%s", STORAGEDIR, id); g_free(id); return removed; }
void remove_all(struct hash *hash, struct node *n) { struct tree *t; struct tree_node *h, *s; if (n->neededby->root || n->providedby->root) return; h = tree_first(n->provide->root); while (h) { s = tree_search_tree_node(h->n->providedby, n); tree_node_free(h->n->providedby, s); remove_all(hash, h->n); h = tree_next(h); } h = tree_first(n->need->root); while (h) { s = tree_search_tree_node(h->n->neededby, n); tree_node_free(h->n->neededby, s); remove_all(hash, h->n); h = tree_next(h); } t = hash->tbl[hash_index(n->name)]; s = tree_search_tree_node(t, n); tree_node_free(t, s); node_free(n); }
bool __connman_storage_remove_provider(const char *identifier) { bool removed; gchar *id; id = g_strdup_printf("%s_%s", "provider", identifier); if (!id) return false; if (remove_all(id)) DBG("Removed provider dir %s/%s", STORAGEDIR, id); g_free(id); id = g_strdup_printf("%s_%s", "vpn", identifier); if (!id) return false; if ((removed = remove_all(id))) DBG("Removed vpn dir %s/%s", STORAGEDIR, id); g_free(id); return removed; }
void Tree::remove_all(node * &root) { if(!root) return; remove_all(root->right); remove_all(root->left); delete root; root = NULL; }
void fs::remove_all(const std::string& path, bool remove_root) { for (const auto& entry : dir(path)) { if (entry.name == "." || entry.name == "..") { continue; } if (entry.is_directory == false) { remove_file(path + '/' + entry.name); } if (entry.is_directory == true) { remove_all(path + '/' + entry.name); } } if (remove_root) { remove_dir(path); } }
bool FileWriter::removeOldDirectories() { string numToDelete = "0"; string curDirectoryPath = DIR_NAME + numToDelete; //start at directory "d0" //Remove the direcions & frequencies file outputs if they exist if(exists(oFreq_Directory + DIRECTIONS_FILENAME)) remove(oFreq_Directory + DIRECTIONS_FILENAME); if(exists(oFreq_Directory + FREQUENCIES_FILENAME)) remove(oFreq_Directory + FREQUENCIES_FILENAME); while(exists(oFreq_Directory + curDirectoryPath)) //check if current directory exists { if(!remove_all(oFreq_Directory + curDirectoryPath)) { cerr << "Failed to delete " + oFreq_Directory + curDirectoryPath << endl; return false; } else //increment to next directory { int numToDeleteHelper = boost::lexical_cast<int>(numToDelete); ++numToDeleteHelper; numToDelete = boost::lexical_cast<string>(numToDeleteHelper); curDirectoryPath = DIR_NAME + numToDelete; } } return true; //all directories deleted successfully }
BSONObjExternalSorter::~BSONObjExternalSorter(){ if ( _map ){ delete _map; _map = 0; } remove_all( _root ); }
void metadb_handle_list::delete_all() { if (get_count()>0) { metadb::get()->handle_release_multi(get_ptr(),get_count()); remove_all(); } }
BSONObjExternalSorter::~BSONObjExternalSorter() { if ( _cur ) { delete _cur; _cur = 0; } unsigned long removed = remove_all( _root ); wassert( removed == 1 + _files.size() ); }
void cleanOutputDir(const char *dir_path) { boost::filesystem::path dir(dir_path); if(exists(dir)) { remove_all(dir); } }
//Remove all nodes in the list void remove_all(node * & head) { //Step 3 - Place your code here if (!head) return; remove_all(head ->next); delete head; head = NULL; }
inline int remove_all( const char* file_path ) { int ec; int result = remove_all(file_path, ec); if( ec ) BOOST_THROW_EXCEPTION( std::runtime_error( std::string("Error removing recursively ") + file_path ) ); return result; }
bool FileSystem::DeleteDirectory(const string& directory) { try { return remove_all(directory); } catch (filesystem_error& e) { LOGF_ERROR("FileSystem::DeleteDirectory: %s, %s", e.what(), directory.c_str()); return true; } }
void playlist_cache::delete_all() { // if (synctest) console::error("oh dear 3"); int n,t=get_count(); for(n=0; n<t; n++) { playlist_entry_ui * entry = get_item(n); if (entry) {delete entry;} } remove_all(); }
void Channel::remove(const void *ptr) { if (!ptr) return; try { // Null out targets for (auto& it : mTargets) { if (it.first == ptr) it.second = nullptr; } // Remove from adds remove_all(mAdds, ptr); if (mServiceDirty) *mServiceDirty = true; } catch (std::exception const&) { } }
void dsp_chain_config::contents_from_stream(stream_reader * p_stream,abort_callback & p_abort) { t_uint32 n,count; remove_all(); p_stream->read_lendian_t(count,p_abort); dsp_preset_impl temp; for(n=0;n<count;n++) { temp.contents_from_stream(p_stream,p_abort); add_item(temp); } }
void SkScene::init ( SkSkeleton* s, float scale ) { remove_all(); _jgroup.size ( 0 ); // unref seems to make things unstable with random crash. Since SkScene is only getting a pointer to the skeleton, I think its parent is responsible for cleaning it up. //if ( _skeleton ) { _skeleton->unref(); _skeleton=0; } if ( !s ) return; _skeleton = s; _skeleton->ref(); _needsInit = true; scaleFactor = scale; }
void lin_refresh(void) { GtkTreeStore *treestore; GtkTreeIter toplevel, child; remove_all(); treestore = GTK_TREE_STORE(gtk_tree_view_get_model( GTK_TREE_VIEW(view))); gchar *p = NULL; gchar *q = NULL; struct sockaddr_in addr; int i,j; GList *group = NULL; GList *user = NULL; LinpopUser *temp ; char buf[256]; gboolean result; //userListForeach(printUser,NULL); for(group = getGroupList();group != NULL;group = group->next){ p = (gchar *)group->data; gtk_tree_store_append(treestore, &toplevel, NULL); gtk_tree_store_set(treestore, &toplevel,COLUMN, p,-1); g_print("group:%s\n",p); for(user = getGroupUserList(p);user != NULL;user = user->next){ /* q = (gchar *)user->data; gtk_tree_store_append(treestore, &child, &toplevel); gtk_tree_store_set(treestore, &child,COLUMN,q,-1); g_print("user:%s\n",q);*/ bzero(buf,sizeof(buf)); q = (gchar *)user->data; temp = g_malloc(sizeof(*temp)); inet_aton(q,&addr.sin_addr); result = getUserByIP(addr,temp); assert(result == TRUE); strcat(buf,temp->user); strcat(buf,"("); strcat(buf,q); strcat(buf,")"); strcpy(q,buf); g_print("q is:%s\n",q); gtk_tree_store_append(treestore, &child, &toplevel); gtk_tree_store_set(treestore, &child,COLUMN,q,-1); g_print("user:%s\n",q); freeUser(temp); } } return GTK_TREE_MODEL(treestore); }
void StaticHelpers::dellDir(QString dirName) { try { error_code ec; remove_all(dirName.toStdString(),ec); } catch (...) { //qDebug() << " exception caught int deldir"; } }
void Channel::applyEdits() { try { // Remove empties remove_all(mTargets, nullptr); // Apply all adds if (!mAdds.empty()) { for (const auto& e : mAdds) { mTargets[e.first] = e.second; } mAdds.clear(); } } catch (std::exception const&) { } }
bool remove_all(const path & p) { struct stat buf; if(stat(p.string().c_str(), &buf)) { return true; } if((buf.st_mode & S_IFMT) == S_IFDIR) { for(directory_iterator it(p); !it.end(); ++it) { remove_all(p / it.name()); } } return remove(p); }
int main(void) { setup_locale(); setup_tmpctx(); sanity(); remove_one(); remove_first(); remove_last(); remove_multiple(); remove_all(); remove_complex(); tal_free(tmpctx); printf("run-json_remove ok\n"); }
WT_BlockRef_List const & WT_BlockRef_List::operator=(WT_BlockRef_List const & list) { remove_all(); if (list.is_empty()) return *this; WT_BlockRef *current = (WT_BlockRef *) list.get_head(); while (current != WD_Null) { WT_BlockRef new_item(*current); add(new_item); current = (WT_BlockRef *) current->next(); } return *this; }
WT_Directory const & WT_Directory::operator=(WT_Directory const & directory) { remove_all(); m_file_offset = ((WT_Directory &)directory).get_file_offset(); if (directory.is_empty()) return *this; WT_BlockRef *current = (WT_BlockRef *) directory.get_head(); while (current != WD_Null) { WT_BlockRef new_item(*current); add(new_item); current = (WT_BlockRef *) current->next(); } return *this; }
/** * @precondition IO: File stream points to first byte of RAW data. * @postcondition IO: File stream points to first byte of next * or EOF. */ static int memorize_raw_eb(pfi_raw_t pfi_raw, pdd_data_t pdd, list_t *raw_pebs, io_t io) { int rc = 0; uint32_t i; size_t read, to_read, eb_num; size_t bytes_left; list_t pebs = *raw_pebs; peb_t peb = NULL; long old_file_pos = ftell(io->fp_pfi); for (i = 0; i < pfi_raw->starts_size; i++) { bytes_left = pfi_raw->data_size; rc = fseek(io->fp_pfi, old_file_pos, SEEK_SET); if (rc != 0) goto err; eb_num = byte_to_blk(pfi_raw->starts[i], pdd->eb_size); while (bytes_left) { to_read = MIN(bytes_left, pdd->eb_size); rc = peb_new(eb_num++, pdd->eb_size, &peb); if (rc != 0) goto err; read = fread(peb->data, 1, to_read, io->fp_pfi); if (read != to_read) { rc = -EIO; goto err; } pebs = append_elem(peb, pebs); bytes_left -= read; } } *raw_pebs = pebs; return 0; err: pebs = remove_all((free_func_t)&peb_free, pebs); return rc; }
bool remove_all(const path & p) { if(!exists(p)) { return true; } bool succeeded = true; if(is_directory(p)) { for(directory_iterator it(p); !it.end(); ++it) { if(it.is_regular_file()) { succeeded &= remove(p / it.name()); } else { succeeded &= remove_all(p / it.name()); } } } succeeded &= remove(p); return succeeded; }
void remove_all(std::string const& f, error_code& ec) { ec.clear(); file_status s; stat_file(f, &s, ec); if (ec) return; if (s.mode & file_status::directory) { for (directory i(f, ec); !i.done(); i.next(ec)) { if (ec) return; std::string p = i.file(); if (p == "." || p == "..") continue; remove_all(combine_path(f, p), ec); if (ec) return; } } remove(f, ec); }
int remove_package(struct hash *hash, char *pkgname) { struct node *n; if ((n = hash_search(hash, pkgname)) == NULL) { fprintf(stderr, "bee-dep: remove_package: cannot find \"%s\"\n", pkgname); return 1; } if (!IS_PKG(n)) { fprintf(stderr, "bee-dep: remove_package: \"%s\": no such package\n", pkgname); return 1; } remove_all(hash, n); return 0; }
void initng_config_global_free(void) { /* free all databases */ initng_active_db_free_all(); /* clean process_db */ initng_service_data_type_unregister_all(); /* clean option_db */ initng_event_type_unregister_all(); /* clean event_db */ initng_command_unregister_all(); /* clean command_db */ /* free dynamic global variables */ remove_all(&g); /* free runlevel name string */ free(g.runlevel); /* free console string if set */ free(g.dev_console); /* free our copy of argv, and argc */ for (char **p = g.Argv; *p; p++) { free(*p); } free(g.Argv); }
static int anchor_remove (int argc, char *argv[], bool *changed) { CK_FUNCTION_LIST **modules; p11_array *iters; p11_kit_iter *iter; int ret = 0; int i; iters = uris_or_files_to_iters (argc, argv, P11_KIT_ITER_WANT_WRITABLE); return_val_if_fail (iters != NULL, 1); if (iters->num == 0) { p11_message ("at least one file or uri must be specified"); p11_array_free (iters); return 2; } modules = p11_kit_modules_load_and_initialize (P11_KIT_MODULE_TRUSTED); if (modules == NULL) ret = 1; for (i = 0; ret == 0 && i < iters->num; i++) { iter = iters->elem[i]; p11_kit_iter_begin (iter, modules); if (!remove_all (iter, changed)) ret = 1; } p11_array_free (iters); p11_kit_modules_finalize_and_release (modules); return ret; }