From cea9aff3efc0d2d5b3a48b5027136d02040868b4 Mon Sep 17 00:00:00 2001 From: cuz Date: Wed, 4 Jun 2003 15:40:32 +0000 Subject: [PATCH] More string pool use git-svn-id: svn://svn.cc65.org/cc65/trunk@2198 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/filetab.c | 80 +++++++++++++++++++------------------------- src/ca65/filetab.h | 6 ++-- src/ca65/spool.h | 10 ++++++ src/common/xmalloc.c | 28 ++++++++++------ src/ld65/config.c | 19 +++++++---- src/ld65/dbginfo.c | 14 ++++---- src/ld65/extsyms.c | 52 ++++++++++++++-------------- src/ld65/extsyms.h | 8 ++--- src/ld65/fileinfo.c | 4 +-- src/ld65/fileinfo.h | 2 +- src/ld65/o65.c | 25 +++++++------- src/ld65/o65.h | 14 ++++---- src/ld65/objdata.c | 2 +- 13 files changed, 139 insertions(+), 125 deletions(-) diff --git a/src/ca65/filetab.c b/src/ca65/filetab.c index 4e1d28c44..2ad8257c0 100644 --- a/src/ca65/filetab.c +++ b/src/ca65/filetab.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -37,13 +37,15 @@ /* common */ #include "check.h" +#include "coll.h" #include "hashstr.h" #include "xmalloc.h" /* ca65 */ #include "error.h" -#include "objfile.h" #include "filetab.h" +#include "objfile.h" +#include "spool.h" @@ -56,65 +58,46 @@ /* An entry in the file table */ typedef struct FileEntry FileEntry; struct FileEntry { + unsigned Name; /* File name */ FileEntry* Next; /* Next in hash list */ unsigned Index; /* Index of entry */ unsigned long Size; /* Size of file */ unsigned long MTime; /* Time of last modification */ - char Name[1]; /* Name, dynamically allocated */ }; /* Array of all entries, listed by index */ -static FileEntry** FileTab = 0; -static unsigned FileCount = 0; -static unsigned FileMax = 0; +static Collection FileTab = STATIC_COLLECTION_INITIALIZER; /* Hash table, hashed by name */ -#define HASHTAB_SIZE 31 +#define HASHTAB_MASK 0x1FU +#define HASHTAB_SIZE (HASHTAB_MASK + 1) static FileEntry* HashTab[HASHTAB_SIZE]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ -static FileEntry* NewFileEntry (const char* Name, unsigned long Size, unsigned long MTime) +static FileEntry* NewFileEntry (unsigned Name, unsigned long Size, unsigned long MTime) /* Create a new FileEntry, insert it into the tables and return it */ { - /* Get the length of the name */ - unsigned Len = strlen (Name); - /* Get the hash over the name */ - unsigned Hash = HashStr (Name) % HASHTAB_SIZE; + unsigned Hash = (Name & HASHTAB_MASK); /* Allocate memory for the entry */ - FileEntry* F = xmalloc (sizeof (FileEntry) + Len); + FileEntry* F = xmalloc (sizeof (FileEntry)); /* Initialize the fields */ - F->Index = FileCount+1; + F->Name = Name; + F->Index = CollCount (&FileTab) + 1; /* First file has index #1 */ F->Size = Size; F->MTime = MTime; - memcpy (F->Name, Name, Len+1); - - /* Count the entries and grow the file table if needed */ - if (FileCount >= FileMax) { - /* We need to grow the table. Create a new one. */ - unsigned NewFileMax = (FileMax == 0)? 32 : FileMax * 2; - FileEntry** NewFileTab = xmalloc (sizeof (FileEntry*) * NewFileMax); - - /* Copy the old entries */ - memcpy (NewFileTab, FileTab, sizeof (FileEntry*) * FileCount); - - /* Use the new table */ - xfree (FileTab); - FileTab = NewFileTab; - FileMax = NewFileMax; - } /* Insert the file into the file table */ - FileTab [FileCount++] = F; + CollAppend (&FileTab, F); /* Insert the entry into the hash table */ F->Next = HashTab[Hash]; @@ -129,21 +112,23 @@ static FileEntry* NewFileEntry (const char* Name, unsigned long Size, unsigned l const char* GetFileName (unsigned Name) /* Get the name of a file where the name index is known */ { - PRECONDITION (Name <= FileCount); + const FileEntry* F; + if (Name == 0) { /* Name was defined outside any file scope, use the name of the first * file instead. Errors are then reported with a file position of * line zero in the first file. */ - if (FileCount == 0) { + if (CollCount (&FileTab) == 0) { /* No files defined until now */ return "(outside file scope)"; } else { - return FileTab [0]->Name; + F = CollConstAt (&FileTab, 0); } } else { - return FileTab [Name-1]->Name; + F = CollConstAt (&FileTab, Name-1); } + return GetString (F->Name); } @@ -151,14 +136,17 @@ const char* GetFileName (unsigned Name) unsigned GetFileIndex (const char* Name) /* Return the file index for the given file name. */ { + /* Get the string pool index from the name */ + unsigned NameIdx = GetStringId (Name); + /* Get the hash over the name */ - unsigned Hash = HashStr (Name) % HASHTAB_SIZE; + unsigned Hash = (NameIdx & HASHTAB_MASK); /* Search the linear hash list */ FileEntry* F = HashTab[Hash]; while (F) { /* Is it this one? */ - if (strcmp (Name, F->Name) == 0) { + if (NameIdx == F->Name) { /* Found, return the index */ return F->Index; } @@ -179,7 +167,7 @@ unsigned AddFile (const char* Name, unsigned long Size, unsigned long MTime) */ { /* Create a new file entry and insert it into the tables */ - FileEntry* F = NewFileEntry (Name, Size, MTime); + FileEntry* F = NewFileEntry (GetStringId (Name), Size, MTime); /* Return the index */ return F->Index; @@ -196,16 +184,16 @@ void WriteFiles (void) ObjStartFiles (); /* Write the file count */ - ObjWriteVar (FileCount); + ObjWriteVar (CollCount (&FileTab)); /* Write the file data */ - for (I = 0; I < FileCount; ++I) { + for (I = 0; I < CollCount (&FileTab); ++I) { /* Get a pointer to the entry */ - FileEntry* F = FileTab[I]; + const FileEntry* F = CollConstAt (&FileTab, I); /* Write the fields */ + ObjWriteVar (F->Name); ObjWrite32 (F->MTime); ObjWrite32 (F->Size); - ObjWriteStr (F->Name); } /* Done writing files */ diff --git a/src/ca65/filetab.h b/src/ca65/filetab.h index 47d4f754d..85c008072 100644 --- a/src/ca65/filetab.h +++ b/src/ca65/filetab.h @@ -6,9 +6,9 @@ /* */ /* */ /* */ -/* (C) 2000 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ /* */ diff --git a/src/ca65/spool.h b/src/ca65/spool.h index 6cf9d18e4..ceec3662d 100644 --- a/src/ca65/spool.h +++ b/src/ca65/spool.h @@ -69,6 +69,16 @@ INLINE unsigned GetStringId (const char* S) # define GetStringId(S) SP_Add (&StrPool, (S)) #endif +#if defined(HAVE_INLINE) +INLINE const char* GetString (unsigned Index) +/* Convert a string index into a string */ +{ + return SP_Get (&StrPool, Index); +} +#else +# define GetString(Index) SP_Get (&StrPool, (Index)) +#endif + void WriteStrPool (void); /* Write the string pool to the object file */ diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c index 673f6e69d..2810a0b32 100644 --- a/src/common/xmalloc.c +++ b/src/common/xmalloc.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2000-2001 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 2000-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -35,7 +35,8 @@ #include #include - + +/* common */ #include "abend.h" #include "debugflag.h" #include "xmalloc.h" @@ -51,12 +52,19 @@ void* xmalloc (size_t Size) /* Allocate memory, check for out of memory condition. Do some debugging */ { - /* Allocate memory */ - void* P = malloc (Size); + void* P = 0; - /* Check for errors */ - if (P == 0 && Size != 0) { - AbEnd ("Out of memory - requested block size = %lu", (unsigned long) Size); + /* Allow zero sized requests and return NULL in this case */ + if (Size) { + + /* Allocate memory */ + P = malloc (Size); + + /* Check for errors */ + if (P == 0) { + AbEnd ("Out of memory - requested block size = %lu", + (unsigned long) Size); + } } /* Return a pointer to the block */ diff --git a/src/ld65/config.c b/src/ld65/config.c index 5a87fd03b..19f42f23f 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -834,6 +834,7 @@ static void ParseO65 (void) unsigned AttrFlags = atNone; /* Remember the attributes read */ + unsigned CfgSValId; unsigned OS = 0; /* Initialize to keep gcc happy */ unsigned Version = 0; @@ -857,19 +858,21 @@ static void ParseO65 (void) AttrFlags |= atExport; /* We expect an identifier */ CfgAssureIdent (); + /* Convert the string into a string index */ + CfgSValId = GetStringId (CfgSVal); /* Check if the export symbol is also defined as an import. */ - if (O65GetImport (O65FmtDesc, CfgSVal) != 0) { + if (O65GetImport (O65FmtDesc, CfgSValId) != 0) { CfgError ("Exported symbol `%s' cannot be an import", CfgSVal); } /* Check if we have this symbol defined already. The entry * routine will check this also, but we get a more verbose * error message when checking it here. */ - if (O65GetExport (O65FmtDesc, CfgSVal) != 0) { + if (O65GetExport (O65FmtDesc, CfgSValId) != 0) { CfgError ("Duplicate exported symbol: `%s'", CfgSVal); } /* Insert the symbol into the table */ - O65SetExport (O65FmtDesc, CfgSVal); + O65SetExport (O65FmtDesc, CfgSValId); break; case CFGTOK_IMPORT: @@ -877,19 +880,21 @@ static void ParseO65 (void) AttrFlags |= atImport; /* We expect an identifier */ CfgAssureIdent (); + /* Convert the string into a string index */ + CfgSValId = GetStringId (CfgSVal); /* Check if the imported symbol is also defined as an export. */ - if (O65GetExport (O65FmtDesc, CfgSVal) != 0) { + if (O65GetExport (O65FmtDesc, CfgSValId) != 0) { CfgError ("Imported symbol `%s' cannot be an export", CfgSVal); } /* Check if we have this symbol defined already. The entry * routine will check this also, but we get a more verbose * error message when checking it here. */ - if (O65GetImport (O65FmtDesc, CfgSVal) != 0) { + if (O65GetImport (O65FmtDesc, CfgSValId) != 0) { CfgError ("Duplicate imported symbol: `%s'", CfgSVal); } /* Insert the symbol into the table */ - O65SetImport (O65FmtDesc, CfgSVal); + O65SetImport (O65FmtDesc, CfgSValId); break; case CFGTOK_TYPE: @@ -987,7 +992,7 @@ static void ParseFormats (void) /* Map the identifier to a token */ cfgtok_t FormatTok; CfgSpecialToken (Formats, ENTRY_COUNT (Formats), "Format"); - FormatTok = CfgTok; + FormatTok = CfgTok; /* Skip the name and the following colon */ CfgNextTok (); diff --git a/src/ld65/dbginfo.c b/src/ld65/dbginfo.c index 8da698aeb..5218091a6 100644 --- a/src/ld65/dbginfo.c +++ b/src/ld65/dbginfo.c @@ -6,9 +6,9 @@ /* */ /* */ /* */ -/* (C) 2001 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ +/* (C) 2001-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ /* */ @@ -34,9 +34,10 @@ /* ld65 */ +#include "dbginfo.h" #include "fileinfo.h" #include "lineinfo.h" -#include "dbginfo.h" +#include "spool.h" @@ -54,7 +55,8 @@ void PrintDbgInfo (ObjData* O, FILE* F) /* Output the files section */ for (I = 0; I < O->FileCount; ++I) { const FileInfo* FI = O->Files[I]; - fprintf (F, "file\t\"%s\", %lu, %lu\n", FI->Name, FI->Size, FI->MTime); + fprintf (F, "file\t\"%s\", %lu, %lu\n", + GetString (FI->Name), FI->Size, FI->MTime); } /* Output the lines */ @@ -72,7 +74,7 @@ void PrintDbgInfo (ObjData* O, FILE* F) } /* Name and line number */ - fprintf (F, "line\t\"%s\", %lu", LI->File->Name, LI->Pos.Line); + fprintf (F, "line\t\"%s\", %lu", GetString (LI->File->Name), LI->Pos.Line); /* Code ranges */ for (J = 0; J < CollCount (CodeRanges); ++J) { diff --git a/src/ld65/extsyms.c b/src/ld65/extsyms.c index 68441eb41..68c16a9b4 100644 --- a/src/ld65/extsyms.c +++ b/src/ld65/extsyms.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1999-2001 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1999-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -42,6 +42,7 @@ /* ld65 */ #include "error.h" #include "extsyms.h" +#include "spool.h" @@ -53,20 +54,21 @@ /* Structure holding an external symbol */ struct ExtSym { + unsigned Name; /* Name index */ ExtSym* List; /* Next entry in list of all symbols */ ExtSym* Next; /* Next entry in hash list */ unsigned Flags; /* Generic flags */ unsigned Num; /* Number of external symbol */ - char Name [1]; /* Name - dynamically allocated */ }; /* External symbol table structure */ -#define HASHTAB_SIZE 53 +#define HASHTAB_MASK 0x3FU +#define HASHTAB_SIZE (HASHTAB_MASK + 1) struct ExtSymTab { ExtSym* Root; /* List of symbols */ - ExtSym* Last; /* Pointer to last symbol */ - unsigned Count; /* Number of symbols */ - ExtSym* HashTab [HASHTAB_SIZE]; + ExtSym* Last; /* Pointer to last symbol */ + unsigned Count; /* Number of symbols */ + ExtSym* HashTab[HASHTAB_SIZE]; }; @@ -77,30 +79,27 @@ struct ExtSymTab { -ExtSym* NewExtSym (ExtSymTab* Tab, const char* Name) +ExtSym* NewExtSym (ExtSymTab* Tab, unsigned Name) /* Create a new external symbol and insert it into the table */ { /* Get the hash value of the string */ - unsigned Hash = HashStr (Name) % HASHTAB_SIZE; - - /* Get the length of the name */ - unsigned Len = strlen (Name); + unsigned Hash = (Name & HASHTAB_MASK); /* Check for duplicates */ - ExtSym* E = GetExtSym (Tab, Name); /* Don't care about duplicate hash here... */ + ExtSym* E = GetExtSym (Tab, Name); if (E != 0) { /* We do already have a symbol with this name */ - Error ("Duplicate external symbol `%s'", Name); + Error ("Duplicate external symbol `%s'", GetString (Name)); } /* Allocate memory for the structure */ - E = xmalloc (sizeof (ExtSym) + Len); + E = xmalloc (sizeof (ExtSym)); /* Initialize the structure */ + E->Name = Name; E->List = 0; E->Flags = 0; E->Num = Tab->Count; - memcpy (E->Name, Name, Len+1); /* Insert the entry into the list of all symbols */ if (Tab->Last == 0) { @@ -114,8 +113,8 @@ ExtSym* NewExtSym (ExtSymTab* Tab, const char* Name) ++Tab->Count; /* Insert the symbol into the hash table */ - E->Next = Tab->HashTab [Hash]; - Tab->HashTab [Hash] = E; + E->Next = Tab->HashTab[Hash]; + Tab->HashTab[Hash] = E; /* Done, return the created entry */ return E; @@ -171,18 +170,18 @@ void FreeExtSymTab (ExtSymTab* Tab) -ExtSym* GetExtSym (const ExtSymTab* Tab, const char* Name) +ExtSym* GetExtSym (const ExtSymTab* Tab, unsigned Name) /* Return the entry for the external symbol with the given name. Return NULL * if there is no such symbol. */ { /* Hash the name */ - unsigned Hash = HashStr (Name) % HASHTAB_SIZE; + unsigned Hash = (Name & HASHTAB_MASK); /* Check the linked list */ - ExtSym* E = Tab->HashTab [Hash]; + ExtSym* E = Tab->HashTab[Hash]; while (E) { - if (strcmp (E->Name, Name) == 0) { + if (E->Name == Name) { /* Found it */ break; } @@ -221,8 +220,8 @@ unsigned ExtSymNum (const ExtSym* E) -const char* ExtSymName (const ExtSym* E) -/* Return the symbol name */ +unsigned ExtSymName (const ExtSym* E) +/* Return the symbol name index */ { return E->Name; } @@ -237,3 +236,4 @@ const ExtSym* ExtSymNext (const ExtSym* E) + diff --git a/src/ld65/extsyms.h b/src/ld65/extsyms.h index 56edf0224..74801e915 100644 --- a/src/ld65/extsyms.h +++ b/src/ld65/extsyms.h @@ -58,7 +58,7 @@ typedef struct ExtSymTab ExtSymTab; -ExtSym* NewExtSym (ExtSymTab* Tab, const char* Name); +ExtSym* NewExtSym (ExtSymTab* Tab, unsigned Name); /* Create a new external symbol and insert it into the list */ ExtSymTab* NewExtSymTab (void); @@ -67,7 +67,7 @@ ExtSymTab* NewExtSymTab (void); void FreeExtSymTab (ExtSymTab* Tab); /* Free an external symbol structure */ -ExtSym* GetExtSym (const ExtSymTab* Tab, const char* Name); +ExtSym* GetExtSym (const ExtSymTab* Tab, unsigned Name); /* Return the entry for the external symbol with the given name. Return NULL * if there is no such symbol. */ @@ -83,8 +83,8 @@ const ExtSym* ExtSymList (const ExtSymTab* Tab); unsigned ExtSymNum (const ExtSym* E); /* Return the number of an external symbol */ -const char* ExtSymName (const ExtSym* E); -/* Return the symbol name */ +unsigned ExtSymName (const ExtSym* E); +/* Return the symbol name index */ const ExtSym* ExtSymNext (const ExtSym* E); /* Return the next symbol in the list */ diff --git a/src/ld65/fileinfo.c b/src/ld65/fileinfo.c index 97dba6aa1..2aeb5284b 100644 --- a/src/ld65/fileinfo.c +++ b/src/ld65/fileinfo.c @@ -60,16 +60,16 @@ static FileInfo* NewFileInfo (void) -FileInfo* ReadFileInfo (FILE* F, ObjData* O attribute ((unused))) +FileInfo* ReadFileInfo (FILE* F, ObjData* O attribute ((unused))) /* Read a file info from a file and return it */ { /* Allocate a new FileInfo structure */ FileInfo* FI = NewFileInfo (); /* Read the fields from the file */ + FI->Name = ReadVar (F); FI->MTime = Read32 (F); FI->Size = Read32 (F); - FI->Name = ReadStr (F); /* Return the new struct */ return FI; diff --git a/src/ld65/fileinfo.h b/src/ld65/fileinfo.h index 162e95d44..4d2d423ba 100644 --- a/src/ld65/fileinfo.h +++ b/src/ld65/fileinfo.h @@ -57,9 +57,9 @@ typedef struct FileInfo FileInfo; struct FileInfo { + unsigned Name; /* File name index */ unsigned long MTime; /* Time of last modification */ unsigned long Size; /* Size of the file */ - char* Name; /* File name */ }; diff --git a/src/ld65/o65.c b/src/ld65/o65.c index 1a0c64544..f945cc1e2 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2003 Ullrich von Bassewitz */ +/* (C) 1999-2003 Ullrich von Bassewitz */ /* Römerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ @@ -316,7 +316,7 @@ static void O65ParseExpr (ExprNode* Expr, ExprDesc* D, int Sign) CircularRefError (E); } else if (E->Expr == 0) { /* Dummy export, must be an o65 imported symbol */ - ExtSym* S = O65GetImport (D->D, GetString (E->Name)); + ExtSym* S = O65GetImport (D->D, E->Name); CHECK (S != 0); if (D->ExtRef) { /* We cannot have more than one external reference in o65 */ @@ -820,7 +820,7 @@ static void O65WriteImports (O65Desc* D) S = ExtSymList (D->Imports); while (S) { /* Get the name */ - const char* Name = ExtSymName (S); + const char* Name = GetString (ExtSymName (S)); /* And write it to the output file */ WriteData (D->F, Name, strlen (Name) + 1); /* Next symbol */ @@ -863,13 +863,14 @@ static void O65WriteExports (O65Desc* D) ExprDesc ED; /* Get the name */ - const char* Name = ExtSymName (S); + unsigned NameIdx = ExtSymName (S); + const char* Name = GetString (NameIdx); /* Get the export for this symbol. We've checked before that this * export does really exist, so if it is unresolved, or if we don't * find it, there is an error in the linker code. */ - Export* E = FindExport (GetStringId (Name)); + Export* E = FindExport (NameIdx); if (E == 0 || IsUnresolvedExport (E)) { Internal ("Unresolved export `%s' found in O65WriteExports", Name); } @@ -1105,7 +1106,7 @@ void O65SetOS (O65Desc* D, unsigned OS, unsigned Version, unsigned Id) -ExtSym* O65GetImport (O65Desc* D, const char* Ident) +ExtSym* O65GetImport (O65Desc* D, unsigned Ident) /* Return the imported symbol or NULL if not found */ { /* Retrieve the symbol from the table */ @@ -1114,7 +1115,7 @@ ExtSym* O65GetImport (O65Desc* D, const char* Ident) -void O65SetImport (O65Desc* D, const char* Ident) +void O65SetImport (O65Desc* D, unsigned Ident) /* Set an imported identifier */ { /* Insert the entry into the table */ @@ -1123,7 +1124,7 @@ void O65SetImport (O65Desc* D, const char* Ident) -ExtSym* O65GetExport (O65Desc* D, const char* Ident) +ExtSym* O65GetExport (O65Desc* D, unsigned Ident) /* Return the exported symbol or NULL if not found */ { /* Retrieve the symbol from the table */ @@ -1132,15 +1133,15 @@ ExtSym* O65GetExport (O65Desc* D, const char* Ident) -void O65SetExport (O65Desc* D, const char* Ident) +void O65SetExport (O65Desc* D, unsigned Ident) /* Set an exported identifier */ { /* Get the export for this symbol and check if it does exist and is * a resolved symbol. */ - Export* E = FindExport (GetStringId (Ident)); + Export* E = FindExport (Ident); if (E == 0 || IsUnresolvedExport (E)) { - Error ("Unresolved export: `%s'", Ident); + Error ("Unresolved export: `%s'", GetString (Ident)); } /* Insert the entry into the table */ @@ -1229,7 +1230,7 @@ static int O65Unresolved (unsigned Name, void* D) /* Called if an unresolved symbol is encountered */ { /* Check if the symbol is an imported o65 symbol */ - if (O65GetImport (D, GetString (Name)) != 0) { + if (O65GetImport (D, Name) != 0) { /* This is an external symbol, relax... */ return 1; } else { diff --git a/src/ld65/o65.h b/src/ld65/o65.h index aaeb2aced..5115eabc6 100644 --- a/src/ld65/o65.h +++ b/src/ld65/o65.h @@ -6,9 +6,9 @@ /* */ /* */ /* */ -/* (C) 1999-2001 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ +/* (C) 1999-2003 Ullrich von Bassewitz */ +/* Römerstrasse 52 */ +/* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ /* */ /* */ @@ -101,16 +101,16 @@ void O65SetOption (O65Desc* D, unsigned Type, const void* Data, unsigned DataLen void O65SetOS (O65Desc* D, unsigned OS, unsigned Version, unsigned Id); /* Set an option describing the target operating system */ -ExtSym* O65GetImport (O65Desc* D, const char* Ident); +ExtSym* O65GetImport (O65Desc* D, unsigned Ident); /* Return the imported symbol or NULL if not found */ -void O65SetImport (O65Desc* D, const char* Ident); +void O65SetImport (O65Desc* D, unsigned Ident); /* Set an imported identifier */ -ExtSym* O65GetExport (O65Desc* D, const char* Ident); +ExtSym* O65GetExport (O65Desc* D, unsigned Ident); /* Return the exported symbol or NULL if not found */ -void O65SetExport (O65Desc* D, const char* Ident); +void O65SetExport (O65Desc* D, unsigned Ident); /* Set an exported identifier */ void O65WriteTarget (O65Desc* D, File* F); diff --git a/src/ld65/objdata.c b/src/ld65/objdata.c index 81320796d..484c5431f 100644 --- a/src/ld65/objdata.c +++ b/src/ld65/objdata.c @@ -175,7 +175,7 @@ const char* GetSourceFileName (const ObjData* O, unsigned Index) PRECONDITION (Index < O->FileCount); /* Return the name */ - return O->Files[Index]->Name; + return GetString (O->Files[Index]->Name); } } -- 2.39.5