Esempio n. 1
0
/**
 * librdf_finish_concepts:
 * @world: redland world object
 *
 * INTERNAL - Terminate the concepts module.
 *
 **/
void
librdf_finish_concepts(librdf_world *world)
{
    int i;

    /* Free resources and set pointers to NULL so that they are cleared
     * in case the concepts module is initialised again in the same process. */

    if(world->concept_ms_namespace_uri) {
        librdf_free_uri(world->concept_ms_namespace_uri);
        world->concept_ms_namespace_uri=NULL;
    }

    if(world->concept_schema_namespace_uri) {
        librdf_free_uri(world->concept_schema_namespace_uri);
        world->concept_schema_namespace_uri=NULL;
    }

    if(world->concept_resources) {
        for (i=0; i<= LIBRDF_CONCEPT_LAST; i++) {
            /* deletes associated URI too */
            if(world->concept_resources[i])
                librdf_free_node(world->concept_resources[i]);
        }
        LIBRDF_FREE(ptrarray, world->concept_resources);
        world->concept_resources=NULL;
    }

    if(world->concept_uris) {
        /* uris were freed above, now just free the array */
        LIBRDF_FREE(ptrarray, world->concept_uris);
        world->concept_uris=NULL;
    }
}
Esempio n. 2
0
static void
librdf_storage_tstore_find_finished(void* context)
{
  librdf_storage_tstore_find_stream_context* scontext=(librdf_storage_tstore_find_stream_context*)context;

  if(scontext->triple) {
    /* The docs say about rs_find_triples:[[
     *   NB Once rs_find_triples has been called, all the triples
     *   /must/ be fetched with rs_next_triple(), even if they are
     *   not required.
     * ]]
     */
    while(rs_next_triple(scontext->result))
      ;
  }

  if(scontext->result)
    rs_free_result(scontext->result);


  /* FIXME: as alloced in librdf_storage_tstore_statement_as_rs_triple */
  if(scontext->search_triple)
    LIBRDF_FREE(rs_triple, scontext->search_triple);

  if(scontext->storage)
    librdf_storage_remove_reference(scontext->storage);

  LIBRDF_FREE(librdf_storage_tstore_find_stream_context, scontext);
}
Esempio n. 3
0
static void
librdf_storage_file_terminate(librdf_storage* storage)
{
    librdf_storage_file_instance* context=(librdf_storage_file_instance*)storage->instance;

    if (context == NULL)
        return;

    librdf_storage_file_sync(storage);

    if(context->format_name)
        LIBRDF_FREE(cstring, context->format_name);

    if(context->name)
        LIBRDF_FREE(cstring, context->name);

    if(context->uri)
        librdf_free_uri(context->uri);

    if(context->model)
        librdf_free_model(context->model);

    if(context->storage)
        librdf_free_storage(context->storage);

    LIBRDF_FREE(librdf_storage_file_instance, context);
}
Esempio n. 4
0
File: rdf_uri.c Progetto: njh/librdf
/**
 * librdf_free_uri:
 * @uri: #librdf_uri object
 *
 * Destructor - destroy a #librdf_uri object.
 * 
 **/
