Ejemplo n.º 1
0
state_map_type * state_map_fread_alloc( const char * filename ) {
  state_map_type * map = state_map_alloc();
  if (util_file_exists( filename )) {
    FILE * stream = util_fopen( filename , "r");
    int_vector_fread( map->state , stream );
    fclose( stream );
  } 
  return map;
}
Ejemplo n.º 2
0
void state_map_fread( state_map_type * map , const char * filename) {
  pthread_rwlock_wrlock( &map->rw_lock );
  {
    if (util_file_exists( filename )) {
      FILE * stream = util_fopen( filename , "r");
      if (stream) {
        int_vector_fread( map->state , stream );
        fclose( stream );
      } else
        util_abort("%s: failed to open:%s for reading \n",__func__ , filename );
    } else
      int_vector_reset( map->state );
  }
  pthread_rwlock_unlock( &map->rw_lock );
}
Ejemplo n.º 3
0
int_vector_type * int_vector_fread_alloc( FILE * stream ) {
  int_vector_type * vector = int_vector_alloc( 0,0 );
  int_vector_fread( vector , stream );
  return vector;
}