Is this bugfix correct (jni.cc)?

Martin Kahlert martin.kahlert@infineon.com
Tue May 8 23:44:00 GMT 2001


Hi!
Sorry to reply to my own mail, but i assume, that the previous patch is not
correct. I changed it to repeat the search on frame->next instead of giving
up.
Additionally i removed the variable done, since it has always the same value
as the variable set, so i used this one instead.
Bye,
Martin.
2001年05月09日 Martin Kahlert <martin.kahlert@infineon.com>
	* jni.cc (_Jv_JNI_NewLocalRef): Search next frame, if
	we could not find free slot in this one. Fixes infinite loop.
*** jni.cc.orig	Tue May 8 16:59:35 2001
--- jni.cc	Wed May 9 08:38:38 2001
***************
*** 280,296 ****
 {
 // Try to find an open slot somewhere in the topmost frame.
 _Jv_JNI_LocalFrame *frame = env->locals;
! bool done = false, set = false;
! while (frame != NULL && ! done)
 {
 for (int i = 0; i < frame->size; ++i)
 	if (frame->vec[i] == NULL)
 	 {
 	 set = true;
- 	 done = true;
 	 frame->vec[i] = obj;
 	 break;
 	 }
 }
 
 if (! set)
--- 280,296 ----
 {
 // Try to find an open slot somewhere in the topmost frame.
 _Jv_JNI_LocalFrame *frame = env->locals;
! bool set = false;
! while (frame != NULL && ! set)
 {
 for (int i = 0; i < frame->size; ++i)
 	if (frame->vec[i] == NULL)
 	 {
 	 set = true;
 	 frame->vec[i] = obj;
 	 break;
 	 }
+ frame = frame->next;
 }
 
 if (! set)
-- 
The early bird gets the worm. If you want something else for 
breakfast, get up later.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /