Convert this one to an out parameter, to match state_manager_pop.

This commit is contained in:
Alcaro 2014-02-21 21:42:05 +01:00
parent 30ebb55602
commit ef8d2ceb0f
3 changed files with 11 additions and 9 deletions

View File

@ -1548,7 +1548,8 @@ void rarch_init_rewind(void)
if (!g_extern.state_manager)
RARCH_WARN("Failed to init rewind buffer. Rewinding will be disabled.\n");
void *state=state_manager_push_where(g_extern.state_manager);
void *state;
state_manager_push_where(g_extern.state_manager, &state);
pretro_serialize(state, g_extern.state_size);
state_manager_push_do(g_extern.state_manager);
}
@ -2186,7 +2187,8 @@ static void check_rewind(void)
if (cnt == 0)
#endif
{
void *state=state_manager_push_where(g_extern.state_manager);
void *state;
state_manager_push_where(g_extern.state_manager, &state);
pretro_serialize(state, g_extern.state_size);
state_manager_push_do(g_extern.state_manager);
}

View File

@ -213,7 +213,7 @@ bool state_manager_pop(state_manager_t *state, void **data)
return true;
}
void *state_manager_push_where(state_manager_t *state)
void state_manager_push_where(state_manager_t *state, void **data)
{
//We need to ensure we have an uncompressed copy of the last pushed state, or we could
// end up applying a 'patch' to wrong savestate, and that'd blow up rather quickly.
@ -226,14 +226,14 @@ void *state_manager_push_where(state_manager_t *state)
}
}
return state->nextblock;
*data=state->nextblock;
}
bool state_manager_push_do(state_manager_t *state)
void state_manager_push_do(state_manager_t *state)
{
if (state->thisblock_valid)
{
if (state->capacity<sizeof(size_t)+state->maxcompsize) return false;
if (state->capacity<sizeof(size_t)+state->maxcompsize) return;
recheckcapacity:;
size_t headpos = (state->head-state->data);
@ -368,7 +368,7 @@ bool state_manager_push_do(state_manager_t *state)
state->entries++;
return true;
return;
}
void state_manager_capacity(state_manager_t *state, unsigned int * entries, size_t * bytes, bool * full)

View File

@ -24,8 +24,8 @@ typedef struct state_manager state_manager_t;
state_manager_t *state_manager_new(size_t state_size, size_t buffer_size);
void state_manager_free(state_manager_t *state);
bool state_manager_pop(state_manager_t *state, void **data);
void *state_manager_push_where(state_manager_t *state);
bool state_manager_push_do(state_manager_t *state);
void state_manager_push_where(state_manager_t *state, void **data);
void state_manager_push_do(state_manager_t *state);
void state_manager_capacity(state_manager_t *state, unsigned int *entries, size_t *bytes, bool *full);
#endif