Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_text.c 


Log Message:
- fix glibc abort when deleteing text

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- ewl_text.c  18 Oct 2005 05:11:07 -0000      1.27
+++ ewl_text.c  18 Oct 2005 15:15:45 -0000      1.28
@@ -428,8 +428,6 @@
 void
 ewl_text_text_delete(Ewl_Text *t, unsigned int length)
 {
-       char *old, *ptr;
-
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("t", t);
 
@@ -449,13 +447,11 @@
        t->length -= length;
        if (t->length > 0)
        {
-               old = t->text;
-               *(old + t->cursor_position) = '\0';
-               ptr = old + t->cursor_position + length;
-
-               t->text = calloc((t->length + 1), sizeof(char));
-               snprintf(t->text, (t->length + 1), "%s%s", ((old) ? old : ""), 
((ptr) ? ptr : ""));
-               IF_FREE(old);
+               memmove(t->text + t->cursor_position, 
+                               t->text + t->cursor_position + length,
+                               t->length - t->cursor_position);
+
+               t->text[t->length] = '\0';
        }
        else
        {




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to