setmap.c - 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 --- setmap.c (560B) --- 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 || !strcmp(sec->name, name)) 22 goto found; 23 } 24 25 if ((map = remap(map, map->n+1 )) == NULL) 26 return -1; 27 sec = &map->sec[map->n-1]; 28 29 found: 30 sec->name = name; 31 sec->fp = fp, 32 sec->begin = begin; 33 sec->end = end; 34 sec->offset = off; 35 return 0; 36 }