Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/embryo

Dir     : e17/libs/embryo/src/lib


Modified Files:
        embryo_amx.c embryo_private.h 


Log Message:


fix push/pop to recurse properly

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/lib/embryo_amx.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- embryo_amx.c        9 Dec 2004 05:10:42 -0000       1.27
+++ embryo_amx.c        29 Nov 2005 04:13:02 -0000      1.28
@@ -478,10 +478,20 @@
 {
    Embryo_Header *hdr;
 
-   if ((!ep) || (ep->base)) return;
+   if (!ep) return;
+   ep->pushes++;
+   if (ep->pushes > 1)
+     {
+       embryo_program_vm_reset(ep);
+       return;
+     }
    hdr = (Embryo_Header *)ep->code;
    ep->base = malloc(hdr->stp);
-   if (!ep->base) return;
+   if (!ep->base)
+     {
+       ep->pushes = 0;
+       return;
+     }
    embryo_program_vm_reset(ep);
 }
 
@@ -499,6 +509,8 @@
 embryo_program_vm_pop(Embryo_Program *ep)
 {
    if ((!ep) || (!ep->base)) return;
+   ep->pushes--;
+   if (ep->pushes >= 1) return;
    free(ep->base);
    ep->base = NULL;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/embryo/src/lib/embryo_private.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- embryo_private.h    19 Oct 2004 09:36:35 -0000      1.12
+++ embryo_private.h    29 Nov 2005 04:13:02 -0000      1.13
@@ -218,6 +218,7 @@
 struct _Embryo_Program
 {
    unsigned char *base; /* points to the Embryo_Program header ("ephdr") plus 
the code, optionally also the data */
+   int pushes; /* number of pushes - pops */
    /* for external functions a few registers must be accessible from the 
outside */
    Embryo_Cell cip; /* instruction pointer: relative to base + ephdr->cod */
    Embryo_Cell frm; /* stack frame base: relative to base + ephdr->dat */




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to