shithub: scc

Download patch

ref: 129e4ee9f30775a929e899d102b297e1cf494d76
parent: b780650286944308871d3fe28c98a41714cae927
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 23 18:10:30 EDT 2019

[libmach] Remove Objsymdef type

This type was only creating noise in the interface.

--- a/include/scc/scc/mach.h
+++ b/include/scc/scc/mach.h
@@ -1,6 +1,5 @@
 #define NR_SYMHASH 32
 
-typedef struct objsymdef Objsymdef;
 typedef struct objsec Objsec;
 typedef struct objsym Objsym;
 typedef struct objseg Objseg;
@@ -36,13 +35,6 @@
 	unsigned long long size;
 	unsigned long long value;
 	Objsym *next, *hash;
-};
-
-struct objsymdef {
-	char *name;
-	int type;
-	long offset;
-	Objsymdef *hash, *next;
 };
 
 struct objseg {
--- a/src/cmd/ranlib.c
+++ b/src/cmd/ranlib.c
@@ -16,12 +16,21 @@
 
 #define NR_SYMDEF 32
 
+typedef struct symdef Symdef;
+
+struct symdef {
+	char *name;
+	int type;
+	long offset;
+	Symdef *hash, *next;
+};
+
 static char *namidx;
 static long nsymbols;
 static int status, artype, nolib;
 static Objops *ops;
 static char *filename, *membname;
-static Objsymdef *htab[NR_SYMDEF], *head;
+static Symdef *htab[NR_SYMDEF], *head;
 static long offset;
 char *argv0;
 
@@ -47,11 +56,11 @@
 	status = EXIT_FAILURE;
 }
 
-Objsymdef *
+Symdef *
 lookup(char *name)
 {
 	unsigned h;
-	Objsymdef *dp;
+	Symdef *dp;
 	char *s;
 	size_t len;
 
@@ -87,7 +96,7 @@
 static int
 newsymbol(Objsym *sym)
 {
-	Objsymdef *np;
+	Symdef *np;
 
 	if (!isupper(sym->type) || sym->type == 'N')
 		return 1;
@@ -167,7 +176,7 @@
 static void
 freehash(void)
 {
-	Objsymdef **npp, *next, *np;
+	Symdef **npp, *next, *np;
 
 	for (npp = htab; npp < &htab[NR_SYMDEF]; npp++)
 		*npp = NULL;
@@ -272,7 +281,7 @@
 	long *offs, i;
 	char **names;
 	FILE *fp, *idx, *out;
-	Objsymdef *dp;
+	Symdef *dp;
 	struct fprop prop;
 
 	errno = 0;
--- a/src/libmach/coff32/coff32xsetidx.c
+++ b/src/libmach/coff32/coff32xsetidx.c
@@ -10,7 +10,6 @@
 {
 	long i, n;
 	size_t len;
-	Objsymdef *def;
 	unsigned char buff[4];
 
 	pack(order, buff, "l", nsyms);