From 0c5547d1fce8d03c8ea1836236aa6a6c5bf6e816 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 20 Nov 2013 03:27:34 +0200 Subject: [PATCH] fixes, start removing mscrt --- run_mkimpinc.sh | 14 ++++++++++++++ tools/asmproc.c | 22 ++++++++++------------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/run_mkimpinc.sh b/run_mkimpinc.sh index aac19eb..43d3362 100755 --- a/run_mkimpinc.sh +++ b/run_mkimpinc.sh @@ -14,5 +14,19 @@ echo "; '_' funcs" >> $3 cat $2 | \ while read a; do + case $a in + \#*) + continue + ;; + \;*) + continue + ;; + "") + continue + ;; + *) + ;; + esac + echo "EXTRN $a:PROC" >> $3 done diff --git a/tools/asmproc.c b/tools/asmproc.c index 3ff983b..e8e9efb 100644 --- a/tools/asmproc.c +++ b/tools/asmproc.c @@ -49,15 +49,15 @@ static int cmp_sym(const void *p1_, const void *p2_) int i; for (i = 0; ; i++) { + if ((s1[i] | s2[i]) == 0) + break; + if (s1[i] == s2[i]) continue; - if (s1[i] == 0) { - if (s2[i] == 0 || s2[i] == '@') - break; - } - - if (s2[i] == 0 || s1[i] == '@') + if (s1[i] == 0 && s2[i] == '@') + break; + if (s1[i] == '@' && s2[i] == 0) break; return s1[i] - s2[i]; @@ -87,11 +87,10 @@ void read_list(struct sl_item **sl_in, int *cnt, int *alloc, int c = *cnt; char line[256]; char word[256]; - char *r; while (fgets(line, sizeof(line), f) != NULL) { - r = next_word(word, sizeof(word), line); - if (r == word) + next_word(word, sizeof(word), line); + if (word[0] == 0 || word[0] == ';' || word[0] == '#') continue; sl[c].name = strdup(word); @@ -116,8 +115,7 @@ const char *sym_use(const struct sl_item *sym) static char buf[256+3]; int ret; - ret = snprintf(buf, sizeof(buf), "%s%s", - sym->callsites ? "" : "rm_", sym->name); + ret = snprintf(buf, sizeof(buf), "rm_%s", sym->name); if (ret >= sizeof(buf)) { printf("truncation detected: '%s'\n", buf); exit(1); @@ -154,7 +152,7 @@ int main(int argc, char *argv[]) my_assert_not(symlist, NULL); for (i = 3; i < argc; i++) { - if (!strcmp(argv[i], "-c")) { + if (strcmp(argv[i], "-c") == 0) { patch_callsites = 1; continue; } -- 2.39.5