From: Po Lu Date: Fri, 27 Oct 2023 10:44:15 +0000 (+0800) Subject: Substitute eassert for assert throughout Android code X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bbd4385a631d0b1127a17919e767bbbb513e1dcc;p=emacs.git Substitute eassert for assert throughout Android code * 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. --- diff --git a/src/android.c b/src/android.c index 9f0e966a602..3344a773d5f 100644 --- a/src/android.c +++ b/src/android.c @@ -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, "", "(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, "", "(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, "", "(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, "", "(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, "", "(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, "", "(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 (); } diff --git a/src/androidselect.c b/src/androidselect.c index 3f025351093..f7988db0520 100644 --- a/src/androidselect.c +++ b/src/androidselect.c @@ -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, "", "(Ljava/lang/String;" "Ljava/lang/String;Ljava/lang/String;" diff --git a/src/androidterm.c b/src/androidterm.c index 9d6517cce2b..e87f7ca2d14 100644 --- a/src/androidterm.c +++ b/src/androidterm.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #include #include #include -#include #include #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, "", "(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, "", "(Landroid/view/inputmethod" "/SurroundingText;III)V"); - assert (constructor); + eassert (constructor); } /* Try to create a TextSnapshot object. */ diff --git a/src/androidvfs.c b/src/androidvfs.c index f89a82cfcc6..b3d644e21a2 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c @@ -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. */