Functions | Variables

dsi_storage.c File Reference

#include "dsi.h"
#include "problem.h"
Include dependency graph for dsi_storage.c:

Go to the source code of this file.

Functions

int gs_comp_dsi_object (void *key, void *d)
void gs_free_dsi_object (void *d)
int gs_insert_dsi_object (DSI_OBJECT *dsi_obj)
int gs_remove_dsi_object (DSI_OBJECT *dsi_obj)
int gs_is_dsi_object (void *obj)

Variables

icl_list_t * dsi_objects = NULL

Detailed Description

Routines to keep track of which input args are DSI objects.

Definition in file dsi_storage.c.


Function Documentation

int gs_comp_dsi_object ( void *  key,
void *  d 
)

Comparison function for DSI objects.

Parameters:
key -- arg pointer to be compared
d -- arg pointer to be compared
Returns:
0 if equal, non-zero otherwise.

Definition at line 31 of file dsi_storage.c.

{
  return (key != d);
}

Here is the caller graph for this function:

void gs_free_dsi_object ( void *  d  ) 

Frees a DSI object.

Parameters:
d -- pointer to object to be freed.

Definition at line 43 of file dsi_storage.c.

{
  free(d);
}

Here is the caller graph for this function:

int gs_insert_dsi_object ( DSI_OBJECT *  dsi_obj  ) 

Inserts the object into the list of DSI objects.

Parameters:
dsi_obj -- object to be inserted.
Returns:
0 on success, -1 on failure.

Definition at line 57 of file dsi_storage.c.

{
  if(!dsi_objects) {
    dsi_objects = icl_list_new();
    if(!dsi_objects)
      return -1;
  }

  if(icl_list_append(dsi_objects, dsi_obj) == NULL)
    return -1;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int gs_is_dsi_object ( void *  obj  ) 

Determines whether the specified pointer is a DSI object or just a regular argument.

Parameters:
obj -- pointer to the argument to check
Returns:
1 if it is a DSI object, 0 otherwise.

Definition at line 108 of file dsi_storage.c.

{
  icl_list_t *tmp;

  if(!dsi_objects)
    return 0;

  tmp = icl_list_search(dsi_objects, obj, gs_comp_dsi_object);

  return (tmp != NULL);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int gs_remove_dsi_object ( DSI_OBJECT *  dsi_obj  ) 

Removes the specified object from the DSI object list.

Parameters:
dsi_obj -- the object to be removed
Returns:
0 on success, -1 on failure.

Definition at line 80 of file dsi_storage.c.

{
  icl_list_t *tmp;

  if(!dsi_objects)
    return 0;

  tmp = icl_list_search(dsi_objects, dsi_obj, gs_comp_dsi_object);

  if(!tmp)
    return -1;

  if(icl_list_delete(dsi_objects, tmp, gs_free_dsi_object) < 0)
    return -1;

  return 0;
}

Here is the call graph for this function:


Variable Documentation

icl_list_t* dsi_objects = NULL

Definition at line 19 of file dsi_storage.c.