Hello,
  another patch for new regex module:
Stepan

----- Forwarded message from Yuri Vasilevski <[EMAIL PROTECTED]> -----
Date: Tue, 23 Aug 2005 23:17:40 -0500
To: [EMAIL PROTECTED]
Subject: Bug Report: sed-4.1.4 misinterprets uClibc's malloc (patch included)

Hi,

Recent versions of sed expect glibc behavior form malloc, i.e.
malloc(0) return live pointer. This is not true for uClibc (and many
other old/classical libc implementations).

So I made and attach a patch to solve this problem. It basically makes
re_node_set_alloc(set,0) behave exactly as re_node_set_init_empty(set).

Yuri.

----- End forwarded message -----
diff -Naur sed-4.1.4.orig/lib/regex_internal.c sed-4.1.4/lib/regex_internal.c
--- sed-4.1.4.orig/lib/regex_internal.c 2005-01-28 09:07:56 +0000
+++ sed-4.1.4/lib/regex_internal.c      2005-08-24 03:20:28 +0000
@@ -885,8 +885,9 @@
 {
   set->alloc = size;
   set->nelem = 0;
-  set->elems = re_malloc (int, size);
-  if (BE (set->elems == NULL, 0))
+  set->elems = re_malloc (int, size); /* can be NULL if size == 0
+                               (see re_node_set_init_empty(set)) */
+  if (BE (set->elems == NULL && size != 0, 0))
     return REG_ESPACE;
   return REG_NOERROR;
 }
_______________________________________________
bug-gnulib mailing list
bug-gnulib@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnulib

Reply via email to