Ejemplo n.º 1
0
hash_iter_type * hash_iter_alloc(const hash_type * hash) {
  hash_iter_type * iter = util_malloc(sizeof * iter );

  iter->hash            = hash;
  iter->num_keys        = hash_get_size(hash);
  iter->keylist         = hash_alloc_keylist( (hash_type *) hash);
  hash_iter_restart( iter );
  return iter;
}
Ejemplo n.º 2
0
void sched_kw_gruptree_alloc_child_parent_list(const sched_kw_gruptree_type * kw, char *** __children, char *** __parents, int * num_pairs)
{
  *num_pairs = hash_get_size(kw->gruptree_hash);
  char ** children = hash_alloc_keylist(kw->gruptree_hash);
  char ** parents  = util_malloc(*num_pairs * sizeof * parents);

  for(int child_nr = 0; child_nr < *num_pairs; child_nr++)
  {
    parents[child_nr] = util_alloc_string_copy(hash_get_string(kw->gruptree_hash, children[child_nr]));
  }

  *__children = children;
  *__parents  = parents;
}
Ejemplo n.º 3
0
void sched_kw_gruptree_fprintf(const sched_kw_gruptree_type * kw, FILE * stream)
{

  fprintf(stream, "GRUPTREE\n");
  {
    const int   num_keys = hash_get_size(kw->gruptree_hash);
    char ** child_list   = hash_alloc_keylist(kw->gruptree_hash);
    int i;

    for (i = 0; i < num_keys; i++) {
      const char * parent_name = hash_get_string(kw->gruptree_hash , child_list[i]);
      fprintf(stream,"  '%s'  '%s' /\n",child_list[i] , parent_name);
    }
    util_free_stringlist( child_list , num_keys );
  }
  fprintf(stream,"/\n\n");
};