Mercurial > hg > forks > dxa
comparison label.c @ 2:ec2f8f6f1dc9
Cleanup pass #1: Get rid of some ancient K&R-isms.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 24 Feb 2015 20:28:57 +0200 |
parents | cfcae2ef1c2b |
children | 0990d9322fc8 |
comparison
equal
deleted
inserted
replaced
1:cfcae2ef1c2b | 2:ec2f8f6f1dc9 |
---|---|
41 | 41 |
42 label *labeltable; | 42 label *labeltable; |
43 char defaultlabel[6]; | 43 char defaultlabel[6]; |
44 unsigned numLabels = 0; | 44 unsigned numLabels = 0; |
45 | 45 |
46 #ifndef __STDC__ | 46 |
47 void | |
48 AddLabel (address, name) | |
49 ADDR_T address; | |
50 char *name; | |
51 #else | |
52 void AddLabel (ADDR_T address, char *name) | 47 void AddLabel (ADDR_T address, char *name) |
53 #endif | |
54 { | 48 { |
55 label *entry; | 49 label *entry; |
56 char *buffer; | 50 char *buffer; |
57 | 51 |
58 if (!((buffer = malloc (strlen (name) + 1)))) | 52 if (!((buffer = malloc (strlen (name) + 1)))) |
70 entry->address = address; | 64 entry->address = address; |
71 entry->name = buffer; | 65 entry->name = buffer; |
72 while ((*buffer++ = *name++)); | 66 while ((*buffer++ = *name++)); |
73 } | 67 } |
74 | 68 |
75 #ifndef __STDC__ | 69 |
76 char * | |
77 Label (address, admode) | |
78 ADDR_T address; | |
79 int admode; | |
80 #else | |
81 char *Label (ADDR_T address, int admode) | 70 char *Label (ADDR_T address, int admode) |
82 #endif | |
83 { | 71 { |
84 label *entry; | 72 label *entry; |
85 | 73 |
86 if (!IsLabeled (address)) { | 74 if (!IsLabeled (address)) { |
87 | 75 |
101 sprintf (defaultlabel, "l%x", address); | 89 sprintf (defaultlabel, "l%x", address); |
102 | 90 |
103 return defaultlabel; | 91 return defaultlabel; |
104 } | 92 } |
105 | 93 |
106 #ifndef __STDC__ | 94 |
107 void | |
108 Collect () | |
109 #else | |
110 void Collect (void) | 95 void Collect (void) |
111 #endif | |
112 { | 96 { |
113 unsigned counter = 0; | 97 unsigned counter = 0; |
114 table *entry = NULL, *entry2; | 98 table *entry = NULL, *entry2; |
115 label *labels; | 99 label *labels; |
116 | 100 |