#include <string.h>
#include <errno.h>
+#include "../common/xmalloc.h"
+
#include "global.h"
#include "error.h"
-#include "mem.h"
#include "fileio.h"
#include "segments.h"
#include "exports.h"
/* Create a new binary format descriptor */
{
/* Allocate memory for a new BinDesc struct */
- BinDesc* D = Xmalloc (sizeof (BinDesc));
+ BinDesc* D = xmalloc (sizeof (BinDesc));
/* Initialize the fields */
D->Undef = 0;
void FreeBinDesc (BinDesc* D)
/* Free a binary format descriptor */
{
- Xfree (D);
-}
+ xfree (D);
+}
#include <errno.h>
#include "../common/bitops.h"
+#include "../common/xmalloc.h"
#include "error.h"
-#include "mem.h"
#include "global.h"
#include "bin.h"
#include "o65.h"
unsigned Len = strlen (Name);
/* Allocate memory */
- File* F = Xmalloc (sizeof (File) + Len);
+ File* F = xmalloc (sizeof (File) + Len);
/* Initialize the fields */
F->Flags = 0;
}
/* Allocate memory */
- M = Xmalloc (sizeof (Memory) + Len);
+ M = xmalloc (sizeof (Memory) + Len);
/* Initialize the fields */
M->Next = 0;
}
/* Allocate memory */
- S = Xmalloc (sizeof (SegDesc) + Len);
+ S = xmalloc (sizeof (SegDesc) + Len);
/* Initialize the fields */
S->Next = 0;
static void FreeSegDesc (SegDesc* S)
/* Free a segment descriptor */
{
- Xfree (S);
+ xfree (S);
}
/* Insert the segment descriptor into the memory area list */
{
/* Create a new node for the entry */
- MemListNode* N = Xmalloc (sizeof (MemListNode));
+ MemListNode* N = xmalloc (sizeof (MemListNode));
N->Seg = S;
N->Next = 0;
#include <string.h>
#include "../common/symdefs.h"
+#include "../common/xmalloc.h"
#include "global.h"
-#include "mem.h"
#include "error.h"
#include "fileio.h"
#include "objdata.h"
unsigned Len = strlen (Name);
/* Allocate memory */
- DbgSym* D = Xmalloc (sizeof (DbgSym) + Len);
+ DbgSym* D = xmalloc (sizeof (DbgSym) + Len);
/* Initialize the fields */
D->Next = 0;
#include "../common/symdefs.h"
#include "../common/hashstr.h"
+#include "../common/xmalloc.h"
#include "global.h"
-#include "mem.h"
#include "error.h"
#include "fileio.h"
#include "objdata.h"
/* Create a new import and initialize it */
{
/* Allocate memory */
- Import* I = Xmalloc (sizeof (Import));
+ Import* I = xmalloc (sizeof (Import));
/* Initialize the fields */
I->Next = 0;
}
/* Now free the name since it's no longer needed */
- Xfree (Name);
+ xfree (Name);
}
unsigned Len = strlen (Name);
/* Allocate memory */
- Export* E = Xmalloc (sizeof (Export) + Len);
+ Export* E = xmalloc (sizeof (Export) + Len);
/* Initialize the fields */
E->Next = 0;
HashTab [HashVal] = E;
}
ImpOpen -= E->ImpCount; /* Decrease open imports now */
- Xfree (L);
+ xfree (L);
/* We must run through the import list and change the
* export pointer now.
*/
/* Allocate memory */
if (ExpPool) {
- Xfree (ExpPool);
+ xfree (ExpPool);
}
- ExpPool = Xmalloc (ExpCount * sizeof (Export*));
+ ExpPool = xmalloc (ExpCount * sizeof (Export*));
/* Walk through the list and insert the exports */
for (I = 0, J = 0; I < sizeof (HashTab) / sizeof (HashTab [0]); ++I) {
#include "../common/exprdefs.h"
+#include "../common/xmalloc.h"
#include "global.h"
#include "error.h"
-#include "mem.h"
#include "fileio.h"
#include "segments.h"
#include "expr.h"
/* Create a new expression node */
{
/* Allocate fresh memory */
- ExprNode* N = Xmalloc (sizeof (ExprNode));
+ ExprNode* N = xmalloc (sizeof (ExprNode));
N->Op = EXPR_NULL;
N->Left = 0;
N->Right = 0;
/* Free a node */
{
/* Free the memory */
- Xfree (E);
+ xfree (E);
}
#include <string.h>
#include "../common/hashstr.h"
+#include "../common/xmalloc.h"
-#include "mem.h"
#include "error.h"
#include "extsyms.h"
ExtSym* E = GetExtSym (Tab, Name); /* Don't care about duplicate hash here... */
if (E != 0) {
/* We do already have a symbol with this name */
- Error ("Duplicate external symbol `%s'", Name);
+ Error ("Duplicate external symbol `%s'", Name);
}
/* Allocate memory for the structure */
- E = Xmalloc (sizeof (ExtSym) + Len);
+ E = xmalloc (sizeof (ExtSym) + Len);
/* Initialize the structure */
E->List = 0;
/* Insert the entry into the list of all symbols */
if (Tab->Last == 0) {
- /* List is empty */
- Tab->Root = E;
+ /* List is empty */
+ Tab->Root = E;
} else {
- /* List not empty */
+ /* List not empty */
Tab->Last->List = E;
}
Tab->Last = E;
}
-
+
static void FreeExtSym (ExtSym* E)
/* Free an external symbol structure. Will not unlink the entry, so internal
* use only.
*/
{
- Xfree (E);
+ xfree (E);
}
unsigned I;
/* Allocate memory */
- ExtSymTab* Tab = Xmalloc (sizeof (ExtSymTab));
+ ExtSymTab* Tab = xmalloc (sizeof (ExtSymTab));
/* Initialize the fields */
Tab->Root = 0;
Tab->Last = 0;
Tab->Count = 0;
for (I = 0; I < HASHTAB_SIZE; ++I) {
- Tab->HashTab [I] = 0;
+ Tab->HashTab [I] = 0;
}
/* Done, return the hash table */
{
/* Free all entries */
while (Tab->Root) {
- ExtSym* E = Tab->Root;
- Tab->Root = E->Next;
- FreeExtSym (E);
+ ExtSym* E = Tab->Root;
+ Tab->Root = E->Next;
+ FreeExtSym (E);
}
/* Free the struct itself */
- Xfree (Tab);
+ xfree (Tab);
}
#include <string.h>
+#include "../common/xmalloc.h"
+
#include "error.h"
-#include "mem.h"
#include "fileio.h"
unsigned Len = Read8 (F);
/* Allocate memory */
- char* Str = Xmalloc (Len + 1);
+ char* Str = xmalloc (Len + 1);
/* Read the string itself */
ReadData (F, Str, Len);
+
-const char* ProgName = "ld65"; /* Program name */
-
const char* OutputName = "a.out"; /* Name of output file */
unsigned long StartAddr = 0x200; /* Start address */
-extern const char* ProgName; /* Program name */
-
extern const char* OutputName; /* Name of output file */
extern unsigned long StartAddr; /* Start address */
#include <string.h>
#include <errno.h>
-#include "../common/objdefs.h"
-#include "../common/libdefs.h"
-#include "../common/symdefs.h"
#include "../common/exprdefs.h"
#include "../common/filepos.h"
+#include "../common/libdefs.h"
+#include "../common/objdefs.h"
+#include "../common/symdefs.h"
+#include "../common/xmalloc.h"
-#include "mem.h"
#include "error.h"
+#include "exports.h"
#include "fileio.h"
#include "objdata.h"
#include "objfile.h"
-#include "exports.h"
#include "library.h"
O->Header.ExportOffs = Read32 (Lib);
O->Header.ExportSize = Read32 (Lib);
O->Header.DbgSymOffs = Read32 (Lib);
- O->Header.DbgSymSize = Read32 (Lib);
+ O->Header.DbgSymSize = Read32 (Lib);
}
/* Skip the export size, then read the exports */
Read16 (Lib);
O->ExportCount = Read16 (Lib);
- O->Exports = Xmalloc (O->ExportCount * sizeof (Export*));
+ O->Exports = xmalloc (O->ExportCount * sizeof (Export*));
for (I = 0; I < O->ExportCount; ++I) {
O->Exports [I] = ReadExport (Lib, O);
}
/* Skip the import size, then read the imports */
Read16 (Lib);
O->ImportCount = Read16 (Lib);
- O->Imports = Xmalloc (O->ImportCount * sizeof (Import*));
+ O->Imports = xmalloc (O->ImportCount * sizeof (Import*));
for (I = 0; I < O->ImportCount; ++I) {
O->Imports [I] = ReadImport (Lib, O);
}
/* Read the object file count and allocate memory */
ModuleCount = Read16 (Lib);
- Index = Xmalloc (ModuleCount * sizeof (ObjData*));
+ Index = xmalloc (ModuleCount * sizeof (ObjData*));
/* Read all entries in the index */
for (I = 0; I < ModuleCount; ++I) {
/* Store the parameters, so they're visible for other routines */
Lib = F;
- LibName = StrDup (Name);
+ LibName = xstrdup (Name);
/* Read the remaining header fields (magic is already read) */
Header.Magic = LIB_MAGIC;
/* Done. Close the file, release allocated memory */
fclose (F);
- Xfree (Index);
+ xfree (Index);
Lib = 0;
LibName = 0;
ModuleCount = 0;
#include <string.h>
#include <errno.h>
+#include "../common/cmdline.h"
#include "../common/libdefs.h"
#include "../common/objdefs.h"
#include "../common/version.h"
+#include "../common/xmalloc.h"
#include "global.h"
#include "error.h"
-#include "mem.h"
#include "target.h"
#include "fileio.h"
#include "scanner.h"
{
fprintf (stderr,
"Usage: %s [options] module ...\n"
- "Options are:\n"
- "\t-m name\t\tCreate a map file\n"
- "\t-o name\t\tName the default output file\n"
- "\t-t type\t\tType of target system\n"
- "\t-v\t\tVerbose mode\n"
- "\t-vm\t\tVerbose map file\n"
- "\t-C name\t\tUse linker config file\n"
- "\t-Ln name\tCreate a VICE label file\n"
- "\t-Lp\t\tMark write protected segments as such (VICE)\n"
- "\t-S addr\t\tSet the default start address\n"
- "\t-V\t\tPrint linker version\n",
+ "Short options:\n"
+ " -h\t\t\tHelp (this text)\n"
+ " -m name\t\tCreate a map file\n"
+ " -o name\t\tName the default output file\n"
+ " -t type\t\tType of target system\n"
+ " -v\t\t\tVerbose mode\n"
+ " -vm\t\t\tVerbose map file\n"
+ " -C name\t\tUse linker config file\n"
+ " -Ln name\t\tCreate a VICE label file\n"
+ " -Lp\t\t\tMark write protected segments as such (VICE)\n"
+ " -S addr\t\tSet the default start address\n"
+ " -V\t\t\tPrint the linker version\n"
+ "\n"
+ "Long options:\n"
+ " --help\t\tHelp (this text)\n"
+ " --version\t\tPrint the linker version\n",
ProgName);
- exit (EXIT_FAILURE);
-}
-
-
-
-static void UnknownOption (const char* Arg)
-/* Print an error about an unknown option. Print usage information and exit */
-{
- fprintf (stderr, "Unknown option: %s\n", Arg);
- Usage ();
-}
-
-
-
-static void InvNumber (const char* Arg)
-/* Print an error about an unknown option. Print usage information and exit */
-{
- fprintf (stderr, "Invalid number given in argument: %s\n", Arg);
- Usage ();
}
*/
{
unsigned long Val;
+ int Converted;
/* Convert */
if (*Number == '$') {
++Number;
- if (sscanf (Number, "%lx", &Val) != 1) {
- InvNumber (Arg);
- }
+ Converted = sscanf (Number, "%lx", &Val);
} else {
- if (sscanf (Number, "%li", (long*)&Val) != 1) {
- InvNumber (Arg);
- }
+ Converted = sscanf (Number, "%li", (long*)&Val);
}
- /* Return the result */
- return Val;
-}
-
-
-
-static const char* GetArg (int* ArgNum, char* argv [], unsigned Len)
-/* Get an option argument */
-{
- const char* Arg = argv [*ArgNum];
- if (Arg [Len] != '\0') {
- /* Argument appended */
- return Arg + Len;
- } else {
- /* Separate argument */
- Arg = argv [*ArgNum + 1];
- if (Arg == 0) {
- /* End of arguments */
- fprintf (stderr, "Option requires an argument: %s\n", argv [*ArgNum]);
- exit (EXIT_FAILURE);
- }
- ++(*ArgNum);
- return Arg;
+ /* Check if we do really have a number */
+ if (Converted != 1) {
+ fprintf (stderr, "Invalid number given in argument: %s\n", Arg);
+ exit (EXIT_FAILURE);
}
-}
-
-
-static void LongOption (int* Arg, char* argv [])
-/* Handle a long command line option */
-{
- /* For now ... */
- UnknownOption (argv [*Arg]);
+ /* Return the result */
+ return Val;
}
* path separator character eventually needed.
*/
Len = LibPathLen;
- NewName = Xmalloc (strlen (Name) + Len + 2);
+ NewName = xmalloc (strlen (Name) + Len + 2);
/* Build the new name */
memcpy (NewName, LibPath, Len);
if (NewName [Len-1] != '/' && NewName [Len-1] != '\\') {
* be freed if we run into an error, but that's no problem. Adding more
* code to work around it will use more memory than the chunk that's lost.
*/
- Xfree (NewName);
+ xfree (NewName);
+}
+
+
+
+static void OptHelp (const char* Opt, const char* Arg)
+/* Print usage information and exit */
+{
+ Usage ();
+ exit (EXIT_SUCCESS);
+}
+
+
+
+static void OptVersion (const char* Opt, const char* Arg)
+/* Print the assembler version */
+{
+ fprintf (stderr,
+ "ld65 V%u.%u.%u - (C) Copyright 1998-2000 Ullrich von Bassewitz\n",
+ VER_MAJOR, VER_MINOR, VER_PATCH);
}
int main (int argc, char* argv [])
/* Assembler main program */
{
+ /* Program long options */
+ static const LongOpt OptTab[] = {
+ { "--help", 0, OptHelp },
+ { "--version", 0, OptVersion },
+ };
+
int I;
+ /* Initialize the cmdline module */
+ InitCmdLine (argc, argv, "ld65");
+
/* Evaluate the CC65_LIB environment variable */
LibPath = getenv ("CC65_LIB");
if (LibPath == 0) {
#ifdef CC65_LIB
LibPath = CC65_LIB;
#else
- LibPath = "/usr/lib/cc65/lib/";
+ LibPath = "/usr/lib/cc65/lib/";
#endif
}
LibPathLen = strlen (LibPath);
/* Check the parameters */
I = 1;
while (I < argc) {
-
+
/* Get the argument */
const char* Arg = argv [I];
switch (Arg [1]) {
case '-':
- LongOption (&I, argv);
+ LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0]));
break;
case 'm':
- MapFileName = GetArg (&I, argv, 2);
+ MapFileName = GetArg (&I, 2);
break;
case 'o':
- OutputName = GetArg (&I, argv, 2);
+ OutputName = GetArg (&I, 2);
break;
case 't':
if (CfgAvail ()) {
Error ("Cannot use -C/-t twice");
}
- TgtSet (GetArg (&I, argv, 2));
+ TgtSet (GetArg (&I, 2));
break;
case 'v':
if (CfgAvail ()) {
Error ("Cannot use -C/-t twice");
}
- CfgSetName (GetArg (&I, argv, 2));
+ CfgSetName (GetArg (&I, 2));
break;
case 'L':
switch (Arg [2]) {
- case 'n': LabelFileName = GetArg (&I, argv, 3); break;
- case 'p': WProtSegs = 1; break;
- default: UnknownOption (Arg);
+ case 'n': LabelFileName = GetArg (&I, 3); break;
+ case 'p': WProtSegs = 1; break;
+ default: UnknownOption (Arg); break;
}
break;
case 'S':
- StartAddr = CvtNumber (Arg, GetArg (&I, argv, 2));
+ StartAddr = CvtNumber (Arg, GetArg (&I, 2));
break;
case 'V':
- fprintf (stderr,
- "ld65 V%u.%u.%u - (C) Copyright 1998-2000 Ullrich von Bassewitz\n",
- VER_MAJOR, VER_MINOR, VER_PATCH);
+ OptVersion (Arg, 0);
break;
default:
/* Check if we had any object files */
if (ObjFiles == 0) {
fprintf (stderr, "No object files to link\n");
- Usage ();
+ exit (EXIT_FAILURE);
}
/* Check if we have a valid configuration */
if (!CfgAvail ()) {
fprintf (stderr, "Memory configuration missing\n");
- Usage ();
+ exit (EXIT_FAILURE);
}
/* Read the config file */
+
library.o \
main.o \
mapfile.o \
- mem.o \
o65.o \
objdata.o \
objfile.o \
zap: clean
rm -f *.o $(EXECS) .depend
-
+
# ------------------------------------------------------------------------------
# Make the dependencies
library.obj \
main.obj \
mapfile.obj \
- mem.obj \
o65.obj \
objdata.obj \
objfile.obj \
FILE library.obj
FILE main.obj
FILE mapfile.obj
-FILE mem.obj
FILE o65.obj
FILE objdata.obj
FILE objfile.obj
#include <time.h>
#include "../common/version.h"
+#include "../common/xmalloc.h"
-#include "global.h"
#include "error.h"
-#include "mem.h"
-#include "fileio.h"
#include "exports.h"
#include "expr.h"
+#include "fileio.h"
+#include "global.h"
#include "o65.h"
/* Create a new relocation table */
{
/* Allocate a new structure */
- O65RelocTab* R = Xmalloc (sizeof (O65RelocTab));
+ O65RelocTab* R = xmalloc (sizeof (O65RelocTab));
/* Initialize the data */
R->Size = RELOC_BLOCKSIZE;
R->Fill = 0;
- R->Buf = Xmalloc (RELOC_BLOCKSIZE);
+ R->Buf = xmalloc (RELOC_BLOCKSIZE);
/* Return the created struct */
return R;
static void FreeO65RelocTab (O65RelocTab* R)
/* Free a relocation table */
{
- Xfree (R->Buf);
- Xfree (R);
+ xfree (R->Buf);
+ xfree (R);
}
/* Do we have enough space in the buffer? */
if (R->Fill == R->Size) {
/* We need to grow the buffer */
- unsigned char* NewBuf = Xmalloc (R->Size + RELOC_BLOCKSIZE);
+ unsigned char* NewBuf = xmalloc (R->Size + RELOC_BLOCKSIZE);
memcpy (NewBuf, R->Buf, R->Size);
- Xfree (R->Buf);
+ xfree (R->Buf);
R->Buf = NewBuf;
}
CHECK (DataLen <= 253);
/* Allocate memory */
- O = Xmalloc (sizeof (O65Option) - 1 + DataLen);
+ O = xmalloc (sizeof (O65Option) - 1 + DataLen);
/* Initialize the structure */
O->Next = 0;
static void FreeO65Option (O65Option* O)
/* Free an O65Option struct */
{
- Xfree (O);
+ xfree (O);
}
/* Create, initialize and return a new O65 descriptor struct */
{
/* Allocate a new structure */
- O65Desc* D = Xmalloc (sizeof (O65Desc));
+ O65Desc* D = xmalloc (sizeof (O65Desc));
/* Initialize the header */
D->Header.Version = 0;
/* Delete the descriptor struct with cleanup */
{
/* Free the segment arrays */
- Xfree (D->ZPSeg);
- Xfree (D->BssSeg);
- Xfree (D->DataSeg);
- Xfree (D->TextSeg);
+ xfree (D->ZPSeg);
+ xfree (D->BssSeg);
+ xfree (D->DataSeg);
+ xfree (D->TextSeg);
/* Free the relocation tables */
FreeO65RelocTab (D->DataReloc);
FreeExtSymTab (D->Imports);
/* Free the struct itself */
- Xfree (D);
+ xfree (D);
}
}
/* Allocate memory according to the numbers */
- D->TextSeg = Xmalloc (D->TextCount * sizeof (SegDesc*));
- D->DataSeg = Xmalloc (D->DataCount * sizeof (SegDesc*));
- D->BssSeg = Xmalloc (D->BssCount * sizeof (SegDesc*));
- D->ZPSeg = Xmalloc (D->ZPCount * sizeof (SegDesc*));
+ D->TextSeg = xmalloc (D->TextCount * sizeof (SegDesc*));
+ D->DataSeg = xmalloc (D->DataCount * sizeof (SegDesc*));
+ D->BssSeg = xmalloc (D->BssCount * sizeof (SegDesc*));
+ D->ZPSeg = xmalloc (D->ZPCount * sizeof (SegDesc*));
/* Walk again through the list and setup the segment arrays */
TextIdx = DataIdx = BssIdx = ZPIdx = 0;
#include <string.h>
-#include "mem.h"
+#include "../common/xmalloc.h"
+
#include "error.h"
#include "objdata.h"
/* Allocate a new structure on the heap, insert it into the list, return it */
{
/* Allocate memory */
- ObjData* O = Xmalloc (sizeof (ObjData));
+ ObjData* O = xmalloc (sizeof (ObjData));
/* Initialize the data */
O->Next = 0;
/* Link it into the list */
if (ObjLast) {
- ObjLast->Next = O;
- ObjLast = O;
+ ObjLast->Next = O;
+ ObjLast = O;
} else {
- /* First entry */
- ObjRoot = ObjLast = O;
+ /* First entry */
+ ObjRoot = ObjLast = O;
}
/* One object file more now */
void FreeObjData (ObjData* O)
/* Free a complete struct */
{
- Xfree (O->Name);
- Xfree (O->Imports);
- Xfree (O->Exports);
- Xfree (O->DbgSyms);
- Xfree (O);
+ xfree (O->Name);
+ xfree (O->Imports);
+ xfree (O->Exports);
+ xfree (O->DbgSyms);
+ xfree (O);
}
#include <time.h>
#include <sys/stat.h>
+#include "../common/xmalloc.h"
+
+#include "dbgsyms.h"
#include "error.h"
-#include "mem.h"
-#include "objdata.h"
+#include "exports.h"
#include "fileio.h"
+#include "objdata.h"
#include "segments.h"
-#include "exports.h"
-#include "dbgsyms.h"
#include "objfile.h"
unsigned I;
O->FileCount = Read8 (F);
- O->Files = Xmalloc (O->FileCount * sizeof (char*));
+ O->Files = xmalloc (O->FileCount * sizeof (char*));
for (I = 0; I < O->FileCount; ++I) {
/* Skip MTime and size */
Read32 (F);
unsigned I;
O->ImportCount = Read16 (F);
- O->Imports = Xmalloc (O->ImportCount * sizeof (Import*));
+ O->Imports = xmalloc (O->ImportCount * sizeof (Import*));
for (I = 0; I < O->ImportCount; ++I) {
O->Imports [I] = ReadImport (F, O);
InsertImport (O->Imports [I]);
unsigned I;
O->ExportCount = Read16 (F);
- O->Exports = Xmalloc (O->ExportCount * sizeof (Export*));
+ O->Exports = xmalloc (O->ExportCount * sizeof (Export*));
for (I = 0; I < O->ExportCount; ++I) {
O->Exports [I] = ReadExport (F, O);
InsertExport (O->Exports [I]);
unsigned I;
O->DbgSymCount = Read16 (F);
- O->DbgSyms = Xmalloc (O->DbgSymCount * sizeof (DbgSym*));
+ O->DbgSyms = xmalloc (O->DbgSymCount * sizeof (DbgSym*));
for (I = 0; I < O->DbgSymCount; ++I) {
O->DbgSyms [I] = ReadDbgSym (F, O);
}
unsigned I;
O->SectionCount = Read8 (F);
- O->Sections = Xmalloc (O->SectionCount * sizeof (Section*));
+ O->Sections = xmalloc (O->SectionCount * sizeof (Section*));
for (I = 0; I < O->SectionCount; ++I) {
O->Sections [I] = ReadSection (F, O);
}
ObjReadHeader (Obj, &O->Header, Name);
/* Initialize the object module data structure */
- O->Name = StrDup (GetModule (Name));
+ O->Name = xstrdup (GetModule (Name));
O->Flags = OBJ_HAVEDATA;
/* Read the files list from the object file */
#include <string.h>
#include "../common/exprdefs.h"
-#include "../common/symdefs.h"
-#include "../common/segdefs.h"
#include "../common/hashstr.h"
+#include "../common/segdefs.h"
+#include "../common/symdefs.h"
+#include "../common/xmalloc.h"
-#include "mem.h"
-#include "global.h"
#include "error.h"
-#include "fileio.h"
#include "expr.h"
+#include "fileio.h"
+#include "global.h"
#include "segments.h"
/* Create a new fragment and insert it into the segment S */
{
/* Allocate memory */
- Fragment* F = Xmalloc (sizeof (Fragment) - 1 + Size); /* Portable? */
+ Fragment* F = xmalloc (sizeof (Fragment) - 1 + Size); /* Portable? */
/* Initialize the data */
F->Next = 0;
unsigned Len = strlen (Name);
/* Allocate memory */
- Segment* S = Xmalloc (sizeof (Segment) + Len);
+ Segment* S = xmalloc (sizeof (Segment) + Len);
/* Initialize the fields */
S->Next = 0;
/* Allocate memory */
- Section* S = Xmalloc (sizeof (Segment));
+ Section* S = xmalloc (sizeof (Segment));
/* Initialize the data */
S->Next = 0;
Segment** SegPool;
/* Allocate memory for the segment pool */
- SegPool = Xmalloc (SegCount * sizeof (Segment*));
+ SegPool = xmalloc (SegCount * sizeof (Segment*));
/* Collect pointers to the segments */
I = 0;
}
/* Free the segment pool */
- Xfree (SegPool);
+ xfree (SegPool);
}