OSSP CVS Repository

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

Check-in Number: 2163
Date: 2002-May-28 14:30:29 (local)
2002-May-28 12:30:29 (UTC)
User:thl
Branch:
Comment: kick off the bad name, use less variables, fix wrong variable in logs
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp_msg.c      1.20 -> 1.21     10 inserted, 13 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp_msg.c 1.20 -> 1.21

--- lmtp2nntp_msg.c      2002/05/28 12:21:38     1.20
+++ lmtp2nntp_msg.c      2002/05/28 12:30:29     1.21
@@ -894,7 +894,8 @@
     regex_ctx_t *regex_ctx;
 #define OVECSIZE 30
     int            ovec[OVECSIZE];
-    var_rc_t rc; char *cp; //FIXME what a bad name, it's not the returncode of this function
+    var_rc_t var_rc;
+    char *cp;
 
     /* short circuit in case no headerrules were set up */
     if (ctx->option_firstheaderrule == NULL)
@@ -926,12 +927,12 @@
     regex_ctx->acpMatch = NULL;
     regex_ctx->l2_env = ctx->l2_env;
     regex_ctx->l2 = ctx->l2;
-    if ((rc = var_config(ctx->config_varregex, VAR_CONFIG_CB_VALUE, regex_lookup, regex_ctx)) != VAR_OK) {
-        logbook(ctx->l2, L2_LEVEL_ERROR, "configure regex callback failed with %s (%d)", var_strerror(ctx->config_varregex, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+    if ((var_rc = var_config(ctx->config_varregex, VAR_CONFIG_CB_VALUE, regex_lookup, regex_ctx)) != VAR_OK) {
+        logbook(ctx->l2, L2_LEVEL_ERROR, "configure regex callback failed with %s (%d)", var_strerror(ctx->config_varregex, var_rc, &cp) == VAR_OK ? cp : "Unknown Error", var_rc);
         throw(0,0,0);
     }
-    if ((rc = var_config(ctx->config_varctx, VAR_CONFIG_CB_OPERATION, operate_cb, ctx->prival)) != VAR_OK) { //FIXME isn't main a better place to do this?
-        logbook(ctx->l2, L2_LEVEL_ERROR, "configure operate callback failed with %s (%d)", var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+    if ((var_rc = var_config(ctx->config_varctx, VAR_CONFIG_CB_OPERATION, operate_cb, ctx->prival)) != VAR_OK) { //FIXME isn't main a better place to do this?
+        logbook(ctx->l2, L2_LEVEL_ERROR, "configure operate callback failed with %s (%d)", var_strerror(ctx->config_varctx, var_rc, &cp) == VAR_OK ? cp : "Unknown Error", var_rc);
         throw(0,0,0);
     }
     for (hrI = ctx->option_firstheaderrule; hrI != NULL; hrI = hrI->next) { /* for each rule */
@@ -973,11 +974,10 @@
                     hdNew = headercreate();
                     /* expanding regex references into header name */
                     {
-                        var_rc_t var_rc;
                         char *res_ptr;
                         logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding regex references in headername '%s'", hrI->header);
                         if ((var_rc = var_expand(ctx->config_varregex, hrI->header, strlen(hrI->header), &res_ptr, NULL, FALSE)) != VAR_OK) {
-                            logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->header, var_strerror(ctx->config_varregex, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+                            logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->header, var_strerror(ctx->config_varregex, var_rc, &cp) == VAR_OK ? cp : "Unknown Error", var_rc);
                         }
                         logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                         if (strlen(res_ptr) == 0) {
@@ -998,22 +998,20 @@
                     else {
                         /* expanding regex references into header value */
                         {
-                            var_rc_t var_rc;
                             char *res_ptr;
                             logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding regex references in header value '%s'", hrI->val);
                             if ((var_rc = var_expand(ctx->config_varregex, hrI->val, strlen(hrI->val), &res_ptr, NULL, FALSE)) != VAR_OK) {
-                                logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varregex, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+                                logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varregex, var_rc, &cp) == VAR_OK ? cp : "Unknown Error", var_rc);
                             }
                             logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                             cp = res_ptr;
                         }
                         /* expanding variables into header value */
                         if (hrI->val != NULL) {
-                            var_rc_t var_rc;
                             char *res_ptr;
                             logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding variables in header value '%s'", hrI->val);
                             if ((var_rc = var_expand(ctx->config_varctx, cp, strlen(cp), &res_ptr, NULL, FALSE)) != VAR_OK) {
-                                logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", cp, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+                                logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", cp, var_strerror(ctx->config_varctx, var_rc, &cp) == VAR_OK ? cp : "Unknown Error", var_rc);
                             }
                             logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                             if (strlen(res_ptr) == 0) {
@@ -1047,11 +1045,10 @@
             else {
                 /*FIXME clean up data.m */
                 /* expanding variables into header value */
-                var_rc_t var_rc;
                 char *res_ptr;
                 logbook(ctx->l2, L2_LEVEL_DEBUG, "expanding variables in header value '%s'", hrI->val);
                 if ((var_rc = var_expand(ctx->config_varctx, hrI->val, strlen(hrI->val), &res_ptr, NULL, FALSE)) != VAR_OK) {
-                    logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, rc, &cp) == VAR_OK ? cp : "Unknown Error", rc);
+                    logbook(ctx->l2, L2_LEVEL_ERROR, "expansion of '%s' failed: %s", hrI->val, var_strerror(ctx->config_varctx, var_rc, &cp) == VAR_OK ? cp : "Unknown Error", var_rc);
                 }
                 logbook(ctx->l2, L2_LEVEL_DEBUG, "expansion result '%s'", res_ptr);
                 if (strlen(res_ptr) == 0) {

CVSTrac 2.0.1