]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Minor optimization to the authorizer.
authordrh <>
Sat, 2 May 2026 17:30:33 +0000 (17:30 +0000)
committerdrh <>
Sat, 2 May 2026 17:30:33 +0000 (17:30 +0000)
FossilOrigin-Name: 625f78a630bbf897f945065f1b85a92fe26e426302c8f6edc4d26a817ff62358

manifest
manifest.uuid
src/auth.c
src/resolve.c

index ec551fb384c20afe59244a465f319bd29cbcf5d0..060b0ac5bd581eff869ea99e8c61b650a87a745b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sharmless\scompiler\swarnings.
-D 2026-05-02T15:58:28.545
+C Minor\soptimization\sto\sthe\sauthorizer.
+D 2026-05-02T17:30:33.566
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -671,7 +671,7 @@ F sqlite3.pc.in e6dee284fba59ef500092fdc1843df3be8433323a3733c91da96690a50a5b398
 F src/alter.c 7d7ddbdc189f0e0c686e32ee170abdddc95c11f2089e40df4ffcee88f5334826
 F src/analyze.c 03bcfc083fc0cccaa9ded93604e1d4244ea245c17285d463ef6a60425fcb247d
 F src/attach.c c58278c7d2d954785591c4fde81669ec3e4d52f348c453b028a19ae8adf4f338
-F src/auth.c ebec42df26b34a62b6750d30d9c2c03554a1c522020182476f7729a439fef04f
+F src/auth.c b5ece4e1edccad082c0332fa0087df225473bae0feea9269f824312201377185
 F src/backup.c 6ebe22ccbedfcb92423833992130e8d65824be4e6599c3a03f540ab38fc7d13c
 F src/bitvec.c e242d4496774dfc88fa278177dd23b607dce369ccafb3f61b41638eea2c9b399
 F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea
@@ -733,7 +733,7 @@ F src/pragma.c 789ef67117b74b5be0a2db6681f7f0c55e6913791b9da309aefd280de2c8a74d
 F src/prepare.c f6a6e28a281bd1d1da12f47d370a81af46159b40f73bf7fa0b276b664f9c8b7d
 F src/printf.c 50be92de0725e88c8b38978775ab46f9b42d74e21f65045c3423503173eb0566
 F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
-F src/resolve.c 928ff887f2a7c64275182060d94d06fdddbe32226c569781cf7e7edc6f58d7fd
+F src/resolve.c fcc406bfb055bee9954ee77c023f4a2a66a24bcdf1573516a72280811a269c20
 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
 F src/select.c 4c05cde130f26991b7411d8c6809e0630625e18078742c963a047b4b9cc01d49
 F src/shell.c.in 3ed0902de2a82c92ee535c1bc627fb7cfd64cc3b81762f1c10b59c634597da10
@@ -2203,8 +2203,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee
 F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
 F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c
-P 068a53865a17d4c2b4ce227fc08a2c019d1dbf31d833842ec08ab5665a3565a3
-R f6800e93bf1c9b5c47ad0ff8fb5728bb
+P a0d0b5aff51088699e5ad0a726c350d10744b1779acd9ee54232659fb4c352a4
+R 8840f9dff1e098a0d6ce9982e465d5de
 U drh
-Z cca3e27c33a99ac1aa1003c09e9c32ed
+Z 5cd41c06c77174b012275eae60eefac1
 # Remove this line to create a well-formed Fossil manifest.
index 808de7eeb5b4dfa0cd3ec8aea1060bdb7d8a4760..ad4af52d12c921f18424a1cc95cf2be709035368 100644 (file)
@@ -1 +1 @@
-a0d0b5aff51088699e5ad0a726c350d10744b1779acd9ee54232659fb4c352a4
+625f78a630bbf897f945065f1b85a92fe26e426302c8f6edc4d26a817ff62358
index 1088f844a753bdf2b87ab9bf4dda1af1091041da..5a107af3181e86b0d9ed88cf327b9d38c8753db3 100644 (file)
@@ -189,8 +189,14 @@ void sqlite3AuthRead(
 ** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY
 ** is returned, then the error count and error message in pParse are
 ** modified appropriately.
+**
+** Divided into two routines.  realAuthCheck() does the work.  The
+** sqlite3AuthCheck() routine is usually a fast no-op but invokes
+** realAuthCheck() (and spends time doing some stack pushes and pops
+** as a result) in the uncommon case where an authorization check is
+** actually needed.
 */
-int sqlite3AuthCheck(
+static int SQLITE_NOINLINE realAuthCheck(
   Parse *pParse,
   int code,
   const char *zArg1,
@@ -204,7 +210,7 @@ int sqlite3AuthCheck(
   ** or if the parser is being invoked from within sqlite3_declare_vtab.
   */
   assert( !IN_RENAME_OBJECT || db->xAuth==0 );
-  if( db->xAuth==0 || db->init.busy || IN_SPECIAL_PARSE ){
+  if( IN_SPECIAL_PARSE ){
     return SQLITE_OK;
   }
 
@@ -229,6 +235,19 @@ int sqlite3AuthCheck(
   }
   return rc;
 }
+int sqlite3AuthCheck(
+  Parse *pParse,
+  int code,
+  const char *zArg1,
+  const char *zArg2,
+  const char *zArg3
+){
+  if( pParse->db->xAuth!=0 && pParse->db->init.busy==0 ){
+    return realAuthCheck(pParse,code,zArg1,zArg2,zArg3);
+  }else{
+    return SQLITE_OK;
+  }
+}
 
 /*
 ** Push an authorization context.  After this routine is called, the
index 5b6d6c9c5aa05adf68288bd80d937b3982654d79..ced15e92495060ecb33296dc422f6c030bbf6e1e 100644 (file)
@@ -836,9 +836,7 @@ lookupname_end:
   if( cnt==1 ){
     assert( pNC!=0 );
 #ifndef SQLITE_OMIT_AUTHORIZATION
-    if( pParse->db->xAuth
-     && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER)
-    ){
+    if( db->xAuth && (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER) ){
       sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
     }
 #endif