On Thu, 14 Apr 2011 10:40:13 +0200 (CEST)
Vincent Torri <[email protected]> wrote:
>
>
> On Thu, 14 Apr 2011, Vincent Torri wrote:
>
> >
> >
> > On Thu, 14 Apr 2011, Enlightenment SVN wrote:
> >
> >> Log:
> >> unrevert. this is not a mistake.
>
> with your commit, the code below fails silently, without it, you have the
> error:
>
>
> CRI<4620>: eina_list.c:880 eina_list_move() *** Eina Magic Check Failed
> !!!
> Input handle pointer is NULL !
> *** NAUGHTY PROGRAMMER!!!
> *** SPANK SPANK SPANK!!!
> *** Now go fix your code. Tut tut tut!
>
>
> which is exactly what should happend.
>
> so explain me why you still want to check *to
>
> Vincent
>
> #include <stdio.h>
> #include <Eina.h>
>
> int main()
> {
> Eina_List *l = NULL;
> Eina_List *ll = NULL;
> int i = 4;
> Eina_Bool res;
>
> eina_init();
>
> l = eina_list_append(l, &i);
> res = eina_list_move(&ll, &l, &i);
> printf("res : %d\n", res);
> eina_shutdown();
>
> return 0;
> }
>
>
> >
> > explain me why it can segfault, then
> >
> > Vincent
> >
> >>
> >>
> >> Author: discomfitor
> >> Date: 2011-04-14 00:42:04 -0700 (Thu, 14 Apr 2011)
> >> New Revision: 58654
> >> Trac: http://trac.enlightenment.org/e/changeset/58654
> >>
> >> Modified:
> >> trunk/eina/src/lib/eina_list.c
> >>
> >> Modified: trunk/eina/src/lib/eina_list.c
> >> ===================================================================
> >> --- trunk/eina/src/lib/eina_list.c 2011-04-14 07:40:45 UTC (rev
> >> 58653) +++ trunk/eina/src/lib/eina_list.c 2011-04-14 07:42:04 UTC
> >> (rev 58654) @@ -894,7 +894,7 @@
> >> EINA_SAFETY_ON_NULL_RETURN_VAL(to, EINA_FALSE);
> >> EINA_SAFETY_ON_NULL_RETURN_VAL(from, EINA_FALSE);
> >>
> >> - EINA_MAGIC_CHECK_LIST(*to, EINA_FALSE);
> >> + if (*to) EINA_MAGIC_CHECK_LIST(*to, EINA_FALSE);
> >> EINA_MAGIC_CHECK_LIST(*from, EINA_FALSE);
> >> EINA_MAGIC_CHECK_LIST(data, EINA_FALSE);
> >>
> >>
> >>
> >>
Here is a better test program:
#include <stdio.h>
#include <Eina.h>
int main()
{
Eina_List *l = NULL;
Eina_List *ll = NULL;
char *s = strdup("test");
Eina_Bool res;
eina_init();
l = eina_list_append(l, s);
printf("l: %s\nll: %s\n", l ? (char*)l->data : "NULL", ll ? (char*)ll->data
: "NULL");
printf("Moving from l to ll\n");
res = eina_list_move(&ll, &l, s);
printf("l: %s\nll: %s\n", l ? (char*)l->data : "NULL", ll ? (char*)ll->data
: "NULL");
eina_shutdown();
return 0;
}
Try it with my check, then without. I wrote the function, and this is the way
it's supposed to work.
--
Mike Blumenkrantz
Zentific: NULL pointer dereferences now 50% off!
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel