Simplify the API: remove error params from 2 winpty_config_set_XXX setters

This commit is contained in:
Ryan Prichard 2016-05-26 21:29:11 -05:00
parent ccb11afd62
commit 5b57d37bdc
3 changed files with 14 additions and 24 deletions

View File

@ -94,15 +94,13 @@ winpty_config_new(UINT64 agentFlags, winpty_error_ptr_t *err /*OPTIONAL*/);
/* Free the cfg object after passing it to winpty_open. */
WINPTY_API void winpty_config_free(winpty_config_t *cfg);
WINPTY_API BOOL
winpty_config_set_initial_size(winpty_config_t *cfg, int cols, int rows,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API void
winpty_config_set_initial_size(winpty_config_t *cfg, int cols, int rows);
/* Amount of time to wait for the agent to startup and to wait for any given
* agent RPC request. Must be greater than 0. Can be INFINITE. */
WINPTY_API BOOL
winpty_config_set_agent_timeout(winpty_config_t *cfg, DWORD timeoutMs,
winpty_error_ptr_t *err /*OPTIONAL*/);
WINPTY_API void
winpty_config_set_agent_timeout(winpty_config_t *cfg, DWORD timeoutMs);

View File

@ -165,25 +165,17 @@ WINPTY_API void winpty_config_free(winpty_config_t *cfg) {
delete cfg;
}
WINPTY_API BOOL
winpty_config_set_initial_size(winpty_config_t *cfg, int cols, int rows,
winpty_error_ptr_t *err /*OPTIONAL*/) {
API_TRY {
ASSERT(cfg != nullptr && cols > 0 && rows > 0);
cfg->cols = cols;
cfg->rows = rows;
return TRUE;
} API_CATCH(FALSE);
WINPTY_API void
winpty_config_set_initial_size(winpty_config_t *cfg, int cols, int rows) {
ASSERT(cfg != nullptr && cols > 0 && rows > 0);
cfg->cols = cols;
cfg->rows = rows;
}
WINPTY_API BOOL
winpty_config_set_agent_timeout(winpty_config_t *cfg, DWORD timeoutMs,
winpty_error_ptr_t *err /*OPTIONAL*/) {
API_TRY {
ASSERT(cfg != nullptr && timeoutMs > 0);
cfg->timeoutMs = timeoutMs;
return TRUE;
} API_CATCH(FALSE)
WINPTY_API void
winpty_config_set_agent_timeout(winpty_config_t *cfg, DWORD timeoutMs) {
ASSERT(cfg != nullptr && timeoutMs > 0);
cfg->timeoutMs = timeoutMs;
}

View File

@ -438,7 +438,7 @@ int main(int argc, char *argv[])
winpty_config_t *agentCfg = winpty_config_new(0, NULL);
assert(agentCfg != NULL);
winpty_config_set_initial_size(agentCfg, sz.ws_col, sz.ws_row, NULL);
winpty_config_set_initial_size(agentCfg, sz.ws_col, sz.ws_row);
winpty_error_ptr_t openErr = NULL;
winpty_t *wp = winpty_open(agentCfg, &openErr);