void
librdf_free_uri(librdf_uri* uri) 
{
#ifdef LIBRDF_USE_RAPTOR_URI
  if(!uri)
    return;
  
  raptor_free_uri(uri);
#else
  librdf_hash_datum key; /* on stack */
#ifdef WITH_THREADS
  librdf_world *world;
#endif

  if(!uri)
    return;
  
#ifdef WITH_THREADS
  world = uri->world;
  pthread_mutex_lock(world->mutex);
#endif

  uri->usage--;
  
#if defined(LIBRDF_DEBUG) && LIBRDF_DEBUG > 1
  LIBRDF_DEBUG3("URI %s usage count now %d\n", uri->string, uri->usage);
#endif

  /* decrement usage, don't free if not 0 yet*/
  if(uri->usage) {
#ifdef WITH_THREADS
    pthread_mutex_unlock(world->mutex);
#endif
    return;
  }

#if defined(LIBRDF_DEBUG) && LIBRDF_DEBUG > 1
  LIBRDF_DEBUG3("Deleting URI %s from hash, max usage was %d\n", uri->string, uri->max_usage);
#endif

  key.data=uri->string;
  key.size=uri->string_length;
  /* Hash deletion fails only if the key is not found.
     This is not a fatal error so do not check for return value. */
  librdf_hash_delete_all(uri->world->uris_hash, &key);

  if(uri->string)
    LIBRDF_FREE(cstring, uri->string);
  LIBRDF_FREE(librdf_uri, uri);

#ifdef WITH_THREADS
  pthread_mutex_unlock(world->mutex);
#endif
#endif /* !LIBRDF_USE_RAPTOR_URI */
}
Esempio n. 5
0
/**
 * librdf_storage_register_factory - Register a storage factory
 * @name: the storage factory name
 * @label: the storage factory label
 * @factory: pointer to function to call to register the factory
 * 
 **/
void
librdf_storage_register_factory(const char *name, const char *label,
				void (*factory) (librdf_storage_factory*)) 
{
  librdf_storage_factory *storage, *h;
  char *name_copy;
  char *label_copy;
  
#if defined(LIBRDF_DEBUG) && LIBRDF_DEBUG > 1
  LIBRDF_DEBUG2("Received registration for storage %s\n", name);
#endif
  
  storage=(librdf_storage_factory*)LIBRDF_CALLOC(librdf_storage_factory, 1,
                                                 sizeof(librdf_storage_factory));
  if(!storage)
    LIBRDF_FATAL1(world, "Out of memory");

  name_copy=(char*)LIBRDF_CALLOC(cstring, strlen(name)+1, 1);
  if(!name_copy) {
    LIBRDF_FREE(librdf_storage, storage);
    LIBRDF_FATAL1(world, "Out of memory");
  }
  strcpy(name_copy, name);
  storage->name=name_copy;
        
  for(h = storages; h; h = h->next ) {
    if(!strcmp(h->name, name_copy)) {
      LIBRDF_FREE(cstring, name_copy); 
      LIBRDF_FREE(librdf_storage, storage);
      LIBRDF_ERROR2(NULL, "storage %s already registered\n", h->name);
      return;
    }
  }
  
  label_copy=(char*)LIBRDF_CALLOC(cstring, strlen(label)+1, 1);
  if(!label_copy) {
    LIBRDF_FREE(librdf_storage, storage);
    LIBRDF_FATAL1(world, "Out of memory");
  }
  strcpy(label_copy, label);
  storage->label=label_copy;
        
  /* Call the storage registration function on the new object */
  (*factory)(storage);
  
#if defined(LIBRDF_DEBUG) && LIBRDF_DEBUG > 1
  LIBRDF_DEBUG3("%s has context size %d\n", name, storage->context_length);
#endif
  
  storage->next = storages;
  storages = storage;
}
Esempio n. 6
0
/* helper functions */
static void
librdf_free_serializer_factory(librdf_serializer_factory *factory) 
{
  if(factory->name)
    LIBRDF_FREE(cstring, factory->name);
  if(factory->label)
    LIBRDF_FREE(cstring, factory->label);
  if(factory->mime_type)
    LIBRDF_FREE(cstring, factory->mime_type);
  if(factory->type_uri)
    librdf_free_uri(factory->type_uri);
  LIBRDF_FREE(librdf_serializer_factory, factory);
}
Esempio n. 7
0
/**
 * librdf_free_serializer:
 * @serializer: the serializer
 *
 * Destructor - destroys a #librdf_serializer object.
 * 
 **/
