/[classpath]/classpath/native/jni/classpath/native_state.c
ViewVC logotype

Diff of /classpath/native/jni/classpath/native_state.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by fitzsim, Thu Jul 14 22:07:02 2005 UTC revision 1.12 by archie172, Mon Jul 25 22:32:51 2005 UTC
# Line 36  obligated to do so.  If you do not wish Line 36  obligated to do so.  If you do not wish
36  exception statement from your version. */  exception statement from your version. */
37    
38  #include <stdlib.h>  #include <stdlib.h>
39    #include <assert.h>
40  #include <jni.h>  #include <jni.h>
41  #include "native_state.h"  #include "native_state.h"
42    
# Line 165  add_node (struct state_node **head, jint Line 166  add_node (struct state_node **head, jint
166    *head = new_node;    *head = new_node;
167  }  }
168    
169    #ifndef NDEBUG
170    static void
171    cp_gtk_check_compat (JNIEnv * env, jobject obj, struct state_table *table)
172    {
173      jclass objclazz;
174    
175      objclazz = (*env)->GetObjectClass(env, obj);
176      assert ((*env)->IsAssignableFrom(env, objclazz, table->clazz));
177      (*env)->DeleteLocalRef(env, objclazz);
178    }
179    #endif
180    
181  void  void
182  cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table,  cp_gtk_set_state_oid (JNIEnv * env, jobject lock, struct state_table *table,
183                 jint obj_id, void *state)                 jint obj_id, void *state)
# Line 214  int Line 227  int
227  cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state)  cp_gtk_set_state (JNIEnv * env, jobject obj, struct state_table *table, void *state)
228  {  {
229    jint obj_id;    jint obj_id;
230    
231    #ifndef NDEBUG
232      cp_gtk_check_compat(env, obj, table);
233    #endif
234    
235    obj_id = (*env)->GetIntField (env, obj, table->hash);    obj_id = (*env)->GetIntField (env, obj, table->hash);
236    
237    if ((*env)->ExceptionOccurred (env) != NULL)    if ((*env)->ExceptionOccurred (env) != NULL)
# Line 227  void * Line 245  void *
245  cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table)  cp_gtk_get_state (JNIEnv * env, jobject obj, struct state_table *table)
246  {  {
247    jint obj_id;    jint obj_id;
248    
249    #ifndef NDEBUG
250      cp_gtk_check_compat(env, obj, table);
251    #endif
252    
253    obj_id = (*env)->GetIntField (env, obj, table->hash);    obj_id = (*env)->GetIntField (env, obj, table->hash);
254    
255    if ((*env)->ExceptionOccurred (env) != NULL)    if ((*env)->ExceptionOccurred (env) != NULL)
# Line 239  void * Line 262  void *
262  cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table)  cp_gtk_remove_state_slot (JNIEnv * env, jobject obj, struct state_table *table)
263  {  {
264    jint obj_id;    jint obj_id;
265    
266    #ifndef NDEBUG
267      cp_gtk_check_compat(env, obj, table);
268    #endif
269    
270    obj_id = (*env)->GetIntField (env, obj, table->hash);    obj_id = (*env)->GetIntField (env, obj, table->hash);
271    
272    if ((*env)->ExceptionOccurred (env) != NULL)    if ((*env)->ExceptionOccurred (env) != NULL)

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26