]> git.pond.sub.org Git - empserver/commitdiff
SAVE_FINISH_PATHS hasn't been used since 4.2.2, remove it
authorMarkus Armbruster <armbru@pond.sub.org>
Fri, 18 Feb 2011 17:53:37 +0000 (18:53 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 11 Apr 2011 20:29:12 +0000 (22:29 +0200)
Since 4.2.2, assemble_dist_paths() stores a dummy path instead of the
real path to the dist center.  That's possible because distribution
doesn't actually use the path, only whether it exists.

The code to store and free the real path is still around, under #ifdef
SAVE_FINISH_PATHS.  Remove it.

src/lib/update/finish.c

index 7284097845817036a6c3733d34ade06743c91b33..7b458bb113c7bb4eb18da1b8f7f36354cb99ff72 100644 (file)
@@ -53,16 +53,7 @@ struct distinfo {
  * of course :) ) We do clear it each and every time. */
 static struct distinfo *g_distptrs;
 
  * of course :) ) We do clear it each and every time. */
 static struct distinfo *g_distptrs;
 
-/* Note that even though we malloc and save the path, it is never
- * used.  Thus, this option.  If you want to malloc and save every
- * path and then free when done, just enable this.  Or, if the
- * dodistribute ever uses the path for something other than checking
- * to see that a path exists, enable this */
-/* #define SAVE_FINISH_PATHS */
-
-#ifndef SAVE_FINISH_PATHS
 static char *finish_path = "h";        /* Placeholder indicating path exists */
 static char *finish_path = "h";        /* Placeholder indicating path exists */
-#endif /* SAVE_FINISH_PATHS */
 
 static void assemble_dist_paths(struct distinfo *distptrs);
 static char *ReversePath(char *path);
 
 static void assemble_dist_paths(struct distinfo *distptrs);
 static char *ReversePath(char *path);
@@ -139,33 +130,17 @@ finish_sects(int etu)
     }
     logerror("done exporting\n");
 
     }
     logerror("done exporting\n");
 
-    /* Note that we free the paths (if allocated) as we loop here */
     logerror("importing...");
     for (n = 0; NULL != (sp = getsectid(n)); n++) {
        /* Get the pointer (we do it first so we can free if needed) */
        infptr = &g_distptrs[sp->sct_uid];
     logerror("importing...");
     for (n = 0; NULL != (sp = getsectid(n)); n++) {
        /* Get the pointer (we do it first so we can free if needed) */
        infptr = &g_distptrs[sp->sct_uid];
-       if (sp->sct_type == SCT_WATER || sp->sct_own == 0) {
-#ifdef SAVE_FINISH_PATHS
-           if (infptr->path)
-               free(infptr->path);
-#endif /* SAVE_FINISH_PATHS */
+       if (sp->sct_type == SCT_WATER || sp->sct_own == 0)
            continue;
            continue;
-       }
        np = getnatp(sp->sct_own);
        np = getnatp(sp->sct_own);
-       if (np->nat_money < 0) {
-#ifdef SAVE_FINISH_PATHS
-           if (infptr->path)
-               free(infptr->path);
-#endif /* SAVE_FINISH_PATHS */
+       if (np->nat_money < 0)
            continue;
            continue;
-       }
        dodistribute(sp, IMPORT,
                     infptr->path, infptr->imcost, infptr->excost);
        dodistribute(sp, IMPORT,
                     infptr->path, infptr->imcost, infptr->excost);
-#ifdef SAVE_FINISH_PATHS
-       if (infptr->path)
-           free(infptr->path);
-#endif /* SAVE_FINISH_PATHS */
-
        sp->sct_off = 0;
     }
     logerror("done importing\n");
        sp->sct_off = 0;
     }
     logerror("done importing\n");
@@ -203,16 +178,6 @@ assemble_dist_paths(struct distinfo *distptrs)
 
        /* Now, we have a path */
        if (path != NULL) {
 
        /* Now, we have a path */
        if (path != NULL) {
-#ifdef SAVE_FINISH_PATHS
-           int len;
-           /* Here we malloc a buffer and save it */
-           len = strlen(path);
-           infptr->path = malloc(len);
-           if (infptr->path == NULL) {
-               logerror("malloc failed in assemble_dist_path!\n");
-               return;
-           }
-#endif /* SAVE_FINISH_PATHS */
            /* Save the import cost */
            infptr->imcost = d;
            /* Now, reverse the path */
            /* Save the import cost */
            infptr->imcost = d;
            /* Now, reverse the path */
@@ -220,11 +185,7 @@ assemble_dist_paths(struct distinfo *distptrs)
            /* And walk the path back to the dist center to get the export
               cost */
            infptr->excost = pathcost(sp, p, MOB_MOVE);
            /* And walk the path back to the dist center to get the export
               cost */
            infptr->excost = pathcost(sp, p, MOB_MOVE);
-#ifdef SAVE_FINISH_PATHS
-           memcpy(infptr->path, p, len);
-#else
            infptr->path = finish_path;
            infptr->path = finish_path;
-#endif /* SAVE_FINISH_PATHS */
        }
     }
 }
        }
     }
 }