]> git.eshelyaron.com Git - emacs.git/commitdiff
Substitute eassert for assert throughout Android code
authorPo Lu <luangruo@yahoo.com>
Fri, 27 Oct 2023 10:44:15 +0000 (18:44 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 27 Oct 2023 10:44:15 +0000 (18:44 +0800)
* src/android.c (android_init_emacs_service)
(android_init_emacs_pixmap, android_init_graphics_point)
(android_init_emacs_drawable, android_init_emacs_window)
(android_init_emacs_cursor, android_destroy_handle)
(android_create_window, android_init_android_rect_class)
(android_init_emacs_gc_class, android_begin_query):

* src/androidselect.c (android_init_emacs_clipboard)
(android_init_emacs_desktop_notification):

* src/androidterm.c (getExtractedText)
(android_get_surrounding_text_internal):

* src/androidvfs.c (android_vfs_init): Replace assert with
eassert.

src/android.c
src/androidselect.c
src/androidterm.c
src/androidvfs.c

index 9f0e966a602df69afa37941755c6df4cf1c2d705..3344a773d5f8b09ff47ade00d5ad3e08eefc2f53 100644 (file)
@@ -1531,7 +1531,7 @@ android_init_emacs_service (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        service_class.class,    \
                                        name, signature);       \
-  assert (service_class.c_name);
+  eassert (service_class.c_name);
 
   FIND_METHOD (fill_rectangle, "fillRectangle",
               "(Lorg/gnu/emacs/EmacsDrawable;"
@@ -1647,7 +1647,7 @@ android_init_emacs_pixmap (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        pixmap_class.class,     \
                                        name, signature);       \
-  assert (pixmap_class.c_name);
+  eassert (pixmap_class.c_name);
 
   FIND_METHOD (constructor_mutable, "<init>", "(SIII)V");
 
@@ -1678,7 +1678,7 @@ android_init_graphics_point (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        point_class.class,      \
                                        name, signature);       \
-  assert (point_class.c_name);
+  eassert (point_class.c_name);
 
   FIND_METHOD (constructor, "<init>", "(II)V");
 #undef FIND_METHOD
@@ -1708,7 +1708,7 @@ android_init_emacs_drawable (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        drawable_class.class,   \
                                        name, signature);       \
-  assert (drawable_class.c_name);
+  eassert (drawable_class.c_name);
 
   FIND_METHOD (get_bitmap, "getBitmap", "()Landroid/graphics/Bitmap;");
 #undef FIND_METHOD
@@ -1738,7 +1738,7 @@ android_init_emacs_window (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        window_class.class,     \
                                        name, signature);       \
-  assert (window_class.c_name);
+  eassert (window_class.c_name);
 
   FIND_METHOD (swap_buffers, "swapBuffers", "()V");
   FIND_METHOD (toggle_on_screen_keyboard,
@@ -1798,7 +1798,7 @@ android_init_emacs_cursor (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        cursor_class.class,     \
                                        name, signature);       \
-  assert (cursor_class.c_name);
+  eassert (cursor_class.c_name);
 
   FIND_METHOD (constructor, "<init>", "(SI)V");
 #undef FIND_METHOD
@@ -2695,12 +2695,12 @@ android_destroy_handle (android_handle handle)
       class
        = (*android_java_env)->FindClass (android_java_env,
                                          "org/gnu/emacs/EmacsHandleObject");
-      assert (class != NULL);
+      eassert (class != NULL);
 
       method
        = (*android_java_env)->GetMethodID (android_java_env, class,
                                            "destroyHandle", "()V");
-      assert (method != NULL);
+      eassert (method != NULL);
 
       old = class;
       class
@@ -2843,13 +2843,13 @@ android_create_window (android_window parent, int x, int y,
     {
       class = (*android_java_env)->FindClass (android_java_env,
                                              "org/gnu/emacs/EmacsWindow");
-      assert (class != NULL);
+      eassert (class != NULL);
 
       constructor
        = (*android_java_env)->GetMethodID (android_java_env, class, "<init>",
                                            "(SLorg/gnu/emacs/EmacsWindow;"
                                            "IIIIZ)V");
-      assert (constructor != NULL);
+      eassert (constructor != NULL);
 
       old = class;
       class = (*android_java_env)->NewGlobalRef (android_java_env, class);
@@ -2925,12 +2925,12 @@ android_init_android_rect_class (void)
   android_rect_class
     = (*android_java_env)->FindClass (android_java_env,
                                      "android/graphics/Rect");
-  assert (android_rect_class);
+  eassert (android_rect_class);
 
   android_rect_constructor
     = (*android_java_env)->GetMethodID (android_java_env, android_rect_class,
                                        "<init>", "(IIII)V");
-  assert (emacs_gc_constructor);
+  eassert (emacs_gc_constructor);
 
   old = android_rect_class;
   android_rect_class
@@ -2952,19 +2952,19 @@ android_init_emacs_gc_class (void)
   emacs_gc_class
     = (*android_java_env)->FindClass (android_java_env,
                                      "org/gnu/emacs/EmacsGC");
-  assert (emacs_gc_class);
+  eassert (emacs_gc_class);
 
   emacs_gc_constructor
     = (*android_java_env)->GetMethodID (android_java_env,
                                        emacs_gc_class,
                                        "<init>", "(S)V");
-  assert (emacs_gc_constructor);
+  eassert (emacs_gc_constructor);
 
   emacs_gc_mark_dirty
     = (*android_java_env)->GetMethodID (android_java_env,
                                        emacs_gc_class,
                                        "markDirty", "(Z)V");
-  assert (emacs_gc_mark_dirty);
+  eassert (emacs_gc_mark_dirty);
 
   old = emacs_gc_class;
   emacs_gc_class
@@ -6667,7 +6667,7 @@ android_begin_query (void)
   if (old == 1)
     {
       /* Answer the query that is currently being made.  */
-      assert (android_query_function != NULL);
+      eassert (android_query_function != NULL);
       android_answer_query ();
     }
 
index 3f02535109388a7ff2ee0026e810960a172bc0cb..f7988db0520005c04faf122ae1cb7479fb99d8eb 100644 (file)
@@ -90,7 +90,7 @@ android_init_emacs_clipboard (void)
     = (*android_java_env)->GetMethodID (android_java_env,      \
                                        clipboard_class.class,  \
                                        name, signature);       \
-  assert (clipboard_class.c_name);
+  eassert (clipboard_class.c_name);
 
   FIND_METHOD (set_clipboard, "setClipboard", "([B)V");
   FIND_METHOD (owns_clipboard, "ownsClipboard", "()I");
@@ -107,7 +107,7 @@ android_init_emacs_clipboard (void)
                                              "makeClipboard",
                                              "()Lorg/gnu/emacs/"
                                              "EmacsClipboard;");
-  assert (clipboard_class.make_clipboard);
+  eassert (clipboard_class.make_clipboard);
 
 #undef FIND_METHOD
 }
@@ -511,7 +511,7 @@ android_init_emacs_desktop_notification (void)
     = (*android_java_env)->GetMethodID (android_java_env,              \
                                        notification_class.class,       \
                                        name, signature);               \
-  assert (notification_class.c_name);
+  eassert (notification_class.c_name);
 
   FIND_METHOD (init, "<init>", "(Ljava/lang/String;"
               "Ljava/lang/String;Ljava/lang/String;"
index 9d6517cce2b83ebaaaafa55087200e9d2557b6b0..e87f7ca2d1491d933aa3cbc424b14f8b6e7e99e4 100644 (file)
@@ -21,7 +21,6 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <math.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <semaphore.h>
 
 #include "lisp.h"
@@ -5602,15 +5601,15 @@ NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
       class
        = (*env)->FindClass (env, ("android/view/inputmethod"
                                   "/ExtractedTextRequest"));
-      assert (class);
+      eassert (class);
 
       request_class.hint_max_chars
        = (*env)->GetFieldID (env, class, "hintMaxChars", "I");
-      assert (request_class.hint_max_chars);
+      eassert (request_class.hint_max_chars);
 
       request_class.token
        = (*env)->GetFieldID (env, class, "token", "I");
-      assert (request_class.token);
+      eassert (request_class.token);
 
       request_class.initialized = true;
     }
@@ -5620,12 +5619,12 @@ NATIVE_NAME (getExtractedText) (JNIEnv *env, jobject ignored_object,
       text_class.class
        = (*env)->FindClass (env, ("android/view/inputmethod"
                                   "/ExtractedText"));
-      assert (text_class.class);
+      eassert (text_class.class);
 
       class
        = text_class.class
        = (*env)->NewGlobalRef (env, text_class.class);
-      assert (text_class.class);
+      eassert (text_class.class);
 
       text_class.flags
        = (*env)->GetFieldID (env, class, "flags", "I");
@@ -5924,7 +5923,7 @@ android_get_surrounding_text_internal (JNIEnv *env, jshort window,
          return NULL;
        }
 #else /* __ANDROID_API__ >= 31 */
-      assert (class);
+      eassert (class);
 #endif /* __ANDROID_API__ < 31 */
 
       class = (*env)->NewGlobalRef (env, class);
@@ -5936,7 +5935,7 @@ android_get_surrounding_text_internal (JNIEnv *env, jshort window,
       /* Now look for its constructor.  */
       constructor = (*env)->GetMethodID (env, class, "<init>",
                                         "(Ljava/lang/CharSequence;III)V");
-      assert (constructor);
+      eassert (constructor);
     }
 
   context.before_length = before_length;
@@ -6032,7 +6031,7 @@ NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jshort window)
          return NULL;
        }
 #else /* __ANDROID_API__ >= 33 */
-      assert (class);
+      eassert (class);
 #endif /* __ANDROID_API__ < 33 */
 
       class = (*env)->NewGlobalRef (env, class);
@@ -6044,7 +6043,7 @@ NATIVE_NAME (takeSnapshot) (JNIEnv *env, jobject object, jshort window)
       constructor = (*env)->GetMethodID (env, class, "<init>",
                                         "(Landroid/view/inputmethod"
                                         "/SurroundingText;III)V");
-      assert (constructor);
+      eassert (constructor);
     }
 
   /* Try to create a TextSnapshot object.  */
index f89a82cfcc63c1a8dd4fe445fd706973263850b4..b3d644e21a2459616ad692a570f87606238ef804 100644 (file)
@@ -6557,12 +6557,12 @@ android_vfs_init (JNIEnv *env, jobject manager)
 
   /* Initialize some required classes.  */
   java_string_class = (*env)->FindClass (env, "java/lang/String");
-  assert (java_string_class);
+  eassert (java_string_class);
 
   old = java_string_class;
   java_string_class = (jclass) (*env)->NewGlobalRef (env,
                                                     java_string_class);
-  assert (java_string_class);
+  eassert (java_string_class);
   (*env)->DeleteLocalRef (env, old);
 
   /* And initialize those used on Android 5.0 and later.  */