Skip to content

Commit ccc6095

Browse files
committed
Sort class members to reduce padding
1 parent 63c5c42 commit ccc6095

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/CppSQLite3.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ namespace detail
3030
{
3131

3232
SQLite3Memory::SQLite3Memory() :
33-
mnBufferLen(0),
34-
mpBuf(nullptr)
33+
mpBuf(nullptr),
34+
mnBufferLen(0)
3535
{
3636
}
3737

3838
SQLite3Memory::SQLite3Memory(int nBufferLen) :
39-
mnBufferLen(nBufferLen),
40-
mpBuf(sqlite3_malloc(nBufferLen))
39+
mpBuf(sqlite3_malloc(nBufferLen)),
40+
mnBufferLen(nBufferLen)
4141
{
4242
if (!mpBuf && mnBufferLen>0)
4343
{
@@ -48,8 +48,8 @@ SQLite3Memory::SQLite3Memory(int nBufferLen) :
4848
}
4949

5050
SQLite3Memory::SQLite3Memory(const char* szFormat, va_list list) :
51-
mnBufferLen(0),
52-
mpBuf(sqlite3_vmprintf(szFormat, list))
51+
mpBuf(sqlite3_vmprintf(szFormat, list)),
52+
mnBufferLen(0)
5353
{
5454
if (!mpBuf)
5555
{
@@ -66,8 +66,8 @@ SQLite3Memory::~SQLite3Memory()
6666
}
6767

6868
SQLite3Memory::SQLite3Memory(SQLite3Memory const& other) :
69-
mnBufferLen(other.mnBufferLen),
70-
mpBuf(sqlite3_malloc(other.mnBufferLen))
69+
mpBuf(sqlite3_malloc(other.mnBufferLen)),
70+
mnBufferLen(other.mnBufferLen)
7171
{
7272
if (!mpBuf && mnBufferLen>0)
7373
{
@@ -86,8 +86,8 @@ SQLite3Memory& SQLite3Memory::operator=(SQLite3Memory const& lhs)
8686
}
8787

8888
SQLite3Memory::SQLite3Memory(SQLite3Memory&& other) :
89-
mnBufferLen(other.mnBufferLen),
90-
mpBuf(other.mpBuf)
89+
mpBuf(other.mpBuf),
90+
mnBufferLen(other.mnBufferLen)
9191
{
9292
other.mnBufferLen = 0;
9393
other.mpBuf = nullptr;

src/CppSQLite3.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ namespace detail
5454

5555
private:
5656

57-
int mnBufferLen;
5857
void* mpBuf;
58+
int mnBufferLen;
5959
};
6060
}
6161

@@ -82,8 +82,8 @@ class CppSQLite3Exception : public std::exception
8282

8383
private:
8484

85-
int mnErrCode;
8685
char* mpszErrMess;
86+
int mnErrCode;
8787
};
8888

8989

@@ -193,8 +193,8 @@ class CppSQLite3Query
193193

194194
sqlite3* mpDB;
195195
sqlite3_stmt* mpVM;
196-
bool mbEof;
197196
int mnCols;
197+
bool mbEof;
198198
bool mbOwnVM;
199199
};
200200

@@ -245,10 +245,10 @@ class CppSQLite3Table
245245

246246
void checkResults() const;
247247

248+
char** mpaszResults;
248249
int mnCols;
249250
int mnRows;
250251
int mnCurrentRow;
251-
char** mpaszResults;
252252
};
253253

254254

0 commit comments

Comments
 (0)