Skip to content

Commit

Permalink
Remove NEWRES macro
Browse files Browse the repository at this point in the history
  • Loading branch information
HRMsimon committed Mar 22, 2015
1 parent 8d3dc46 commit ae703cc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion pdo_pgsql_connection.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "pgsql.h"
#include "pdo_pgsql_connection.h"
#include "pdo_pgsql_statement.h"
#include "pdo_pgsql_resource.h"
Expand Down
3 changes: 1 addition & 2 deletions pdo_pgsql_statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "pdo_pgsql_statement.h"
#include "pdo_pgsql_connection.h"
#include "pdo_pgsql.h"
#include "pgsql.h"
#include <iomanip>

#define STMT_HANDLE_ERROR(res) (*m_conn).handleError(this, (*m_conn).sqlstate(res), res.errorMessage())
Expand Down Expand Up @@ -197,7 +196,7 @@ namespace HPHP {

if(columns.empty()){
for(int i = 0; i < column_count; i++){
columns.set(i, Resource(NEWRES(PDOColumn)()));
columns.set(i, Resource(newres<PDOColumn>()));
}
}

Expand Down
16 changes: 8 additions & 8 deletions pgsql.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <queue>
#include "pgsql.h"
#include "pq.h"

#include "hphp/runtime/base/array-iterator.h"
#include "hphp/runtime/base/zend-string.h"
Expand Down Expand Up @@ -668,7 +668,7 @@ struct CStringArray {
static Variant HHVM_FUNCTION(pg_connect, const String& connection_string, int connect_type /* = 0 */) {
PGSQL * pgsql = nullptr;

pgsql = NEWRES(PGSQL)(connection_string);
pgsql = newres<PGSQL>(connection_string);

if (!pgsql->get()) {
delete pgsql;
Expand All @@ -683,7 +683,7 @@ static Variant HHVM_FUNCTION(pg_pconnect, const String& connection_string, int c

PGSQLConnectionPool& pool = s_connectionPoolContainer.GetPool(connection_string.toCppString());

pgsql = NEWRES(PGSQL)(pool);
pgsql = newres<PGSQL>(pool);

if (!pgsql->get()) {
delete pgsql;
Expand Down Expand Up @@ -1117,7 +1117,7 @@ static Variant HHVM_FUNCTION(pg_query, const Resource& connection, const String&
if (_handle_query_result("pg_query", conn->get(), res))
FAIL_RETURN;

PGSQLResult *pgresult = NEWRES(PGSQLResult)(conn, std::move(res));
PGSQLResult *pgresult = newres<PGSQLResult>(conn, std::move(res));

return Resource(pgresult);
}
Expand All @@ -1135,7 +1135,7 @@ static Variant HHVM_FUNCTION(pg_query_params, const Resource& connection, const
if (_handle_query_result("pg_query_params", conn->get(), res))
FAIL_RETURN;

PGSQLResult *pgresult = NEWRES(PGSQLResult)(conn, std::move(res));
PGSQLResult *pgresult = newres<PGSQLResult>(conn, std::move(res));

return Resource(pgresult);
}
Expand All @@ -1151,7 +1151,7 @@ static Variant HHVM_FUNCTION(pg_prepare, const Resource& connection, const Strin
if (_handle_query_result("pg_prepare", conn->get(), res))
FAIL_RETURN;

PGSQLResult *pgres = NEWRES(PGSQLResult)(conn, std::move(res));
PGSQLResult *pgres = newres<PGSQLResult>(conn, std::move(res));

return Resource(pgres);
}
Expand All @@ -1169,7 +1169,7 @@ static Variant HHVM_FUNCTION(pg_execute, const Resource& connection, const Strin
FAIL_RETURN;
}

PGSQLResult *pgres = NEWRES(PGSQLResult)(conn, std::move(res));
PGSQLResult *pgres = newres<PGSQLResult>(conn, std::move(res));

return Resource(pgres);
}
Expand Down Expand Up @@ -1223,7 +1223,7 @@ static Variant HHVM_FUNCTION(pg_get_result, const Resource& connection) {
FAIL_RETURN;
}

PGSQLResult *pgresult = NEWRES(PGSQLResult)(conn, std::move(res));
PGSQLResult *pgresult = newres<PGSQLResult>(conn, std::move(res));

return Resource(pgresult);
}
Expand Down
14 changes: 0 additions & 14 deletions pgsql.h

This file was deleted.

0 comments on commit ae703cc

Please sign in to comment.