void
librdf_free_serializer(librdf_serializer *serializer) 
{
  if(!serializer)
    return;
  
  if(serializer->context) {
    if(serializer->factory->terminate)
      serializer->factory->terminate(serializer->context);
    LIBRDF_FREE(serializer_context, serializer->context);
  }
  LIBRDF_FREE(librdf_serializer, serializer);
}
Esempio n. 8
0
/*
 * librdf_delete_storage_factories - helper function to delete all the registered storage factories
 */
static void
librdf_delete_storage_factories(void)
{
  librdf_storage_factory *factory, *next;
  
  for(factory=storages; factory; factory=next) {
    next=factory->next;
    LIBRDF_FREE(librdf_storage_factory, factory->name);
    LIBRDF_FREE(librdf_storage_factory, factory->label);
    LIBRDF_FREE(librdf_storage_factory, factory);
  }
  storages=NULL;
}
Esempio n. 9
0
/**
 * librdf_free_storage - Destructor - destroy a librdf_storage object
 * @storage: &librdf_storage object
 * 
 **/
void
librdf_free_storage (librdf_storage* storage) 
{
  LIBRDF_ASSERT_OBJECT_POINTER_RETURN(storage, librdf_storage);

  if(--storage->usage)
    return;

  if(storage->factory)
    storage->factory->terminate(storage);

  if(storage->context)
    LIBRDF_FREE(librdf_storage_context, storage->context);
  LIBRDF_FREE(librdf_storage, storage);
}
Esempio n. 10
0
/**
 * librdf_list_pop - remove and return the data at the end of the list
 * @list: &librdf_list object
 * 
 * Return value: the data object or NULL if the list is empty
 **/
void*
librdf_list_pop(librdf_list* list)
{
  librdf_list_node *node;
  void *data;

  node=list->last;
  if(!node)
    return NULL;
     
  list->last=node->prev;

  if(list->last)
    /* if list not empty, fix pointers */
    list->last->next=NULL;
  else
    /* list is now empty, zap last pointer */
    list->first=NULL;
  
  /* save data */
  data=node->data;

  /* free node */
  LIBRDF_FREE(librdf_list_node, node);

  list->length--;
  return data;
}
Esempio n. 11
0
/**
 * librdf_list_remove - remove a data item from an librdf_list
 * @list: &librdf_list object
 * @data: the data item
 * 
 * The search is done using the 'equals' function which may be set
 * by librdf_list_set_equals() or by straight comparison of pointers
 * if not set.
 * 
 * Return value: the data stored or NULL on failure (not found or list empty)
 **/
void *
librdf_list_remove(librdf_list* list, void *data) 
{
  librdf_list_node *node;
  
  node=librdf_list_find_node(list, data);
  if(!node)
    /* not found */
    return NULL;

  if(node == list->first)
    list->first=node->next;
  if(node->prev)
    node->prev->next=node->next;

  if(node == list->last)
    list->last=node->prev;
  if(node->next)
    node->next->prev=node->prev;

  /* retrieve actual stored data */
  data=node->data;
  
  /* free node */
  LIBRDF_FREE(librdf_list_node, node);
  list->length--;

  return data;
}
Esempio n. 12
0
/**
 * librdf_new_uri_relative_to_base:
 * @base_uri: absolute base URI
 * @uri_string: relative URI string
 *
 * Constructor - create a new #librdf_uri object from a URI string relative to a base URI.
 *
 * An empty uri_string or NULL is equivalent to 
 * librdf_new_uri_from_uri(base_uri)
 * 
 * Return value: a new #librdf_uri object or NULL on failure
 **/
