scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

setmap.c (453B)


      1 #include <stdio.h>
      2 #include <string.h>
      3 
      4 #include <scc/mach.h>
      5 
      6 #include "libmach.h"
      7 
      8 int
      9 setmap(Map *map,
     10        char *name,
     11        FILE *fp,
     12        unsigned long long begin,
     13        unsigned long long end,
     14        long off)
     15 {
     16 	int n;
     17 	Mapsec *sec;
     18 
     19 	n = map->n;
     20 	for (sec = map->sec; n--; sec++) {
     21 		if (!sec->name) {
     22 			sec->name = name;
     23 			sec->fp = fp,
     24 			sec->begin = begin;
     25 			sec->end = end;
     26 			sec->offset = off;
     27 			return 0;
     28 		}
     29 	}
     30 
     31 	return -1;
     32 }