OSSP CVS Repository

ossp - Check-in [2166]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2166
Date: 2002-May-28 15:54:22 (local)
2002-May-28 13:54:22 (UTC)
User:thl
Branch:
Comment: clean up data.[sm]
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_msg.c      1.23 -> 1.24     22 inserted, 9 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_msg.c 1.23 -> 1.24

--- lmtp2nntp_msg.c      2002/05/28 12:43:14     1.23
+++ lmtp2nntp_msg.c      2002/05/28 13:54:22     1.24
@@ -477,7 +477,7 @@
 
     //FIXME below is the header rewriting engine which must be cleaned up and integrated
 
-static void headerdestroy(headerdata_t *hdC)
+static void headerdatadestroy(headerdata_t *hdC)
 {
     int i;
 
@@ -492,8 +492,18 @@
     if (hdC->ndata == 1)
         if (hdC->data.s != NULL)
             free(hdC->data.s);
+}
+
+static void headernamedestroy(headerdata_t *hdC)
+{
     if (hdC->name != NULL)
         free(hdC->name);
+}
+
+static void headerdestroy(headerdata_t *hdC)
+{
+    headerdatadestroy(hdC);
+    headernamedestroy(hdC);
     if (hdC->prev != NULL && hdC->prev->next == hdC)
         throw(0,0,0);
     if (hdC->next != NULL && hdC->next->prev == hdC)
@@ -982,8 +992,8 @@
                         logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                         if (strlen(res_ptr) == 0) {
                             logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - emtpy headername");
-                            hdNew->name = NULL;
-                            /*FIXME clean up data.s and data.m */
+                            headerdatadestroy(hdNew);
+                            headernamedestroy(hdNew);
                             hdNew->ndata = 0;
                         }
                         else {
@@ -992,7 +1002,8 @@
                     }
                     if (hrI->val == NULL) {
                         logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - empty headervalue before expansion");
-                        /*FIXME clean up data.s and data.m */
+                        headerdatadestroy(hdNew);
+                        headernamedestroy(hdNew);
                         hdNew->ndata = 0;
                     }
                     else {
@@ -1016,7 +1027,8 @@
                             logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                             if (strlen(res_ptr) == 0) {
                                 logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - empty headervalue after expansion");
-                                /*FIXME clean up data.s and data.m */
+                                headerdatadestroy(hdNew);
+                                headernamedestroy(hdNew);
                                 hdNew->ndata = 0;
                             }
                             else {
@@ -1025,7 +1037,6 @@
                             }
                         }
                     }
-                    /*FIXME clean up data.m */
                     headerreplace(hdI, hdNew);
                     if (hdNew->prev == NULL)
                         ctx->msg->hdFirst = hdNew;
@@ -1039,11 +1050,11 @@
             hdNew->name = strdupex(hrI->name);
             if (hrI->val == NULL) {
                 logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted");
-                /*FIXME clean up data.s and data.m */
+                headerdatadestroy(hdNew);
+                headernamedestroy(hdNew);
                 hdNew->ndata = 0;
             }
             else {
-                /*FIXME clean up data.m */
                 /* expanding variables into header value */
                 char *res_ptr;
                 logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding variables in header value '%s'", hrI->val);
@@ -1053,10 +1064,12 @@
                 logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                 if (strlen(res_ptr) == 0) {
                     logbook(ctx->l2, L2_LEVEL_DEBUG, "marking deleted - empty headervalue after expansion");
-                    /*FIXME clean up data.s and data.m */
+                    headerdatadestroy(hdNew);
+                    headernamedestroy(hdNew);
                     hdNew->ndata = 0;
                 }
                 else {
+                    headerdatadestroy(hdNew);
                     hdNew->data.s = res_ptr;
                     hdNew->ndata = 1;
                 }

CVSTrac 2.0.1