1. Shlomi Fish
  2. fc-solve

Commits

Shlomi Fish  committed d1ebc98

Remove predeclarations of fcs_user_t * user.

  • Participants
  • Parent commits b27cfbf
  • Branches master

Comments (0)

Files changed (1)

File fc-solve/source/lib.c

View file
  • Ignore whitespace
 
 void DLLEXPORT * freecell_solver_user_alloc(void)
 {
-    fcs_user_t * ret;
-
-    ret = (fcs_user_t *)SMALLOC1(ret);
+    fcs_user_t * ret = (fcs_user_t *)SMALLOC1(ret);
 
     user_initialize(ret);
 
     return FCS_PRESET_CODE_OK;
 #else
     const fcs_preset_t * new_preset_ptr;
-    fcs_user_t * user;
     int status;
     FLARES_LOOP_DECLARE_VARS();
 
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     status =
         fc_solve_get_preset_by_name(
     fcs_int_limit_t max_iters
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->current_iterations_limit = max_iters;
 }
     int max_iters
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->instances_list[user->current_instance_idx].limit = max_iters;
 }
     char * * error_string
     )
 {
-    fcs_user_t * user;
     int depth_idx;
     int ret_code;
 
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     *error_string = NULL;
 
     const char * state_as_string
     )
 {
-    fcs_user_t * user;
     int ret_code;
     char * error_string;
     int instance_list_index;
 
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->state_string_copy = strdup(state_as_string);
 
     fcs_stats_t init_num_times;
     int run_for_first_iteration = 1;
     int ret;
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     ret = FCS_STATE_IS_NOT_SOLVEABLE;
 
     fcs_move_t * user_move
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     {
 #if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
     int display_10_as_t
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     {
 #if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
     void * api_instance
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user_free_resources(user);
 
     void * api_instance
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return (DFS_VAR(user->soft_thread, depth));
 }
     int method
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->soft_thread->super_method_type = FCS_SUPER_METHOD_BEFS_BRFS;
 
     int freecells_num
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if ((freecells_num < 0) || (freecells_num > MAX_NUM_FREECELLS))
     {
     int stacks_num
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if ((stacks_num < 0) || (stacks_num > MAX_NUM_STACKS))
     {
     int decks_num
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if ((decks_num < 0) || (decks_num > MAX_NUM_DECKS))
     {
     void * user_instance
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)user_instance;
+    fcs_user_t * user = (fcs_user_t *)user_instance;
 
     return user->iterations_board_started_at.num_times + user->fc_solve_obj->num_times - user->init_num_times.num_times;
 }
 
 int DLLEXPORT freecell_solver_user_get_limit_iterations(void * api_instance)
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user->fc_solve_obj->max_num_times;
 }
 
 int DLLEXPORT freecell_solver_user_get_moves_left(void * api_instance)
 {
-    fcs_user_t * user;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    user = (fcs_user_t *)api_instance;
     if (user->ret_code == FCS_STATE_WAS_SOLVED)
         return user->fc_solve_obj->solution_moves.num_moves;
     else
     int optimize
 )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     STRUCT_SET_FLAG_TO(user->fc_solve_obj, FCS_RUNTIME_OPTIMIZE_SOLUTION_PATH, optimize);
 }
     int standard_notation
     )
 {
-    fcs_user_t * user;
 #if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
     fc_solve_instance_t * instance;
 #endif
 
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 #if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
     instance =
         user->fc_solve_obj;
     int max_depth
 )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->fc_solve_obj->max_depth = max_depth;
 }
     int print_ts
     )
 {
-    fcs_user_t * user;
     char string[80], card_str[10];
 
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if (user->state_validity_ret == FCS_STATE_VALIDITY__OK)
     {
     )
 {
 #ifndef FCS_FREECELL_ONLY
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if ((sequences_are_built_by < 0) || (sequences_are_built_by > 2))
     {
     )
 {
 #ifndef FCS_FREECELL_ONLY
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->common_preset.game_params.game_flags &= (~(1 << 4));
     user->common_preset.game_params.game_flags |=
     )
 {
 #ifndef FCS_FREECELL_ONLY
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if ((empty_stacks_fill < 0) || (empty_stacks_fill > 2))
     {
     double weight
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if ((my_index < 0) || (my_index >= COUNT(BEFS_VAR(user->soft_thread, weighting.befs_weights))))
     {
     int my_index
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return BEFS_VAR(user->soft_thread, weighting.befs_weights)[my_index];
 }
     fcs_int_limit_t parent_iter_num
     )
 {
-    fcs_user_t * user;
     fcs_standalone_state_ptrs_t state_raw;
 
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     state_raw.key = ptr_state->key;
     state_raw.val = ptr_state->val;
     void * iter_handler_context
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->long_iter_handler = long_iter_handler;
     user->iter_handler = iter_handler;
 )
 {
 #if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
-    fcs_user_t * user;
-    fc_solve_instance_t * instance;
-#endif
-
-#if (!(defined(HARD_CODED_NUM_FREECELLS) && defined(HARD_CODED_NUM_STACKS) && defined(HARD_CODED_NUM_DECKS)))
-    user = (fcs_user_t *)api_instance;
-    instance =
+    fcs_user_t * user = (fcs_user_t *)api_instance;
+    fc_solve_instance_t * instance =
         user->fc_solve_obj;
 #endif
 
     int seed
 )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     fc_solve_rand_init(
             &(DFS_VAR(user->soft_thread, rand_gen)),
 
 fcs_int_limit_t DLLEXPORT freecell_solver_user_get_num_states_in_collection_long(void * api_instance)
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user->iterations_board_started_at.num_states_in_collection + user->fc_solve_obj->num_states_in_collection - user->init_num_times.num_states_in_collection;
 }
     fcs_int_limit_t max_num_states
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     if (max_num_states < 0)
     {
     long max_num_states
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     if (max_num_states < 0)
     {
     void * api_instance
     )
 {
-    fcs_user_t * user;
-    fc_solve_soft_thread_t * soft_thread;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    soft_thread = fc_solve_new_soft_thread(user->soft_thread->hard_thread);
+    fc_solve_soft_thread_t * soft_thread = fc_solve_new_soft_thread(user->soft_thread->hard_thread);
 
     if (soft_thread == NULL)
     {
     int num_times_step
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user->soft_thread->num_times_step = num_times_step;
 }
     void * api_instance
     )
 {
-    fcs_user_t * user;
-    fc_solve_soft_thread_t * soft_thread;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    soft_thread = fc_solve_new_hard_thread(user->fc_solve_obj);
+    fc_solve_soft_thread_t * soft_thread = fc_solve_new_hard_thread(user->fc_solve_obj);
 
     if (soft_thread == NULL)
     {
     void * api_instance
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user->fc_solve_obj->next_soft_thread_id;
 }
     int calc_real_depth
 )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     STRUCT_SET_FLAG_TO(user->fc_solve_obj, FCS_RUNTIME_CALC_REAL_DEPTH, calc_real_depth);
 }
     freecell_solver_str_t name
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if (user->soft_thread->name != NULL)
     {
     freecell_solver_str_t name
     )
 {
-    fcs_user_t * user;
-    fcs_instance_item_t * instance_item;
-    fcs_flare_item_t * flare;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    instance_item = &(user->instances_list[user->current_instance_idx]);
+    fcs_instance_item_t * instance_item = &(user->instances_list[user->current_instance_idx]);
 
-    flare = &(instance_item->flares[instance_item->num_flares-1]);
+    fcs_flare_item_t * flare = &(instance_item->flares[instance_item->num_flares-1]);
 
     if (flare->name != NULL)
     {
     const char * prelude
     )
 {
-    fcs_user_t * user;
-    fc_solve_hard_thread_t * hard_thread;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    hard_thread = user->soft_thread->hard_thread;
+    fc_solve_hard_thread_t * hard_thread = user->soft_thread->hard_thread;
 
     if (hard_thread->prelude_as_string != NULL)
     {
     const char * flares_plan_string
     )
 {
-    fcs_user_t * user;
-    fcs_instance_item_t * instance_item;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    instance_item = &(user->instances_list[user->current_instance_idx]);
+    fcs_instance_item_t * instance_item = &(user->instances_list[user->current_instance_idx]);
 
     if (instance_item->flares_plan_string)
     {
     void * api_instance
     )
 {
-    fcs_user_t * user;
-    int i;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    for(i=0;i<user->num_instances;i++)
+    for (int i = 0 ; i < user->num_instances ; i++)
     {
         recycle_instance(user, i);
     }
     char * * error_string
     )
 {
-    fcs_user_t * user;
-    int ret;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     fc_solve_free_tests_order(&(user->fc_solve_obj->opt_tests_order));
 
     STRUCT_CLEAR_FLAG(user->fc_solve_obj, FCS_RUNTIME_OPT_TESTS_ORDER_WAS_SET );
 
-    ret =
+    int ret =
         fc_solve_apply_tests_order(
             &(user->fc_solve_obj->opt_tests_order),
             tests_order,
     char * * error_string
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     if (!strcmp(pruning, "r:tf"))
     {
     int to_reparent_states
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     STRUCT_SET_FLAG_TO(user->fc_solve_obj,
             FCS_RUNTIME_TO_REPARENT_STATES_PROTO, to_reparent_states);
     int synergy
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     STRUCT_SET_FLAG_TO(user->fc_solve_obj, FCS_RUNTIME_SCANS_SYNERGY, synergy);
 }
 
 int DLLEXPORT freecell_solver_user_reset(void * api_instance)
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     user_free_resources(user);
 
     void * api_instance
     )
 {
-    fcs_user_t * user;
-    fc_solve_hard_thread_t * hard_thread;
-    fc_solve_instance_t * instance;
-
-    user = (fcs_user_t *)api_instance;
-
-    instance =
-        user->fc_solve_obj;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    hard_thread = instance->current_hard_thread;
+    fc_solve_hard_thread_t * hard_thread = user->fc_solve_obj->current_hard_thread;
 
     return hard_thread->soft_threads[hard_thread->st_idx].name;
 }
     void * api_instance
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user->error_string;
 }
 #ifndef FCS_RCS_STATES
     return 0;
 #else
-    fcs_user_t * user;
     FLARES_LOOP_DECLARE_VARS();
 
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     if (limit <= 0)
     {
     fcs_moves_sequence_t * const moves_seq
 )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t*)api_instance;
+    fcs_user_t * user = (fcs_user_t*)api_instance;
 
     if (user->ret_code != FCS_STATE_WAS_SOLVED)
     {
     char * * error_string
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user_compile_all_flares_plans(user, instance_list_index, error_string);
 }
     void * api_instance
     )
 {
-    fcs_user_t * user;
-    fcs_instance_item_t * instance_item;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    instance_item = &(user->instances_list[user->current_instance_idx]);
+    fcs_instance_item_t * instance_item =
+        &(user->instances_list[user->current_instance_idx]);
 
     return instance_item->num_plan_items;
 }
     int item_idx
     )
 {
-    fcs_user_t * user;
-    fcs_instance_item_t * instance_item;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    instance_item = &(user->instances_list[user->current_instance_idx]);
+    fcs_instance_item_t *instance_item = &(user->instances_list[user->current_instance_idx]);
 
     switch(instance_item->plan[item_idx].type)
     {
     int item_idx
     )
 {
-    fcs_user_t * user;
-    fcs_instance_item_t * instance_item;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    instance_item = &(user->instances_list[user->current_instance_idx]);
+    fcs_instance_item_t * instance_item = &(user->instances_list[user->current_instance_idx]);
 
     return instance_item->plan[item_idx].flare_idx;
 }
     int item_idx
     )
 {
-    fcs_user_t * user;
-    fcs_instance_item_t * instance_item;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
-    instance_item = &(user->instances_list[user->current_instance_idx]);
+    fcs_instance_item_t * instance_item = &(user->instances_list[user->current_instance_idx]);
 
     return instance_item->plan[item_idx].count_iters;
 }
     void * api_instance
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user->soft_thread->by_depth_tests_order.num;
 }
     int depth_idx
     )
 {
-    fcs_user_t * user;
-
-    user = (fcs_user_t *)api_instance;
+    fcs_user_t * user = (fcs_user_t *)api_instance;
 
     return user->soft_thread->by_depth_tests_order.by_depth_tests[depth_idx].max_depth;
 }