]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Fixed memory alignment problem in Mem.c by removing MemChunks. We do not
authorrousskov <>
Wed, 4 Mar 1998 05:17:50 +0000 (05:17 +0000)
committerrousskov <>
Wed, 4 Mar 1998 05:17:50 +0000 (05:17 +0000)
  pre-allocate memory any more.
- Removed/replaced tmp_debug() mesages.

src/HttpHeader.cc
src/HttpReply.cc
src/HttpStatusLine.cc
src/Packer.cc
src/fqdncache.cc
src/ipcache.cc
src/mem.cc
src/protos.h
src/store.cc

index a8c49ff8bc88fbc1086d89db5c69fe0fefe1b292..72fa5c1b12b6b0b155b44998e9076c91615fd51b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: HttpHeader.cc,v 1.11 1998/03/03 00:30:59 rousskov Exp $
+ * $Id: HttpHeader.cc,v 1.12 1998/03/03 22:17:50 rousskov Exp $
  *
  * DEBUG: section 55    HTTP Header
  * AUTHOR: Alex Rousskov
@@ -69,7 +69,7 @@ typedef enum {
     ftPChar,
     ftDate_1123,
     ftPSCC,
-    ftPExtField,
+    ftPExtField
 } field_type;
 
 /*
@@ -561,7 +561,7 @@ httpHeaderGetEntry(const HttpHeader * hdr, HttpHeaderPos * pos)
 {
     assert(hdr && pos);
     assert(*pos >= HttpHeaderInitPos && *pos < hdr->capacity);
-    tmp_debug(here) ("searching next e in hdr %p from %d\n", hdr, *pos);
+    debug(55,8) ("searching next e in hdr %p from %d\n", hdr, *pos);
     for ((*pos)++; *pos < hdr->ucount; (*pos)++) {
        HttpHeaderEntry *e = hdr->entries + *pos;
        if (httpHeaderEntryIsValid(e)) {
@@ -1439,8 +1439,6 @@ httpHeaderExtFieldParseCreate(const char *field_start, const char *field_end)
     if (!name_end || name_end <= field_start || name_end > field_end)
        return NULL;
 
-    tmp_debug(here) ("got field len: %d\n", field_end - field_start);
-
     value_start = name_end + 1;        /* skip ':' */
     /* skip white space */
     while (value_start < field_end && isspace(*value_start))
@@ -1589,7 +1587,6 @@ dupShortBuf(const char *str, size_t len)
 {
     char *buf;
     assert(str);
-    assert(len >= 0);
     buf = allocShortBuf(len + 1);
     assert(buf);
     if (len)
index d31125e518f8688331f3de94b6ceb068cbd8f67e..b1ee9c232ff31193b2469753e6516926438dce64 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.cc,v 1.7 1998/03/03 00:30:59 rousskov Exp $
+ * $Id: HttpReply.cc,v 1.8 1998/03/03 22:17:50 rousskov Exp $
  *
  * DEBUG: section 58    HTTP Reply (Response)
  * AUTHOR: Alex Rousskov
@@ -49,7 +49,7 @@ HttpReply *
 httpReplyCreate()
 {
     HttpReply *rep = memAllocate(MEM_HTTPREPLY);
-    tmp_debug(here) ("creating rep: %p\n", rep);
+    debug(58,7) ("creating rep: %p\n", rep);
     httpReplyInit(rep);
     return rep;
 }
@@ -78,7 +78,7 @@ void
 httpReplyDestroy(HttpReply * rep)
 {
     assert(rep);
-    tmp_debug(here) ("destroying rep: %p\n", rep);
+    debug(58,7) ("destroying rep: %p\n", rep);
     httpReplyClean(rep);
     httpReplyDoDestroy(rep);
 }
index fdebd9e6fc345181c1d29a6fc5636f049aa48ad6..a290230363e3053d19c6e52d24fb0b1794842971 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: HttpStatusLine.cc,v 1.5 1998/02/26 18:00:32 wessels Exp $
+ * $Id: HttpStatusLine.cc,v 1.6 1998/03/03 22:17:51 rousskov Exp $
  *
  * DEBUG: section 57    HTTP Status-line
  * AUTHOR: Alex Rousskov
@@ -67,8 +67,8 @@ void
 httpStatusLinePackInto(const HttpStatusLine * sline, Packer * p)
 {
     assert(sline && p);
-    tmp_debug(here) ("packing sline %p using %p:\n", sline, p);
-    tmp_debug(here) (HttpStatusLineFormat, sline->version, sline->status,
+    debug(57,9) ("packing sline %p using %p:\n", sline, p);
+    debug(57,9) (HttpStatusLineFormat, sline->version, sline->status,
        sline->reason ? sline->reason : httpStatusString(sline->status));
     packerPrintf(p, HttpStatusLineFormat,
        sline->version, sline->status,
index 61f500bf12c2dc5eee661b617717c73a889faa1a..1215129fbca42234f7f6cefcdd6b4cde359b9fc8 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: Packer.cc,v 1.5 1998/02/26 18:00:34 wessels Exp $
+ * $Id: Packer.cc,v 1.6 1998/03/03 22:17:52 rousskov Exp $
  *
  * DEBUG: section 60    Packer: A uniform interface to store-like modules
  * AUTHOR: Alex Rousskov
@@ -158,7 +158,6 @@ packerPrintf(va_alist)
 #endif
     assert(p);
     assert(p->real_handler && p->vprintf);
-    tmp_debug(here) ("printf: fmt: '%s'\n", fmt);
     p->vprintf(p->real_handler, fmt, args);
     va_end(args);
 }
index 9b015efc58b8e359476e31cd9ccc077d766d9884..c739b68e5fc24fb716e142aaa061de0d734a5793 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.88 1998/02/26 22:16:28 kostas Exp $
+ * $Id: fqdncache.cc,v 1.89 1998/03/03 22:17:52 rousskov Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -943,7 +943,7 @@ snmp_fqdncacheFn(variable_list * Var, long *ErrP)
     case NET_FQDN_NAME:
        Answer->type = SMI_STRING;
        Answer->val_len = strlen(fq->names[0]);
-       Answer->val.string = xstrdup((char *) fq->names[0]);
+       Answer->val.string = (u_char *)xstrdup(fq->names[0]);
        break;
     case NET_FQDN_IP:
        Answer->type = SMI_IPADDRESS;
index d1ba8ebb14195ca2c1dd466bee87834cb1f8e4bd..fb75632dbd820c343c17e32812f1b5a8b8184dfb 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.163 1998/02/26 22:16:28 kostas Exp $
+ * $Id: ipcache.cc,v 1.164 1998/03/03 22:17:53 rousskov Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -1099,7 +1099,7 @@ snmp_ipcacheFn(variable_list * Var, long *ErrP)
        xfree(Answer->val.integer);
        Answer->type = SMI_STRING;
        Answer->val_len = strlen(IPc->name);
-       Answer->val.string = xstrdup(IPc->name);
+       Answer->val.string = (u_char *)xstrdup(IPc->name);
        break;
     case NET_IPC_IP:
        Answer->type = SMI_IPADDRESS;
index a121aa785cc9e89303c90e0d78213fffce0243b7..d13d394e26db068e0d68cf54c44cf4aff6ca1f07 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mem.cc,v 1.8 1998/03/03 00:31:09 rousskov Exp $
+ * $Id: mem.cc,v 1.9 1998/03/03 22:17:54 rousskov Exp $
  *
  * DEBUG: section 13    High Level Memory Pool Management
  * AUTHOR: Harvest Derived
@@ -46,21 +46,9 @@ memDataInit(mem_type type, const char *name, size_t size, int max_pages_notused)
 static void
 memStats(StoreEntry * sentry)
 {
-    mem_type t;
     storeBuffer(sentry);
-    storeAppendPrintf(sentry, "%-20s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\n",
-       "Pool", "Obj Size",
-       "Capacity (#)", "Capacity (KB)", "Used (KB)", "HWater (KB)", 
-       "Util (%)", "Grow Count",
-       "Malloc (#)", "Malloc (KB)", "MHWater (KB)");
-    for (t = MEM_NONE + 1; t < MEM_MAX; t++) {
-       const MemPool *pool = MemPools[t];
-       if (!memPoolWasNeverUsed(pool))
-           memPoolReport(pool, sentry);
-    }
-    storeAppendPrintf(sentry, "\n");
+    memReport(sentry);
     /* memStringStats(sentry); */
-    memReportTotals(sentry);
     storeBufferFlush(sentry);
 }
 
@@ -197,7 +185,7 @@ memClean()
     int dirty_count = 0;
     for (t = MEM_NONE + 1; t < MEM_MAX; t++) {
        MemPool *pool = MemPools[t];
-       if (memPoolIsUsedNow(pool)) {
+       if (memPoolInUseCount(pool)) {
            memPoolDescribe(pool);
            dirty_count++;
        }
@@ -212,7 +200,7 @@ memClean()
 int
 memInUse(mem_type type)
 {
-    return memPoolUsedCount(MemPools[type]);
+    return memPoolInUseCount(MemPools[type]);
 }
 
 /* ick */
index 9ae9fb99b00deb844f7dfab63b3d2acb3441418f..2132e8e0e165d6a19fbb497d132f3de8e9151c47 100644 (file)
@@ -529,12 +529,13 @@ extern MemPool *memPoolCreate(const char *label, size_t obj_size);
 extern void memPoolDestroy(MemPool *pool);
 extern void *memPoolAlloc(MemPool *pool);
 extern void memPoolFree(MemPool *pool, void *obj);
-extern int memPoolWasNeverUsed(const MemPool *pool);
-extern int memPoolIsUsedNow(const MemPool *pool);
+extern int memPoolWasUsed(const MemPool *pool);
+extern int memPoolInUseCount(const MemPool *pool);
+extern size_t memPoolInUseSize(const MemPool *pool);
 extern int memPoolUsedCount(const MemPool *pool);
 extern void memPoolDescribe(const MemPool *pool);
 extern void memPoolReport(const MemPool *pool, StoreEntry *e);
-extern void memReportTotals(StoreEntry *e);
+extern void memReport(StoreEntry *e);
 
 extern int stmemFreeDataUpto(mem_hdr *, int);
 extern void stmemAppend(mem_hdr *, const char *, int);
index d33a0efe9e35d7ba587ee91e364ea191f2c057c9..eb79a4e94949b3798ca156d0b58ec79836ec097d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.388 1998/03/03 00:31:14 rousskov Exp $
+ * $Id: store.cc,v 1.389 1998/03/03 22:17:56 rousskov Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -456,7 +456,6 @@ storeAppend(StoreEntry * e, const char *buf, int len)
        debug(20, 5) ("storeAppend: appending %d bytes for '%s'\n",
            len,
            storeKeyText(e->key));
-       tmp_debug(here) ("bytes: '%.20s'\n", buf);      /* @?@ @?@ */
        storeGetMemSpace(len);
        stmemAppend(mem->data, buf, len);
        mem->inmem_hi += len;