commit 6bbca83d59e09b38fbcce458581616d8ec92789e
parent b78e49f2a0bb8bc975ed436410ecca6b7abd819d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 18 Jan 2025 20:28:28 +0100
libmach: Rename coff32name() to coff32str()
There was a elf function called elf64str(), so it makes more sense
to accomodate the new coff function to have a similar name to the
one used in elf.
Diffstat:
6 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/include/bits/scc/coff32.h b/include/bits/scc/coff32.h
@@ -66,7 +66,7 @@ extern Section *coff32getsec(Obj *, int *, Section *);
extern Section *coff32setsec(Obj *, int *, Section *);
extern Map *coff32loadmap(Obj *, FILE *);
-extern char *coff32name(Coff32 *, void *);
+extern char *coff32str(Coff32 *, void *);
/* globals */
diff --git a/src/libmach/coff32/Makefile b/src/libmach/coff32/Makefile
@@ -11,7 +11,6 @@ OBJS =\
coff32getsec.o\
coff32getsym.o\
coff32loadmap.o\
- coff32name.o\
coff32new.o\
coff32pc2line.o\
coff32probe.o\
@@ -19,6 +18,7 @@ OBJS =\
coff32setidx.o\
coff32setsec.o\
coff32setsym.o\
+ coff32str.o\
coff32strip.o\
coff32type.o\
coff32write.o\
diff --git a/src/libmach/coff32/coff32getsec.c b/src/libmach/coff32/coff32getsec.c
@@ -79,7 +79,7 @@ coff32getsec(Obj *obj, int *idx, Section *sec)
break;
}
- sec->name = coff32name(coff, scn);
+ sec->name = coff32str(coff, scn);
sec->index = n;
sec->size = scn->s_size;
sec->base = scn->s_vaddr;
diff --git a/src/libmach/coff32/coff32getsym.c b/src/libmach/coff32/coff32getsym.c
@@ -71,7 +71,7 @@ coff32getsym(Obj *obj, int *idx, Symbol *sym)
return NULL;
ent = &ep->u.sym;
- sym->name = coff32name(coff, ent);
+ sym->name = coff32str(coff, ent);
sym->type = typeof(coff, ent);
sym->stype = SYMOBJECT;
sym->value = ent->n_value;
diff --git a/src/libmach/coff32/coff32name.c b/src/libmach/coff32/coff32name.c
@@ -1,24 +0,0 @@
-#include <stdio.h>
-
-#include <scc/mach.h>
-#include <scc/coff32.h>
-
-#define NAMELEN 8
-
-union name {
- char name[NAMELEN]; /* name */
- struct {
- long zeroes; /* if name[0-3] == 0 */
- long offset; /* offset into string table */
- } s;
-};
-
-char *
-coff32name(Coff32 *coff, void *hdr)
-{
- union name *p = hdr;
-
- if (p->s.zeroes != 0)
- return p->name;
- return &coff->strtbl[p->s.offset];
-}
diff --git a/src/libmach/coff32/coff32str.c b/src/libmach/coff32/coff32str.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+
+#include <scc/mach.h>
+#include <scc/coff32.h>
+
+#define NAMELEN 8
+
+union name {
+ char name[NAMELEN]; /* name */
+ struct {
+ long zeroes; /* if name[0-3] == 0 */
+ long offset; /* offset into string table */
+ } s;
+};
+
+char *
+coff32str(Coff32 *coff, void *hdr)
+{
+ union name *p = hdr;
+
+ if (p->s.zeroes != 0)
+ return p->name;
+ return &coff->strtbl[p->s.offset];
+}