librdf_uri*
librdf_new_uri_relative_to_base(librdf_uri* base_uri,
                                const unsigned char *uri_string) {
  unsigned char *buffer;
  int buffer_length;
  librdf_uri* new_uri;
  librdf_world *world=base_uri->world;
                                  
  LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(base_uri, librdf_uri, NULL);

  if(!uri_string)
    return NULL;
  
  /* If URI string is empty, just copy base URI */
  if(!*uri_string)
    return librdf_new_uri_from_uri(base_uri);
  
  /* +2 is for \0 plus an extra 1 for adding any missing URI path '/' */
  buffer_length=base_uri->string_length + strlen((const char*)uri_string) +2;
  buffer=(unsigned char*)LIBRDF_MALLOC(cstring, buffer_length);
  if(!buffer)
    return NULL;
  
  raptor_uri_resolve_uri_reference(base_uri->string, uri_string,
                                   buffer, buffer_length);

  new_uri=librdf_new_uri(world, buffer);
  LIBRDF_FREE(cstring, buffer);
  return new_uri;
}
Esempio n. 13
0
/**
 * librdf_new_uri_from_uri_local_name:
 * @old_uri: #librdf_uri object
 * @local_name: local name to append to URI
 *
 * Copy constructor - create a new librdf_uri object from an existing librdf_uri object and a local name.
 * 
 * Return value: a new #librdf_uri object or NULL on failure
 **/
librdf_uri*
librdf_new_uri_from_uri_local_name (librdf_uri* old_uri, 
                                    const unsigned char *local_name) {
  int len;
  unsigned char *new_string;
  librdf_uri* new_uri;

  LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(old_uri, librdf_uri, NULL);
  
  if(!old_uri)
    return NULL;
  
  len=old_uri->string_length + strlen((const char*)local_name) +1 ; /* +1 for \0 */

  new_string=(unsigned char*)LIBRDF_MALLOC(cstring, len);
  if(!new_string)
    return NULL;

  strcpy((char*)new_string, (const char*)old_uri->string);
  strcat((char*)new_string, (const char*)local_name);

  new_uri=librdf_new_uri (old_uri->world, new_string);
  LIBRDF_FREE(cstring, new_string);

  return new_uri;
}
Esempio n. 14
0
/**
 * librdf_hash_bdb_cursor_finished - Finish the serialisation of the hash bdb get
 * @context: BerkeleyDB hash cursor context
 **/
static void
librdf_hash_bdb_cursor_finish(void* context)
{
  librdf_hash_bdb_cursor_context* cursor=(librdf_hash_bdb_cursor_context*)context;

#ifdef HAVE_BDB_CURSOR
  /* BDB V2/V3 */
  if(cursor->cursor)
    cursor->cursor->c_close(cursor->cursor);
#endif
  if(cursor->last_key)
    LIBRDF_FREE(cstring, cursor->last_key);
    
  if(cursor->last_value)
    LIBRDF_FREE(cstring, cursor->last_value);
}
Esempio n. 15
0
static void
cassandra_results_stream_finished(void* context)
{

    cassandra_results_stream* scontext;
    scontext = (cassandra_results_stream*)context;

    if (scontext->iter)
	cass_iterator_free(scontext->iter);

    if (scontext->result)
	cass_result_free(scontext->result);

    if (scontext->stmt)
	cass_statement_free(scontext->stmt);
	
    if(scontext->storage)
	librdf_storage_remove_reference(scontext->storage);

    if(scontext->statement)
	librdf_free_statement(scontext->statement);

    if(scontext->context)
	librdf_free_node(scontext->context);

    LIBRDF_FREE(librdf_storage_cassandra_find_statements_stream_context, scontext);

}
Esempio n. 16
0
static void
librdf_storage_tstore_context_serialise_finished(void* context)
{
  librdf_storage_tstore_context_serialise_stream_context* scontext=(librdf_storage_tstore_context_serialise_stream_context*)context;
  
  LIBRDF_FREE(librdf_storage_tstore_context_serialise_stream_context, scontext);
}
Esempio n. 17
0
/**
 * librdf_iterator_add_map - Add a librdf_iterator mapping function
 * @iterator: the iterator
 * @fn: the function to operate
 * @free_context: the function to use to free the context (or NULL)
 * @map_context: the context to pass to the map function
 * 
 * Adds an iterator mapping function which operates over the iterator to
 * select which elements are returned; it will be applied as soon as
 * this method is called.
 *
 * Several mapping functions can be added and they are applied in
 * the order given
 *
 * The mapping function should return non 0 to allow the element to be
 * returned.
 *
 * Return value: Non 0 on failure
 **/
