/ View Ticket
Login
Ticket UUID: 806f3be2d7773468bb587031b58e185c11ae1022
Title: Proposal to inline some functions
Status: Closed Type: Feature_Request
Severity: Cosmetic Priority: Immediate
Subsystem: B-Tree Resolution: Rejected
Last Modified: 2009-09-14 15:35:28
Version Found In: 3.6.18
Description:
There's no problem. I would like to propose inlining of several pretty often used functions: sqlite3BtreeGetPageSize sqlite3BtreePager sqlite3PagerBackupPtr sqlite3PagerRef sqlite3PagerPageRefcount sqlite3PagerGetData sqlite3PagerGetExtra sqlite3PagerIsreadonly sqlite3PagerRefcount sqlite3PagerFilename sqlite3PagerVfs sqlite3PagerFile sqlite3PagerJournalname sqlite3PagerNosync sqlite3PagerTempSpace sqlite3PagerIsMemdb For instance, I introduced a compiler flag named INLDEF and for each ot these functions I issued: in the declaration section:
    #ifdef INLDEF
    # define sqlite3BtreeGetPageSize(a) (a)->pBt->pageSize
    #else//INLDEF
    SQLITE_PRIVATE INL int sqlite3BtreeGetPageSize(Btree*);
    #endif//INLDEF

and in the implementation section:

    #ifndef INLDEF
    SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
      return p->pBt->pageSize;
    }
    #endif//INLDEF

Best regards: Chris


drh added on 2009-09-14 15:35:28:
Modern C compilers do this kind of inlining automatically. There is no need to complicate the code.