Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Oct 31, 2024
1 parent 5550449 commit 0bae1e1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/diskquota_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -1697,23 +1697,23 @@ SPI_connect_wrapper(void)
{
if (SPI_context()) return false;

int rc;
int rc = SPI_connect();

if ((rc = SPI_connect()) != SPI_OK_CONNECT)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("[diskquota] SPI_connect failed"),
errdetail("%s", SPI_result_code_string(rc))));
ereportif(rc != SPI_OK_CONNECT, ERROR,
(errcode(ERRCODE_INTERNAL_ERROR), errmsg("[diskquota] SPI_connect failed"),
errdetail("%s", SPI_result_code_string(rc))));

return true;
}

void
SPI_finish_wrapper(bool connected)
{
if (!connected) return;
if (!connected || !SPI_context()) return;

int rc;
int rc = SPI_finish();

if (SPI_context() && (rc = SPI_finish()) != SPI_OK_FINISH)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("[diskquota] SPI_finish failed"),
errdetail("%s", SPI_result_code_string(rc))));
ereportif(rc != SPI_OK_FINISH, ERROR,
(errcode(ERRCODE_INTERNAL_ERROR), errmsg("[diskquota] SPI_finish failed"),
errdetail("%s", SPI_result_code_string(rc))));
}

0 comments on commit 0bae1e1

Please sign in to comment.