From c10fe7d3b14c78753f64e53f96d447a84a392213 Mon Sep 17 00:00:00 2001 From: Etienne Brateau <etienne.brateau@ensiie.fr> Date: Sat, 15 Dec 2018 23:40:42 +0100 Subject: [PATCH] Remove unnecessary functions --- log/include/log_action.h | 1 - log/include/settings.h | 2 -- log/include/utils.h | 1 - log/src/gate.c | 1 - log/src/log.c | 13 ------------- log/src/loged.c | 2 +- log/src/node.c | 1 - log/src/screen.c | 13 ------------- log/src/utils.c | 35 ++++++++++++++--------------------- log/src/wire.c | 4 ---- psys/include/p2c/p2c.h | 1 - psys/src/p2clib.c | 8 -------- 12 files changed, 15 insertions(+), 67 deletions(-) diff --git a/log/include/log_action.h b/log/include/log_action.h index 25259d1..11f417e 100644 --- a/log/include/log_action.h +++ b/log/include/log_action.h @@ -76,7 +76,6 @@ typedef struct log_hooks_t void (*report) (int num, char *name); void (*alert) (); void (*warning) (); - void (*working) (); void (*message) (char *msg); void (*vmessage) (char *msg); void (*vmessageflag) (char *msg, int b); diff --git a/log/include/settings.h b/log/include/settings.h index 39be2a9..f414c33 100644 --- a/log/include/settings.h +++ b/log/include/settings.h @@ -11,8 +11,6 @@ #define gridcen 25 /* Center of "grid" used while drawing gates */ -#define memtolerance 20000 /* Minimum "safe" amount of free memory */ - #define charheight 8 /* Height of text characters */ #define tapdelay 30 /* How long to wait before a "tap" becomes a "press" */ diff --git a/log/include/utils.h b/log/include/utils.h index 62d602f..27e06be 100644 --- a/log/include/utils.h +++ b/log/include/utils.h @@ -1,7 +1,6 @@ #ifndef UTILS_H #define UTILS_H -void working(); void readreal(char s_[], double *r); void stamp(long *i); void getword(char *buf, char *wrd); diff --git a/log/src/gate.c b/log/src/gate.c index 25db9b4..44a8402 100644 --- a/log/src/gate.c +++ b/log/src/gate.c @@ -599,7 +599,6 @@ int connectgate(log_grec *g) if (gg.traceflag) fprintf(tracefile, "Connect gate %ld, type %s\n", (long)g, g->kind->name); linkgate(&g); - working(); initpinpos(g); FORLIM = g->kind->numpins; for (i = 0; i < FORLIM; i++) diff --git a/log/src/log.c b/log/src/log.c index d0e7dda..8306da0 100644 --- a/log/src/log.c +++ b/log/src/log.c @@ -2419,7 +2419,6 @@ void garbagecoll() log_vwrec *vw; short i, pg, FORLIM, FORLIM1; - working(); n = gg.nbase; while (n != NULL) { @@ -2458,7 +2457,6 @@ void garbagecoll() gg.signaltab[i].np->ref++; } callsimtools(act_refnodes); - working(); purgesignaltab(); n = gg.nbase; while (n != NULL) @@ -5251,7 +5249,6 @@ static void moveobject() clipoff(); scroll(); } while (gg.t.depressed); - working(); gg.movinghw = NULL; gg.movingvw = NULL; remcursor(); @@ -6466,7 +6463,6 @@ static short readlibrary_at(char *n_, short where, int loadit) long FORLIM2; strcpy(n, n_); - working(); strcpy(n, strrtrim(strcpy(STR1, strltrim(n)))); found = false; count = 0; @@ -14092,13 +14088,6 @@ static void status_log() gg.actx = timers_sysclock(); } - if (memavail() != status_oldmem) - { - nk_gotoxy(23, 5); - printf("%ld", memavail()); - status_oldmem = memavail(); - } - if (gg.time != status_oldtime) { nk_gotoxy(23, 7); @@ -15636,7 +15625,6 @@ static void inithooks() gg.hook.report = report; gg.hook.alert = alert; gg.hook.warning = warning; - gg.hook.working = working; gg.hook.message = message; gg.hook.vmessage = vmessage; gg.hook.vmessageflag = vmessageflag; @@ -17011,7 +16999,6 @@ int main(int argc, char * argv[]) excpline = EXCP_LINE; if (P_escapecode == 20) { - working(); P_escapecode = -20; goto _Ltry40; } diff --git a/log/src/loged.c b/log/src/loged.c index 6ef74d8..9db9af6 100644 --- a/log/src/loged.c +++ b/log/src/loged.c @@ -6540,7 +6540,7 @@ static void memorycmd() nc_gotoXY(0, (int)(scrheight - 5)); TRY(try17); - printf("Memory available: %ld bytes.\n", memavail()); + printf("Memory available: %ld bytes.\n", 10000000L); RECOVER(try17); puts(_ShowEscape(STR2, P_escapecode, P_ioresult, "na_memavail")); ENDTRY(try17); diff --git a/log/src/node.c b/log/src/node.c index 9260113..4054bb7 100644 --- a/log/src/node.c +++ b/log/src/node.c @@ -408,7 +408,6 @@ void combinenodes(log_nrec **n2, log_nrec **n1, cnrec *cnbase) if (gg.traceflag) fprintf(tracefile, "Combine node %ld into %ld\n", (long)(*n1), (long)(*n2)); - working(); if (*n2 == NULL) switchnode(n2, *n1); nn1 = *n1; /*VAR params may change out from under us*/ diff --git a/log/src/screen.c b/log/src/screen.c index 3c06f22..3b42583 100644 --- a/log/src/screen.c +++ b/log/src/screen.c @@ -2105,7 +2105,6 @@ void refresh() refrpagedisp(); if (!gg.invisible && !gg.showconflicts) { - working(); suppressdots = gg.dotsvisible; g = gg.gbase[gg.curpage - 1]; while (g != NULL) @@ -2116,7 +2115,6 @@ void refresh() g = g->next; } suppressdots = false; - working(); if (gg.glowmode) { hw = gg.hwbase[gg.curpage - 1]; @@ -2130,7 +2128,6 @@ void refresh() } hw = hw->next; } - working(); vw = gg.vwbase[gg.curpage - 1]; while (vw != NULL) { @@ -2142,7 +2139,6 @@ void refresh() } vw = vw->next; } - working(); if (showsolder) { s = gg.sbase[gg.curpage - 1]; @@ -2171,7 +2167,6 @@ void refresh() } hw = hw->next; } - working(); vw = gg.vwbase[gg.curpage - 1]; while (vw != NULL) { @@ -2183,7 +2178,6 @@ void refresh() } vw = vw->next; } - working(); if (showsolder) { s = gg.sbase[gg.curpage - 1]; @@ -2212,7 +2206,6 @@ void refresh() } else { - working(); g = gg.gbase[gg.curpage - 1]; while (g != NULL) { @@ -2221,7 +2214,6 @@ void refresh() g = g->next; } } - working(); if (!gg.textinvisible) { b = gg.bbase[gg.curpage - 1]; @@ -2230,7 +2222,6 @@ void refresh() drawboxc(b, gg.color.dashbox); b = b->next; } - working(); l = gg.lbase[gg.curpage - 1]; m_color((long)gg.color.labeltext); while (l != NULL) @@ -2243,11 +2234,8 @@ void refresh() l = l->next; } } - working(); if (gg.markers) drawmarkersc(gg.color.marker); - if (memavail() < memtolerance) - message("Low on memory!"); clipoff(); restorecursor(); } @@ -2279,7 +2267,6 @@ void refrmenu() { short i, FORLIM; - working(); remcursor(); uerase(0, baseline + 2, across, down); clipoff(); diff --git a/log/src/utils.c b/log/src/utils.c index e8137d4..4309e07 100644 --- a/log/src/utils.c +++ b/log/src/utils.c @@ -7,24 +7,17 @@ #include "logglobals.h" #include "utils.h" -/** - * Reserved for future use. - */ -void working() -{ -} - void getword(char *buf, char *wrd) { - char *STR1; - char *STR2; + char *str1; + char *str2; - STR1 = malloc(strlen(buf) + 1); - STR2 = malloc(strlen(buf) + 1); - strcpy(STR1, strltrim(strrtrim(strcpy(STR2, buf)))); - strcpy(buf, STR1); - free(STR1); - free(STR2); + str1 = malloc(strlen(buf) + 1); + str2 = malloc(strlen(buf) + 1); + strcpy(str1, strltrim(strrtrim(strcpy(str2, buf)))); + strcpy(buf, str1); + free(str1); + free(str2); if (*buf == '"') strwordx(buf, wrd); @@ -99,16 +92,16 @@ void readreal(char *s_, double *r) { char s[256]; long i; - char *STR1; - char STR2[256]; + char *str1; + char str2[256]; strcpy(s, s_); if (!(*s != '\0' && (s[0] == '.' || s[0] == '+' || s[0] == '-' || isdigit(s[0])))) return; - *r = strtod(s, &STR1); - i = STR1 - s + 1; + *r = strtod(s, &str1); + i = str1 - s + 1; strcpy_overlap(s, s + i - 1); - strcpy(STR2, strltrim(s)); - strcpy(s, STR2); + strcpy(str2, strltrim(s)); + strcpy(s, str2); dounits(s, r); } diff --git a/log/src/wire.c b/log/src/wire.c index 3ed485c..79598b7 100644 --- a/log/src/wire.c +++ b/log/src/wire.c @@ -492,7 +492,6 @@ void delhwire(log_hwrec *hw) if (gg.traceflag) fprintf(tracefile, "Delete hwire %ld\n", (long)hw); - working(); clipon(); m_color((long)gg.color.backgr); hline(hw->x1, hw->x2, hw->y); @@ -586,7 +585,6 @@ void delvwire(log_vwrec *vw) if (gg.traceflag) fprintf(tracefile, "Delete vwire %ld\n", (long)vw); - working(); clipon(); m_color((long)gg.color.backgr); vline(vw->x, vw->y1, vw->y2); @@ -699,7 +697,6 @@ void addhwire(short x1, short x2, short y, short colr) sortshints(&x1, &x2); cnbase = NULL; remcursor(); - working(); clipon(); if (!vlsi) colr = log_wcol_normal; @@ -843,7 +840,6 @@ void addvwire(short x, short y1, short y2, short colr) sortshints(&y1, &y2); cnbase = NULL; remcursor(); - working(); clipon(); if (!vlsi) colr = log_wcol_normal; diff --git a/psys/include/p2c/p2c.h b/psys/include/p2c/p2c.h index 8d9fb36..4c17954 100644 --- a/psys/include/p2c/p2c.h +++ b/psys/include/p2c/p2c.h @@ -102,7 +102,6 @@ extern size_t strpos2 (char *, char *, size_t); extern void strmove (size_t len, char * s, size_t spos, char * d, size_t dpos); extern int strcicmp (char * s1, char * s2); -extern long memavail () DEPRECATED; extern char P_peek (FILE *); extern int P_eof (FILE *); extern int P_eoln (FILE *); diff --git a/psys/src/p2clib.c b/psys/src/p2clib.c index 7715e5c..a009c4b 100644 --- a/psys/src/p2clib.c +++ b/psys/src/p2clib.c @@ -399,14 +399,6 @@ char *P_trimname(char *fn, size_t len) return fnbuf; } -/* Pascal's "memavail" doesn't make much sense in Unix with virtual memory. - We fix memory size as 10Meg as a reasonable compromise. */ - -long memavail() -{ - return 10000000; /* worry about this later! */ -} - /* Sets are stored as an array of longs. S[0] is the size of the set; S[N] is the N'th 32-bit chunk of the set. S[0] equals the maximum I such that S[I] is nonzero. S[0] is zero for an empty set. Within -- GitLab