int
librdf_iterator_add_map(librdf_iterator* iterator, 
                        librdf_iterator_map_handler map_function,
                        librdf_iterator_map_free_context_handler free_context,
                        void *map_context)
{
  librdf_iterator_map *map;
  
  if(!iterator->map_list) {
    iterator->map_list=librdf_new_list(iterator->world);
    if(!iterator->map_list)
      return 1;
  }

  map=(librdf_iterator_map*)LIBRDF_CALLOC(librdf_iterator_map, sizeof(librdf_iterator_map), 1);
  if(!map)
    return 1;

  map->fn=map_function;
  map->free_context=free_context;
  map->context=map_context;

  if(librdf_list_add(iterator->map_list, map)) {
    LIBRDF_FREE(librdf_iterator_map, map);
    return 1;
  }
  
  return 0;
}
Esempio n. 18
0
static void
librdf_storage_tstore_serialise_finished(void* context)
{
  librdf_storage_tstore_serialise_stream_context* scontext=(librdf_storage_tstore_serialise_stream_context*)context;

  if(scontext->triple) {
    /* The docs say about rs_find_triples:[[
     *   NB Once rs_find_triples has been called, all the triples
     *   /must/ be fetched with rs_next_triple(), even if they are
     *   not required.
     * ]]
     * but let's assume it applies to rs_find_all_resources
     */
    while(rs_next_triple(scontext->result))
      ;
  }

  if(scontext->result)
    rs_free_result(scontext->result);

  if(scontext->storage)
    librdf_storage_remove_reference(scontext->storage);

  LIBRDF_FREE(librdf_storage_tstore_serialise_stream_context, scontext);
}
Esempio n. 19
0
static void
librdf_stream_from_node_iterator_finished(void* context)
{
  librdf_stream_from_node_iterator_stream_context* scontext=(librdf_stream_from_node_iterator_stream_context*)context;
  
  if(scontext->iterator)
    librdf_free_iterator(scontext->iterator);

  if(scontext->current) {
    switch(scontext->field) {
      case LIBRDF_STATEMENT_SUBJECT:
        librdf_statement_set_subject(scontext->current, NULL);
        break;
      case LIBRDF_STATEMENT_PREDICATE:
        librdf_statement_set_predicate(scontext->current, NULL);
        break;
      case LIBRDF_STATEMENT_OBJECT:
        librdf_statement_set_object(scontext->current, NULL);
        break;

      case LIBRDF_STATEMENT_ALL:
      default:
        librdf_log(scontext->iterator->world,
                   0, LIBRDF_LOG_ERROR, LIBRDF_FROM_STREAM, NULL, 
                   "Illegal statement field %d seen", scontext->field);
    }
    librdf_free_statement(scontext->current);
  }

  LIBRDF_FREE(librdf_stream_from_node_iterator_stream_context, scontext);
}
Esempio n. 20
0
static librdf_storage_trees_graph*
librdf_storage_trees_graph_new(librdf_storage* storage, librdf_node* context_node)
{
  librdf_storage_trees_instance* context=(librdf_storage_trees_instance*)storage->instance;
  librdf_storage_trees_graph* graph=(librdf_storage_trees_graph*)LIBRDF_MALLOC(
    librdf_storage_trees_graph, sizeof(librdf_storage_trees_graph));
  
#ifdef RDF_STORAGE_TREES_WITH_CONTEXTS
  graph->context=(context_node ? librdf_new_node_from_node(context_node) : NULL);
#endif

  /* Always create SPO index */
  graph->spo_tree=librdf_new_avltree(librdf_statement_compare_spo, librdf_storage_trees_avl_free);
  if(!graph->spo_tree) {
    LIBRDF_FREE(librdf_storage_trees_graph, graph);
    return NULL;
  }
  
  if(context->index_sop)
    graph->sop_tree=librdf_new_avltree(librdf_statement_compare_sop, NULL);
  else
    graph->sop_tree=NULL;

  if(context->index_ops)
    graph->ops_tree=librdf_new_avltree(librdf_statement_compare_ops, NULL);
  else
    graph->ops_tree=NULL;
  
  if(context->index_pso)
    graph->pso_tree=librdf_new_avltree(librdf_statement_compare_pso, NULL);
  else
    graph->pso_tree=NULL;

  return graph;
}
Esempio n. 21
0
static void
librdf_storage_trees_graph_free(void* data)
{
  librdf_storage_trees_graph* graph = (librdf_storage_trees_graph*)data;
  
#ifdef RDF_STORAGE_TREES_WITH_CONTEXTS
  librdf_free_node(graph->context);
#endif
  
  /* Extra index trees have null deleters (statements are shared) */
  if (graph->sop_tree)
    librdf_free_avltree(graph->sop_tree);
  if (graph->ops_tree)
    librdf_free_avltree(graph->ops_tree);
  if (graph->pso_tree)
    librdf_free_avltree(graph->pso_tree);

  /* Free spo tree and statements */
  librdf_free_avltree(graph->spo_tree);

  graph->spo_tree=NULL;
  graph->sop_tree=NULL;
  graph->ops_tree=NULL;
  graph->pso_tree=NULL;

  LIBRDF_FREE(librdf_storage_trees_graph, graph);
}
Esempio n. 22
0
File: rdf_uri.c Progetto: njh/librdf
/**
 * librdf_new_uri_from_uri_local_name:
 * @old_uri: #librdf_uri object
 * @local_name: local name to append to URI
 *
 * Copy constructor - create a new librdf_uri object from an existing librdf_uri object and a local name.
 * 
 * Return value: a new #librdf_uri object or NULL on failure
 **/
