In poldek-0.18.7/trurlib/nmalloc.c we can see:
[...]
void n_free(void *ptr)
{
if (ptr)
free(ptr);
}
[...]
IMvHO this code doesn't make sense - wastes CPU cycles only. Quoitting from
free(3) manpage:
"If ptr is NULL, no operation is performed."
Please, review and test attached patch. If it's correct, please commit it on
behalf of me.
--
Tomasz Wittner
diff -Nurb b.poldek-0.18.7/capreq.c n.poldek-0.18.7/capreq.c
--- b.poldek-0.18.7/capreq.c 2004-01-10 14:04:48.000000000 +0100
+++ n.poldek-0.18.7/capreq.c 2004-11-11 15:11:01.501825408 +0100
@@ -39,7 +39,7 @@
#include "misc.h"
static void *(*capreq_alloc_fn)(size_t) = n_malloc;
-static void (*capreq_free_fn)(void*) = n_free;
+static void (*capreq_free_fn)(void*) = free;
void set_capreq_allocfn(void *(*cr_allocfn)(size_t), void (*cr_freefn)(void*),
void **prev_alloc, void **prev_free)
diff -Nurb b.poldek-0.18.7/fileindex.c n.poldek-0.18.7/fileindex.c
--- b.poldek-0.18.7/fileindex.c 2004-09-25 16:16:06.000000000 +0200
+++ n.poldek-0.18.7/fileindex.c 2004-11-11 15:11:28.151774000 +0100
@@ -26,7 +26,7 @@
#include "fileindex.h"
#define obstack_chunk_alloc n_malloc
-#define obstack_chunk_free n_free
+#define obstack_chunk_free free
struct file_ent {
struct flfile *flfile;
diff -Nurb b.poldek-0.18.7/pkg.c n.poldek-0.18.7/pkg.c
--- b.poldek-0.18.7/pkg.c 2004-09-25 16:15:36.000000000 +0200
+++ n.poldek-0.18.7/pkg.c 2004-11-11 15:12:03.494401104 +0100
@@ -35,7 +35,7 @@
int poldek_conf_promote_epoch = 0;
static void *(*pkg_alloc_fn)(size_t) = n_malloc;
-static void (*pkg_free_fn)(void*) = n_free;
+static void (*pkg_free_fn)(void*) = free;
#if 0 /* disabled cause gives not reasonable profit */
void set_pkg_allocfn(void *(*pkg_allocfn)(size_t), void (*pkg_freefn)(void*))
diff -Nurb b.poldek-0.18.7/pkgfl.c n.poldek-0.18.7/pkgfl.c
--- b.poldek-0.18.7/pkgfl.c 2004-07-05 21:11:25.000000000 +0200
+++ n.poldek-0.18.7/pkgfl.c 2004-11-11 15:12:28.333624968 +0100
@@ -34,7 +34,7 @@
#include "h2n.h"
#define obstack_chunk_alloc n_malloc
-#define obstack_chunk_free n_free
+#define obstack_chunk_free free
struct flmark {
tn_array *dirs;
diff -Nurb b.poldek-0.18.7/pkgset.c n.poldek-0.18.7/pkgset.c
--- b.poldek-0.18.7/pkgset.c 2004-07-02 19:42:40.000000000 +0200
+++ n.poldek-0.18.7/pkgset.c 2004-11-11 15:13:01.797537680 +0100
@@ -49,7 +49,7 @@
int ask_pkg(const char *capname, struct pkg **pkgs, struct pkg *deflt);
#define obstack_chunk_alloc n_malloc
-#define obstack_chunk_free n_free
+#define obstack_chunk_free free
struct obstack_s {
int ucnt;
@@ -471,7 +471,7 @@
pkgset_order(ps);
mem_info(1, "MEM after order");
- set_capreq_allocfn(n_malloc, n_free, NULL, NULL);
+ set_capreq_allocfn(n_malloc, free, NULL, NULL);
return ps->nerrors == 0;
}
diff -Nurb b.poldek-0.18.7/trurlib/xmalloc.c n.poldek-0.18.7/trurlib/xmalloc.c
--- b.poldek-0.18.7/trurlib/xmalloc.c 2002-05-06 19:01:04.000000000 +0200
+++ n.poldek-0.18.7/trurlib/xmalloc.c 2004-11-11 15:13:50.949065512 +0100
@@ -23,6 +23,6 @@
void xfree(void *ptr)
{
- n_free(ptr);
+ free(ptr);
}
_______________________________________________
pld-devel-en mailing list
[EMAIL PROTECTED]
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en