2011/5/19 Enlightenment SVN <no-re...@enlightenment.org>:
> Log:
> Elm entry: strndup is not portable, use memcpy.
If it's in the context of copying a string, why don't you define
strndup as a macro for platforms it's not supported on?

BR,

Leif
>
>  Thanks to vtorri for the notice.
>
> Author:       tasn
> Date:         2011-05-19 06:27:46 -0700 (Thu, 19 May 2011)
> New Revision: 59540
> Trac:         http://trac.enlightenment.org/e/changeset/59540
>
> Modified:
>  trunk/elementary/src/lib/elm_entry.c
>
> Modified: trunk/elementary/src/lib/elm_entry.c
> ===================================================================
> --- trunk/elementary/src/lib/elm_entry.c        2011-05-19 13:24:06 UTC (rev 
> 59539)
> +++ trunk/elementary/src/lib/elm_entry.c        2011-05-19 13:27:46 UTC (rev 
> 59540)
> @@ -1884,19 +1884,25 @@
>
>    len = strlen(entry);
>    /* Split to ~_CHUNK_SIZE chunks */
> -   if (len <= _CHUNK_SIZE)
> +   if (len > _CHUNK_SIZE)
>      {
> -        edje_object_part_text_set(wd->ent, "elm.text", entry);
> +        wd->append_text_left = (char *) malloc(len + 1);
>      }
> -   else
> +
> +   /* If we decided to use the idler */
> +   if (wd->append_text_left)
>      {
>         /* Need to clear the entry first */
>         edje_object_part_text_set(wd->ent, "elm.text", "");
> -        wd->append_text_left = strndup(entry, len);
> +        memcpy(wd->append_text_left, entry, len + 1);
>         wd->append_text_position = 0;
>         wd->append_text_len = len;
>         wd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
>      }
> +   else
> +     {
> +        edje_object_part_text_set(wd->ent, "elm.text", entry);
> +     }
>  }
>
>  /**
>
>
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its
> next-generation tools to help Windows* and Linux* C/C++ and Fortran
> developers boost performance applications - including clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to