librdf_uri*
librdf_new_uri_from_uri_local_name (librdf_uri* old_uri, 
                                    const unsigned char *local_name) {
#ifdef LIBRDF_USE_RAPTOR_URI
  return raptor_new_uri_from_uri_local_name(raptor_uri_get_world(old_uri), old_uri, local_name);
#else
  int len;
  unsigned char *new_string;
  librdf_uri* new_uri;

  LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(old_uri, librdf_uri, NULL);
  
  if(!old_uri)
    return NULL;
  
  len=old_uri->string_length + strlen((const char*)local_name) +1 ; /* +1 for \0 */

  new_string=(unsigned char*)LIBRDF_MALLOC(cstring, len);
  if(!new_string)
    return NULL;

  strcpy((char*)new_string, (const char*)old_uri->string);
  strcat((char*)new_string, (const char*)local_name);

  new_uri=librdf_new_uri (old_uri->world, new_string);
  LIBRDF_FREE(cstring, new_string);

  return new_uri;
#endif /* !LIBRDF_USE_RAPTOR_URI */
}
Esempio n. 23
0
int
main(int argc, char *argv[]) 
{
  librdf_world *world;
  
  world=librdf_new_world();
  librdf_world_init_mutex(world);
  
  librdf_init_digest(world);
  librdf_init_hash(world);
  librdf_init_uri(world);
  librdf_init_node(world);
  librdf_init_concepts(world);
  
  librdf_finish_concepts(world);
  librdf_finish_node(world);
  librdf_finish_uri(world);
  librdf_finish_hash(world);
  librdf_finish_digest(world);

  LIBRDF_FREE(librdf_world, world);

  /* keep gcc -Wall happy */
  return(0);
}
Esempio n. 24
0
/**
 * librdf_files_temporary_file_name:
 * 
 * Create a temporary file name.
 * 
 * @deprecated: Do not use this, it is unsafe.
 *
 * Return value: a new filename or NULL on failure.
 **/
