[AD] Patch for _ustrdup

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


It makes the function set *allegro_errno to ENOMEM on failure. Commited.

-- 
Eric Botcazou
--- /home/eric/cvs/allegro/src/unicode.c	Tue Oct  1 03:41:49 2002
+++ allegro/src/unicode.c	Fri Nov  1 10:41:29 2002
@@ -1726,8 +1726,11 @@
    ASSERT(src);
    ASSERT(malloc_func);
 
-   if ((s = malloc_func(ustrsizez(src))))
+   s = malloc_func(ustrsizez(src));
+   if (s)
       ustrcpy(s, src);  /* ustrzcpy() not needed */
+   else
+      *allegro_errno = ENOMEM;
 
    return s;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/