shithub: mc

Download patch

ref: c71e69c0817c581bcbe0c321a8dec64433c553c7
parent: e93384f50f44d026b978b363eb107b14efeef3a1
author: Ori Bernstein <[email protected]>
date: Sun May 17 14:37:50 EDT 2015

Fix builds for libdate.

    Turns out we were merging things wrongly.

--- a/parse/parse.h
+++ b/parse/parse.h
@@ -621,8 +621,8 @@
 long rdint(FILE *fd);
 void wrstr(FILE *fd, char *val);
 char *rdstr(FILE *fd);
-void wrstrbuf(FILE *fd, Str str);
-void rdstrbuf(FILE *fd, Str *str);
+void wrlenstr(FILE *fd, Str str);
+void rdlenstr(FILE *fd, Str *str);
 void wrflt(FILE *fd, double val);
 double rdflt(FILE *fd);
 void wrbool(FILE *fd, int val);
--- a/parse/use.c
+++ b/parse/use.c
@@ -480,7 +480,7 @@
                 case Lchr:      wrint(fd, n->lit.chrval);       break;
                 case Lint:      wrint(fd, n->lit.intval);       break;
                 case Lflt:      wrflt(fd, n->lit.fltval);       break;
-                case Lstr:      wrstrbuf(fd, n->lit.strval);    break;
+                case Lstr:      wrlenstr(fd, n->lit.strval);    break;
                 case Llbl:      wrstr(fd, n->lit.lblval);       break;
                 case Lbool:     wrbool(fd, n->lit.boolval);     break;
                 case Lfunc:     pickle(fd, n->lit.fnval);       break;
@@ -611,7 +611,7 @@
                 case Lchr:      n->lit.chrval = rdint(fd);       break;
                 case Lint:      n->lit.intval = rdint(fd);       break;
                 case Lflt:      n->lit.fltval = rdflt(fd);       break;
-                case Lstr:      rdstrbuf(fd, &n->lit.strval);    break;
+                case Lstr:      rdlenstr(fd, &n->lit.strval);    break;
                 case Llbl:      n->lit.lblval = rdstr(fd);       break;
                 case Lbool:     n->lit.boolval = rdbool(fd);     break;
                 case Lfunc:     n->lit.fnval = unpickle(fd);     break;
@@ -851,6 +851,8 @@
             s = st;
         }
     }
+    if (!streq(st->name, pkg))
+        vis = Visintern;
     if (!s) {
         printf("could not find matching package for merge: %s in %s\n", st->name, path);
         exit(1);
@@ -897,6 +899,8 @@
                 if (ty->type == Tyname || ty->type == Tygeneric) {
                     if (ty->issynth)
                         break;
+                    if (!streq(s->name, ty->name->name.ns))
+                        ty->ishidden = 1;
                     if (!gettype(s, ty->name) && !ty->ishidden)
                         puttype(s, ty->name, ty);
                     if (!hthas(tydedup, ty))
@@ -952,7 +956,7 @@
         fatal(use, "Could not open %s", use->use.name);
 
     if (!loaduse(p, fd, st, vis))
-        die("Could not load usefile %s from %s", use->use.name);
+        die("Could not load usefile %s from %s", use->use.name, p);
     free(p);
 }
 
--- a/parse/util.c
+++ b/parse/util.c
@@ -316,13 +316,13 @@
     }
 }
 
-void wrstrbuf(FILE *fd, Str str)
+void wrlenstr(FILE *fd, Str str)
 {
     wrint(fd, str.len);
     wrbuf(fd, str.buf, str.len);
 }
 
-void rdstrbuf(FILE *fd, Str *str)
+void rdlenstr(FILE *fd, Str *str)
 {
     str->len = rdint(fd);
     str->buf = xalloc(str->len + 1);