Android build : use environment variable NDEBUG to set preprocessor NDEBUG. NDEBUG env var is set by JNI adapter, in build.gradle when building release
authorEdouard Tisserant
Mon, 19 Dec 2016 02:42:41 +0100
changeset 14951397da6f9084
parent 1494 27ded4922ae2
child 1496 eacf1934b6cc
Android build : use environment variable NDEBUG to set preprocessor NDEBUG. NDEBUG env var is set by JNI adapter, in build.gradle when building release
build-android/jni/Android.mk
src/sync_impl.c
     1.1 --- a/build-android/jni/Android.mk	Fri Dec 16 19:13:00 2016 +0100
     1.2 +++ b/build-android/jni/Android.mk	Mon Dec 19 02:42:41 2016 +0100
     1.3 @@ -16,6 +16,10 @@
     1.4  LOCAL_MODULE    := pEpEngine
     1.5  LOCAL_CFLAGS    += -std=c99
     1.6  
     1.7 +ifneq ($(NDEBUG),)
     1.8 +LOCAL_CFLAGS    += -DNDEBUG=1
     1.9 +endif
    1.10 +
    1.11  # from http://www.sqlite.org/android/finfo?name=jni/sqlite/Android.mk 
    1.12  #      http://www.sqlite.org/android/artifact/e8ed354b3e58c835
    1.13  
     2.1 --- a/src/sync_impl.c	Fri Dec 16 19:13:00 2016 +0100
     2.2 +++ b/src/sync_impl.c	Mon Dec 19 02:42:41 2016 +0100
     2.3 @@ -484,7 +484,9 @@
     2.4      ASN_STRUCT_FREE(asn_DEF_DeviceGroup_Protocol, msg);
     2.5  }
     2.6  
     2.7 -int _append(const void *buffer, size_t size, void *appkey)
     2.8 +
     2.9 +#ifndef NDEBUG
    2.10 +static int _append(const void *buffer, size_t size, void *appkey)
    2.11  {
    2.12      char **dest_ptr = (char **)appkey;
    2.13      size_t osize = strlen(*dest_ptr);
    2.14 @@ -495,6 +497,7 @@
    2.15      (*dest_ptr)[nsize] = '\0';
    2.16      return 0;
    2.17  }
    2.18 +#endif
    2.19  
    2.20  PEP_STATUS unicast_msg(
    2.21          PEP_SESSION session,