- /* Free the old name and set a new one */
- xfree (SegmentNames [Seg]);
- SegmentNames [Seg] = xstrdup (Name);
+ SS_Set (&SegmentNames[Seg], Name);
+}
+
+
+
+void PushSegName (segment_t Seg, const char* Name)
+/* Push the current segment name and set a new name for a segment */
+{
+ if (SS_IsFull (&SegmentNames[Seg])) {
+ Error ("Segment name stack overflow");
+ } else {
+ SS_Push (&SegmentNames[Seg], Name);
+ }
+}
+
+
+
+void PopSegName (segment_t Seg)
+/* Restore a segment name from the segment name stack */
+{
+ if (SS_GetCount (&SegmentNames[Seg]) < 2) {
+ Error ("Segment name stack is empty");
+ } else {
+ SS_Drop (&SegmentNames[Seg]);
+ }
+}
+
+
+
+const char* GetSegName (segment_t Seg)
+/* Get the name of the given segment */
+{
+ return SS_Get (&SegmentNames[Seg]);