int main(int argc, char *argv[]) { librdf_storage* storage; char *program=argv[0]; librdf_world *world; world=librdf_new_world(); /* initialise hash, model and storage modules */ librdf_init_hash(world); librdf_init_storage(world); librdf_init_model(world); fprintf(stdout, "%s: Creating storage\n", program); storage=librdf_new_storage(world, NULL, "test", NULL); if(!storage) { fprintf(stderr, "%s: Failed to create new storage\n", program); return(1); } fprintf(stdout, "%s: Opening storage\n", program); if(librdf_storage_open(storage, NULL)) { fprintf(stderr, "%s: Failed to open storage\n", program); return(1); } /* Can do nothing here since need model and storage working */ fprintf(stdout, "%s: Closing storage\n", program); librdf_storage_close(storage); fprintf(stdout, "%s: Freeing storage\n", program); librdf_free_storage(storage); /* finish model and storage modules */ librdf_finish_model(world); librdf_finish_storage(world); librdf_finish_hash(world); LIBRDF_FREE(librdf_world, world); /* keep gcc -Wall happy */ return(0); }
/** * librdf_free_world: * @world: redland world object * * Terminate the library and frees all allocated resources. **/ void librdf_free_world(librdf_world *world) { if(!world) return; librdf_finish_serializer(world); librdf_finish_parser(world); librdf_finish_storage(world); librdf_finish_query(world); librdf_finish_model(world); librdf_finish_statement(world); librdf_finish_concepts(world); librdf_finish_node(world); librdf_finish_uri(world); librdf_finish_hash(world); librdf_finish_digest(world); librdf_finish_raptor(world); #ifdef WITH_THREADS if(world->hash_datums_mutex) { pthread_mutex_destroy(world->hash_datums_mutex); SYSTEM_FREE(world->hash_datums_mutex); world->hash_datums_mutex = NULL; } if(world->statements_mutex) { pthread_mutex_destroy(world->statements_mutex); SYSTEM_FREE(world->statements_mutex); world->statements_mutex = NULL; } if(world->nodes_mutex) { pthread_mutex_destroy(world->nodes_mutex); SYSTEM_FREE(world->nodes_mutex); world->nodes_mutex = NULL; } if(world->mutex) { pthread_mutex_destroy(world->mutex); SYSTEM_FREE(world->mutex); world->mutex = NULL; } #endif #ifdef MODULAR_LIBRDF if (world->ltdl_opened) lt_dlexit(); #endif LIBRDF_FREE(librdf_world, world); }