char *
librdf_files_temporary_file_name(void) 
{
#if defined(HAVE_MKSTEMP) || defined(HAVE_MKTEMP)
  const char *tmp_dir;
  size_t length;
  char *name;
  static const char * const file_template="librdf_tmp_XXXXXX"; /* FIXME */
#ifdef HAVE_MKSTEMP
  int fd;
#endif

  /* FIXME: unix dependencies */
  tmp_dir=getenv("TMPDIR");
  if(!tmp_dir)
    tmp_dir="/tmp";

  length=strlen(tmp_dir) + strlen(file_template) + 2; /* 2: / sep and \/0 */
  
  name=(char*)LIBRDF_MALLOC(cstring, length);
  if(!name)
    return NULL;

  /* FIXME: unix dependency - file/dir separator */
  sprintf(name, "%s/%s", tmp_dir, file_template);
  
#ifdef HAVE_MKSTEMP
  /* Proritise mkstemp() since GNU libc says: Never use mktemp(). */
  fd=mkstemp(name);
  if(fd<0) {
    LIBRDF_FREE(cstring, name);
    return NULL;
  }
  close(fd);
  unlink(name);

  return name;  
#else
  return mktemp(name);
#endif

#else
#ifdef HAVE_TMPNAM
  /* GNU libc says: Never use this function. Use mkstemp(3) instead. */
  char *name;
  char *new_name;

  name=tmpnam(NULL); /* NULL ensures statically allocated */
  new_name=(char*)LIBRDF_MALLOC(cstring, strlen(name)+1);
  if(!new_name)
    return NULL;
  strcpy(new_name, name);

  return name;
#else /* not tmpnam(), mkstemp() or mktemp() */
HELP
#endif
#endif
}
Esempio n. 25
0
/* helper function for deleting list map */
static void
librdf_iterator_free_iterator_map(void *list_data, void *user_data) 
{
  librdf_iterator_map* map=(librdf_iterator_map*)list_data;
  if(map->free_context)
    map->free_context(map->context);
  LIBRDF_FREE(librdf_iterator_map, map);
}
Esempio n. 26
0
static void
librdf_storage_tstore_terminate(librdf_storage* storage)
{
  if (context == NULL)
    return;

  LIBRDF_FREE(context);
}
Esempio n. 27
0
static void
librdf_node_static_iterator_finished(void* iterator) 
{
  librdf_node_static_iterator_context* context;

  context = (librdf_node_static_iterator_context*)iterator;
  LIBRDF_FREE(librdf_node_static_iterator_context, context);
}
Esempio n. 28
0
/**
 * librdf_free_sql_config:
 * @config: SQL storage configuration
 * 
 * Destructor - free a SQL configuration.
 **/
void
librdf_free_sql_config(librdf_sql_config* config)
{
  int i;
  
  if(config->values) {
    for(i=0; i < config->predicates_count; i++) {
      if(config->values[i])
        LIBRDF_FREE(cstring, config->values[i]);
    }
    LIBRDF_FREE(cstring, config->values);
  }

  if(config->filename)
    LIBRDF_FREE(cstring, config->filename);

  LIBRDF_FREE(cstring, config);
}
Esempio n. 29
0
/* avltree destructor */
void
librdf_free_avltree(librdf_avltree* tree)
{
  if(!tree)
    return;
  
  librdf_free_avltree_internal(tree, tree->root);
  LIBRDF_FREE(librdf_avltree, tree);
}
Esempio n. 30
0
/**
 * librdf_list_clear - empty an librdf_list
 * @list: &librdf_list object
 * 
 **/
void
librdf_list_clear(librdf_list* list) 
{
  librdf_list_node *node, *next;
  
  for(node=list->first; node; node=next) {
    next=node->next;
    LIBRDF_FREE(librdf_list_node, node);
  }
}