From 6c863155efaea62afb9e57a553dfbe1e5662d7d4 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 31 Jul 2015 07:35:44 -0700 Subject: [PATCH] clean up BT UUID assignment, replacing runtime strcmp with compile time macro magic --- xwords4/android/XWords4/jni/Android.mk | 2 +- xwords4/android/XWords4/jni/xwjni.c | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/xwords4/android/XWords4/jni/Android.mk b/xwords4/android/XWords4/jni/Android.mk index b641c3748..f33d7dd9b 100644 --- a/xwords4/android/XWords4/jni/Android.mk +++ b/xwords4/android/XWords4/jni/Android.mk @@ -42,7 +42,7 @@ LOCAL_DEFINES += \ -DNATIVE_NLI \ -DCOMMS_VERSION=1 \ -DINITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS} \ - -DVARIANT=\"${VARIANT}\" \ + -DVARIANT_${VARIANT} \ -DRELAY_ROOM_DEFAULT=\"\" \ -D__LITTLE_ENDIAN \ diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index c994b06fe..86ed0ee6f 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -563,18 +563,17 @@ JNIEXPORT jstring JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getUUID ( JNIEnv* env, jclass C ) { - jstring jstr = NULL; + jstring jstr = #ifdef XWFEATURE_BLUETOOTH - const char* uuid; - if ( 0 == XP_STRCMP( VARIANT, "xw4" ) ) { - uuid = XW_BT_UUID; - } else if ( 0 == XP_STRCMP( VARIANT, "xw4dbg" ) ) { - uuid = XW_BT_UUID_DBG; - } else { - XP_ASSERT(0); - } - jstr = (*env)->NewStringUTF( env, uuid ); +# if defined VARIANT_xw4 + (*env)->NewStringUTF( env, XW_BT_UUID ) +# elif defined VARIANT_xw4dbg + (*env)->NewStringUTF( env, XW_BT_UUID_DBG ) +# endif +#else + NULL #endif + ; return jstr; }