libmach: Remove FILE parameter from newmap - scc - simple c99 compiler
 (HTM) git clone git://git.simple-cc.org/scc
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 9fca757b99d81dd58763d1c2f5c59ab435923aa6
 (DIR) parent e163c88706af4d3f68c6f6b04d4980bc14f8f65c
 (HTM) Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
       Date:   Wed, 14 Feb 2024 19:32:34 +0100
       
       libmach: Remove FILE parameter from newmap
       
       This parameter was always overwritten by a later call to
       setmap(), so it didn't take to much sense to pass the
       parameter here.
       
       Diffstat:
         M include/scc/scc/mach.h              |       3 ++-
         M src/libmach/coff32/coff32loadmap.c  |       2 +-
         M src/libmach/newmap.c                |       4 +---
       
       3 files changed, 4 insertions(+), 5 deletions(-)
       ---
 (DIR) diff --git a/include/scc/scc/mach.h b/include/scc/scc/mach.h
       @@ -100,7 +100,6 @@ extern int readobj(Obj *, FILE *);
        extern int writeobj(Obj *, Map *, FILE *);
        
        extern Map *loadmap(Obj *, FILE *);
       -extern Map *newmap(int , FILE *);
        
        extern int setmap(Map *,
                          char *,
       @@ -114,6 +113,8 @@ extern int getindex(int, long *, char ***, long **, FILE *);
        
        #endif
        
       +extern Map *newmap(int);
       +
        extern Obj *newobj(int);
        extern void delobj(Obj *);
        
 (DIR) diff --git a/src/libmach/coff32/coff32loadmap.c b/src/libmach/coff32/coff32loadmap.c
       @@ -16,7 +16,7 @@ coff32loadmap(Obj *obj, FILE *fp)
                FILHDR *hdr = &coff->hdr;
        
                nsec = hdr->f_nscns;
       -        if ((map = newmap(nsec, fp)) == NULL)
       +        if ((map = newmap(nsec)) == NULL)
                        return NULL;
        
                for (scn = coff->scns; nsec--; ++scn) {
 (DIR) diff --git a/src/libmach/newmap.c b/src/libmach/newmap.c
       @@ -9,7 +9,7 @@
        #include "libmach.h"
        
        Map *
       -newmap(int n, FILE *fp)
       +newmap(int n)
        {
                size_t vsiz;
                struct mapsec *p;
       @@ -28,8 +28,6 @@ newmap(int n, FILE *fp)
                map->n = n;
                memset(map->sec, 0, vsiz);
        
       -        for (p = map->sec; n--; ++p)
       -                p->fp = fp;
                return map;
        
        out_range: