Author: adrian.chadd
Date: Thu May 21 01:42:16 2009
New Revision: 14057
Modified:
branches/LUSCA_HEAD/libmem/buf.c
branches/LUSCA_HEAD/libmem/buf.h
Log:
Merge r13689 from /branches/CACHEBOY_HEAD_strref
make the buffer tracking stuff optional.
Modified: branches/LUSCA_HEAD/libmem/buf.c
==============================================================================
--- branches/LUSCA_HEAD/libmem/buf.c (original)
+++ branches/LUSCA_HEAD/libmem/buf.c Thu May 21 01:42:16 2009
@@ -21,7 +21,10 @@
static int buf_configured = 0;
static MemPool *buf_pool = NULL;
+#if BUF_TRACK_BUFS
dlink_list buf_active_list;
+#endif
+
int buf_active_num = 0;
void
@@ -86,7 +89,9 @@
b = memPoolAlloc(buf_pool);
if (! b)
return NULL;
+#if BUF_TRACK_BUFS
dlinkAddTail(b, &b->node, &buf_active_list);
+#endif
buf_active_num++;
debug (85, 5) ("buf_create: %p\n", b);
buf_ref(b);
@@ -119,7 +124,9 @@
b = memPoolAlloc(buf_pool);
if (! b)
return NULL;
+#if BUF_TRACK_BUFS
dlinkAddTail(b, &b->node, &buf_active_list);
+#endif
buf_active_num++;
debug(85, 5) ("buf_create: %p\n", b);
b->b = (char *)data;
@@ -165,7 +172,9 @@
if (!b->flags.isconst) {
free(b->b); b->b = NULL;
}
+#if BUF_TRACK_BUFS
dlinkDelete(&b->node, &buf_active_list);
+#endif
buf_active_num--;
memPoolFree(buf_pool, b);
return NULL;
Modified: branches/LUSCA_HEAD/libmem/buf.h
==============================================================================
--- branches/LUSCA_HEAD/libmem/buf.h (original)
+++ branches/LUSCA_HEAD/libmem/buf.h Thu May 21 01:42:16 2009
@@ -1,12 +1,16 @@
#ifndef __BUF_H__
#define __BUF_H__
+#define BUF_TRACK_BUFS 0
+
struct _buf {
char *b;
int len;
int size;
int sofs; /* how much of the buffer can't be changed */
+#if BUF_TRACK_BUFS
dlink_node node;
+#endif
struct {
char isactive:1;
char isfinal:1;
@@ -76,6 +80,8 @@
static inline int
buf_isfull(buf_t *b) { return (b->size == b->len); }
+#if BUF_TRACK_BUFS
extern dlink_list buf_active_list;
+#endif
#endif
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---