Internal JNI API renaming.

FossilOrigin-Name: fcfc070673cef2f657f4737f096678439ed7c011fb2e5391e0721f82f5d8af51
This commit is contained in:
stephan 2023-07-30 18:41:25 +00:00
parent 91710673e7
commit 09947d0aad
3 changed files with 20 additions and 20 deletions

View File

@ -346,8 +346,8 @@ struct JniHookState{
look into consolidating this with JniHookState, perhaps adding the
jclass member to that object.
*/
typedef struct JniHookStateWithDtor JniHookStateWithDtor;
struct JniHookStateWithDtor{
typedef struct BusyHandlerJni BusyHandlerJni;
struct BusyHandlerJni{
JniHookState base;
jclass klazz /* jObj's class */;
};
@ -385,7 +385,7 @@ struct PerDbStateJni {
JniHookState rollbackHook;
JniHookState updateHook;
JniHookState collationNeeded;
JniHookStateWithDtor busyHandler;
BusyHandlerJni busyHandler;
};
static struct {
@ -459,7 +459,7 @@ static int s3jni_db_error(sqlite3*db, int err_code, const char *zMsg){
any exceptions it throws. This is a no-op of s has no current
state.
*/
static void JniHookStateWithDtor_clear(JNIEnv *env, JniHookStateWithDtor * const s){
static void BusyHandlerJni_clear(JNIEnv *env, BusyHandlerJni * const s){
if(s->base.jObj){
const jmethodID method =
(*env)->GetMethodID(env, s->klazz, "xDestroy", "()V");
@ -474,24 +474,24 @@ static void JniHookStateWithDtor_clear(JNIEnv *env, JniHookStateWithDtor * const
}
UNREF_G(s->base.jObj);
UNREF_G(s->klazz);
memset(s, 0, sizeof(JniHookStateWithDtor));
memset(s, 0, sizeof(BusyHandlerJni));
}
}
/**
Initializes s to wrap JniHookStateWithDtor-type object jObject, clearing
Initializes s to wrap BusyHandlerJni-type object jObject, clearing
any current state of s beforehand. Returns 0 on success, non-0 on
error. On error, s's state is cleared.
*/
static int JniHookStateWithDtor_init(JNIEnv * const env, JniHookStateWithDtor * const s,
static int BusyHandlerJni_init(JNIEnv * const env, BusyHandlerJni * const s,
jobject jObj){
const char * zSig = "(I)I" /* callback signature */;
if(s->base.jObj) JniHookStateWithDtor_clear(env, s);
if(s->base.jObj) BusyHandlerJni_clear(env, s);
s->base.jObj = REF_G(jObj);
s->klazz = REF_G((*env)->GetObjectClass(env, jObj));
s->base.midCallback = (*env)->GetMethodID(env, s->klazz, "xCallback", zSig);
IFTHREW {
JniHookStateWithDtor_clear(env, s);
BusyHandlerJni_clear(env, s);
return SQLITE_ERROR;
}
return 0;
@ -738,7 +738,7 @@ static void PerDbStateJni_set_aside(PerDbStateJni * const s){
UNHOOK(updateHook);
#undef UNHOOK
UNREF_G(s->jDb);
JniHookStateWithDtor_clear(env, &s->busyHandler);
BusyHandlerJni_clear(env, &s->busyHandler);
memset(s, 0, sizeof(PerDbStateJni));
s->pNext = S3Global.perDb.aFree;
if(s->pNext) s->pNext->pPrev = s;
@ -1423,7 +1423,7 @@ JDECL(jint,1busy_1handler)(JENV_JSELF, jobject jDb, jobject jBusy){
/* Same object - this is a no-op. */
return 0;
}
rc = JniHookStateWithDtor_init(env, &ps->busyHandler, jBusy);
rc = BusyHandlerJni_init(env, &ps->busyHandler, jBusy);
if(rc){
assert(!ps->busyHandler.base.jObj);
return (jint)rc;
@ -1431,7 +1431,7 @@ JDECL(jint,1busy_1handler)(JENV_JSELF, jobject jDb, jobject jBusy){
assert(ps->busyHandler.base.jObj && ps->busyHandler.klazz);
assert( (*env)->IsSameObject(env, ps->busyHandler.base.jObj, jBusy) );
}else{
JniHookStateWithDtor_clear(env, &ps->busyHandler);
BusyHandlerJni_clear(env, &ps->busyHandler);
}
return jBusy
? sqlite3_busy_handler(ps->pDb, s3jni_busy_handler, ps)
@ -1442,7 +1442,7 @@ JDECL(jint,1busy_1timeout)(JENV_JSELF, jobject jDb, jint ms){
PerDbStateJni * const ps = PerDbStateJni_for_db(env, jDb, 0, 0);
if( ps ){
if( ps->busyHandler.base.jObj ){
JniHookStateWithDtor_clear(env, &ps->busyHandler);
BusyHandlerJni_clear(env, &ps->busyHandler);
}
return sqlite3_busy_timeout(ps->pDb, (int)ms);
}

View File

@ -1,5 +1,5 @@
C Internal\sJNI\srefactoring\stowards\sconsolidating\ssupport\sfor\scallbacks\swith\sand\swithout\sfinalizers.
D 2023-07-30T17:24:01.771
C Internal\sJNI\sAPI\srenaming.
D 2023-07-30T18:41:25.803
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -232,7 +232,7 @@ F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
F ext/jni/GNUmakefile 56a014dbff9516774d895ec1ae9df0ed442765b556f79a0fc0b5bc438217200d
F ext/jni/README.md c0e6e80935e7761acead89b69c87765b23a6bcb2858c321c3d05681fd338292a
F ext/jni/src/c/sqlite3-jni.c 5334b9a85288fbe2750234001f0054a700d8b3e996b7353c03f1f0231a55ac6f
F ext/jni/src/c/sqlite3-jni.c e1dc9820a9a68fad2d06e15022e4288817a29ca83bf804e3926985115f1f1a1d
F ext/jni/src/c/sqlite3-jni.h 28def286ee305c1c89a43ac5918a6862d985d0534f7ccbbd74df4885d3918b73
F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c
F ext/jni/src/org/sqlite/jni/Collation.java 8dffbb00938007ad0967b2ab424d3c908413af1bbd3d212b9c9899910f1218d1
@ -2071,8 +2071,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 4fd3d93623d67c25fb8a490e0d4ea56d531d858067011ab1b28cce694098feff
R bc4ee4f83b4e96887d3ad46ea5a5d938
P 120983a570d6de055cef9d916096de3410897ea9f46d23ea6eff1f9b549e423a
R 6a2910fdd19645a78e675ea1b5f3006c
U stephan
Z ea19c30c280d92414c0f0555fd56a50e
Z 307d46c1a84b2aab03be2e0da79180c9
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
120983a570d6de055cef9d916096de3410897ea9f46d23ea6eff1f9b549e423a
fcfc070673cef2f657f4737f096678439ed7c011fb2e5391e0721f82f5d8af51