From b179a0bade0c2b149d4358736e60d4b566528930 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sun, 18 Dec 2022 18:50:05 -0800 Subject: [PATCH] remove dead code --- .../org/eehouse/android/xw4/jni/XwJNI.java | 1 - xwords4/android/jni/xwjni.c | 39 ------------------- xwords4/common/comms.c | 21 ---------- xwords4/common/comms.h | 3 -- 4 files changed, 64 deletions(-) diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java index 1fb69e152..cc9633137 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java @@ -550,7 +550,6 @@ public class XwJNI { boolean andAck ) { return comms_resendAll( gamePtr, force, null, andAck ); } - public static native byte[][] comms_getPending( GamePtr gamePtr ); public static native int comms_countPendingPackets( GamePtr gamePtr ); public static native void comms_ackAny( GamePtr gamePtr ); diff --git a/xwords4/android/jni/xwjni.c b/xwords4/android/jni/xwjni.c index 0ec4e6791..ead462b1d 100644 --- a/xwords4/android/jni/xwjni.c +++ b/xwords4/android/jni/xwjni.c @@ -2581,45 +2581,6 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll return result; } -typedef struct _GotOneClosure { - JNIEnv* env; - jbyteArray msgs[16]; - int count; -} GotOneClosure; - -static void -onGotOne( void* closure, XWEnv xwe, XP_U8* msg, XP_U16 len, MsgID XP_UNUSED(msgID) ) -{ - GotOneClosure* goc = (GotOneClosure*)closure; - XP_ASSERT( goc->env == xwe ); - if ( goc->count < VSIZE(goc->msgs) ) { - jbyteArray arr = makeByteArray( xwe, len, (const jbyte*)msg ); - goc->msgs[goc->count++] = arr; - } else { - XP_ASSERT( 0 ); - } -} - -JNIEXPORT jobjectArray JNICALL -Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getPending -( JNIEnv* env, jclass C, GamePtrType gamePtr ) -{ - jobjectArray result = NULL; - XWJNI_START(gamePtr); - GotOneClosure goc = { .env = env, .count = 0 }; - XP_ASSERT( !!state->game.comms ); - comms_getPending( state->game.comms, env, onGotOne, &goc ); - - result = makeByteArrayArray( env, goc.count ); - for ( int ii = 0; ii < goc.count; ++ii ) { - (*env)->SetObjectArrayElement( env, result, ii, goc.msgs[ii] ); - deleteLocalRef( env, goc.msgs[ii] ); - } - - XWJNI_END(); - return result; -} - JNIEXPORT jint JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_comms_1countPendingPackets ( JNIEnv* env, jclass C, GamePtrType gamePtr ) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index c55ce4e8b..7ee3aae76 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -2107,27 +2107,6 @@ comms_resendAll( CommsCtxt* comms, XWEnv xwe, CommsConnType filter, XP_Bool forc return result; } -typedef struct _GetAllClosure{ - PendingMsgProc proc; - void* closure; -} GetAllClosure; - -static XP_S16 -gatherMsgs( CommsCtxt* XP_UNUSED(comms), XWEnv xwe, MsgQueueElem* msg, - CommsConnType XP_UNUSED(filter), void* closure ) -{ - GetAllClosure* gac = (GetAllClosure*)closure; - (*gac->proc)( gac->closure, xwe, msg->msg, msg->len, msg->msgID ); - return 1; /* 0 gets an assert */ -} - -void -comms_getPending( CommsCtxt* comms, XWEnv xwe, PendingMsgProc proc, void* closure ) -{ - GetAllClosure gac = { .proc = proc, .closure = closure }; - (void)resendImpl( comms, xwe, COMMS_CONN_NONE, XP_TRUE, gatherMsgs, &gac ); -} - #ifdef XWFEATURE_COMMSACK static void ackAnyImpl( CommsCtxt* comms, XWEnv xwe, XP_Bool force ) diff --git a/xwords4/common/comms.h b/xwords4/common/comms.h index bb920728c..18d83393a 100644 --- a/xwords4/common/comms.h +++ b/xwords4/common/comms.h @@ -219,9 +219,6 @@ XP_S16 comms_send( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream ); XP_S16 comms_resendAll( CommsCtxt* comms, XWEnv xwe, CommsConnType filter, XP_Bool force ); -typedef void (*PendingMsgProc)( void* closure, XWEnv xwe, XP_U8* msg, - XP_U16 len, MsgID msgID ); -void comms_getPending( CommsCtxt* comms, XWEnv xwe, PendingMsgProc proc, void* closure ); XP_U16 comms_getChannelSeed( CommsCtxt* comms ); #ifdef XWFEATURE_COMMSACK