filehash/ffdb_header.c
int filedb_set_num_configs(FILEDB_DB* dbhh, unsigned int nbin)
{
  FFDB_DB* dbh  = (FFDB_DB*)dbhh;
  ffdb_all_config_info_t allcfgs;
  int i;
  int ret;

  allcfgs.numconfigs = nbin;
  allcfgs.allconfigs = (ffdb_config_info_t*)malloc(nbin * sizeof(ffdb_config_info_t));
  if (allcfgs.allconfigs == NULL) {
    fprintf(stderr, "%s: cannot create space for config info\n", __func__);
    exit(1);
  }
    
  for (i = 0; i < nbin; i++) {
    allcfgs.allconfigs[i].config = i;
    allcfgs.allconfigs[i].index = i;
    allcfgs.allconfigs[i].inserted = 0;
    allcfgs.allconfigs[i].type = 0;
    allcfgs.allconfigs[i].mtime = 0;
    allcfgs.allconfigs[i].fname[0] = '\0';
  }

  /* set configuration information */
  ret = ffdb_set_all_configs(dbh, &allcfgs);

  /* cleanup */
  free(allcfgs.allconfigs);

  return ret;
}
/*
 * Set all configurations
 *
 * @param dbhh pointer to underlying database
 * @param nbin number of configs
 *
 * @return 0 on success -1 on failure with a proper errno set
 */
Set all configurations
@param dbhh pointer to underlying database
@param nbin number of configs

@return 0 on success -1 on failure with a proper errno set
Set all configurations @param dbhh pointer to underlying database @param nbin number of configs @return 0 on success - 1 on failure with a proper errno set
int filedb_set_num_configs(FILEDB_DB* dbhh, unsigned int nbin)
{
  FFDB_DB* dbh  = (FFDB_DB*)dbhh;
  ffdb_all_config_info_t allcfgs;
  int i;
  int ret;
  allcfgs.numconfigs = nbin;
  allcfgs.allconfigs = (ffdb_config_info_t*)malloc(nbin * sizeof(ffdb_config_info_t));
  if (allcfgs.allconfigs == NULL) {
    fprintf(stderr, "%s: cannot create space for config info\n", __func__);
    exit(1);
  }
  for (i = 0; i < nbin; i++) {
    allcfgs.allconfigs[i].config = i;
    allcfgs.allconfigs[i].index = i;
    allcfgs.allconfigs[i].inserted = 0;
    allcfgs.allconfigs[i].type = 0;
    allcfgs.allconfigs[i].mtime = 0;
    allcfgs.allconfigs[i].fname[0] = '\0';
  }
  ret = ffdb_set_all_configs(dbh, &allcfgs);
  free(allcfgs.allconfigs);
  return ret;
}
int filedb_set_num_configs ( FILEDB_DB * dbhh , unsigned int nbin ) { FFDB_DB * dbh = ( FFDB_DB * ) dbhh ; ffdb_all_config_info_t allcfgs ; int i ; int ret ; allcfgs . numconfigs = nbin ; allcfgs . allconfigs = ( ffdb_config_info_t * ) malloc ( nbin * sizeof ( ffdb_config_info_t ) ) ; if ( allcfgs . allconfigs == NULL ) { fprintf ( stderr , " \n " , __func__ ) ; exit ( 1 ) ; } for ( i = 0 ; i < nbin ; i ++ ) { allcfgs . allconfigs [ i ] . config = i ; allcfgs . allconfigs [ i ] . index = i ; allcfgs . allconfigs [ i ] . inserted = 0 ; allcfgs . allconfigs [ i ] . type = 0 ; allcfgs . allconfigs [ i ] . mtime = 0 ; allcfgs . allconfigs [ i ] . fname [ 0 ] = ' \0 ' ; } ret = ffdb_set_all_configs ( dbh , & allcfgs ) ; free ( allcfgs . allconfigs ) ; return ret ; }
Set all configurations
 @param dbhh pointer to underlying database
 @param nbin number of configs
Set all configurations @param dbhh pointer to underlying database @param nbin number of configs
/* set configuration information */ /* cleanup */